Linux-XFS Archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <djwong@kernel.org>
To: djwong@kernel.org
Cc: hch@infradead.org, linux-xfs@vger.kernel.org, hch@lst.de
Subject: [PATCH 1/4] xfs: drop the scrub file's iolock when transaction allocation fails
Date: Wed, 17 Apr 2024 16:14:23 -0700	[thread overview]
Message-ID: <171339555978.2000000.9920658450385469752.stgit@frogsfrogsfrogs> (raw)
In-Reply-To: <171339555949.2000000.17126642990842191341.stgit@frogsfrogsfrogs>

From: Darrick J. Wong <djwong@kernel.org>

If the transaction allocation in the !orphanage_available case of
xrep_nlinks_repair_inode fails, we need to drop the IOLOCK of the file
being scrubbed before exiting.

Found by fuzzing u3.sfdir3.list[1].name = zeroes in xfs/1546.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/scrub/nlinks_repair.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)


diff --git a/fs/xfs/scrub/nlinks_repair.c b/fs/xfs/scrub/nlinks_repair.c
index 78d0f650fe897..b3e707f47b7b5 100644
--- a/fs/xfs/scrub/nlinks_repair.c
+++ b/fs/xfs/scrub/nlinks_repair.c
@@ -138,8 +138,10 @@ xrep_nlinks_repair_inode(
 
 		error = xfs_trans_alloc(mp, &M_RES(mp)->tr_link, 0, 0, 0,
 				&sc->tp);
-		if (error)
+		if (error) {
+			xchk_iunlock(sc, XFS_IOLOCK_EXCL);
 			return error;
+		}
 
 		xchk_ilock(sc, XFS_ILOCK_EXCL);
 		xfs_trans_ijoin(sc->tp, ip, 0);


  reply	other threads:[~2024-04-17 23:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-17 23:10 [PATCHBOMB v13.3] xfs: tweaks and fixes to online repair, part 2 Darrick J. Wong
2024-04-17 23:13 ` [PATCHSET v13.3 1/2] xfs: reduce iget overhead in scrub Darrick J. Wong
2024-04-17 23:13   ` [PATCH 1/2] xfs: use dontcache for grabbing inodes during scrub Darrick J. Wong
2024-04-18  4:22     ` Christoph Hellwig
2024-04-17 23:14   ` [PATCH 2/2] xfs: only iget the file once when doing vectored scrub-by-handle Darrick J. Wong
2024-04-18  4:22     ` Christoph Hellwig
2024-04-17 23:13 ` [PATCHSET v13.3 2/2] xfs: minor fixes to online repair Darrick J. Wong
2024-04-17 23:14   ` Darrick J. Wong [this message]
2024-04-18  4:23     ` [PATCH 1/4] xfs: drop the scrub file's iolock when transaction allocation fails Christoph Hellwig
2024-04-17 23:14   ` [PATCH 2/4] xfs: fix iunlock calls in xrep_adoption_trans_alloc Darrick J. Wong
2024-04-18  4:23     ` Christoph Hellwig
2024-04-17 23:14   ` [PATCH 3/4] xfs: exchange-range for repairs is no longer dynamic Darrick J. Wong
2024-04-18  4:24     ` Christoph Hellwig
2024-04-17 23:15   ` [PATCH 4/4] xfs: invalidate dentries for a file before moving it to the orphanage Darrick J. Wong
2024-04-18  4:25     ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2024-04-24  3:07 [PATCHSET v13.4 9/9] xfs: minor fixes to online repair Darrick J. Wong
2024-04-24  3:29 ` [PATCH 1/4] xfs: drop the scrub file's iolock when transaction allocation fails Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=171339555978.2000000.9920658450385469752.stgit@frogsfrogsfrogs \
    --to=djwong@kernel.org \
    --cc=hch@infradead.org \
    --cc=hch@lst.de \
    --cc=linux-xfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).