[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6dee286aa8a57a874a66d1e9c7fc835a60393197.1755806649.git.josef@toxicpanda.com>
Date: Thu, 21 Aug 2025 16:18:40 -0400
From: Josef Bacik <josef@...icpanda.com>
To: linux-fsdevel@...r.kernel.org,
linux-btrfs@...r.kernel.org,
kernel-team@...com,
linux-ext4@...r.kernel.org,
linux-xfs@...r.kernel.org,
brauner@...nel.org,
viro@...IV.linux.org.uk
Subject: [PATCH 29/50] block: use igrab in sync_bdevs
Instead of checking I_WILL_FREE or I_FREEING simply grab a reference to
the inode, as it will only succeed if the inode is live.
Signed-off-by: Josef Bacik <josef@...icpanda.com>
---
block/bdev.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/block/bdev.c b/block/bdev.c
index b77ddd12dc06..94ffc0b5a68c 100644
--- a/block/bdev.c
+++ b/block/bdev.c
@@ -1265,13 +1265,15 @@ void sync_bdevs(bool wait)
struct block_device *bdev;
spin_lock(&inode->i_lock);
- if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW) ||
- mapping->nrpages == 0) {
+ if (inode->i_state & I_NEW || mapping->nrpages == 0) {
spin_unlock(&inode->i_lock);
continue;
}
- __iget(inode);
spin_unlock(&inode->i_lock);
+
+ if (!igrab(inode))
+ continue;
+
spin_unlock(&blockdev_superblock->s_inode_list_lock);
/*
* We hold a reference to 'inode' so it couldn't have been
--
2.49.0
Powered by blists - more mailing lists