mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-07 10:29:52 +00:00
super: remove pointless s_root checks
The locking guarantees that the superblock is alive and sb->s_root is still set. Remove the pointless check. Link: https://lore.kernel.org/r/20250329-work-freeze-v2-1-a47af37ecc3d@kernel.org Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
13
fs/super.c
13
fs/super.c
@@ -930,7 +930,6 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
|
||||
|
||||
locked = super_lock_shared(sb);
|
||||
if (locked) {
|
||||
if (sb->s_root)
|
||||
f(sb, arg);
|
||||
super_unlock_shared(sb);
|
||||
}
|
||||
@@ -967,11 +966,8 @@ void iterate_supers_type(struct file_system_type *type,
|
||||
spin_unlock(&sb_lock);
|
||||
|
||||
locked = super_lock_shared(sb);
|
||||
if (locked) {
|
||||
if (sb->s_root)
|
||||
if (locked)
|
||||
f(sb, arg);
|
||||
super_unlock_shared(sb);
|
||||
}
|
||||
|
||||
spin_lock(&sb_lock);
|
||||
if (p)
|
||||
@@ -998,11 +994,8 @@ struct super_block *user_get_super(dev_t dev, bool excl)
|
||||
spin_unlock(&sb_lock);
|
||||
/* still alive? */
|
||||
locked = super_lock(sb, excl);
|
||||
if (locked) {
|
||||
if (sb->s_root)
|
||||
return sb;
|
||||
super_unlock(sb, excl);
|
||||
}
|
||||
if (locked)
|
||||
return sb; /* caller will drop */
|
||||
/* nope, got unmounted */
|
||||
spin_lock(&sb_lock);
|
||||
__put_super(sb);
|
||||
|
||||
Reference in New Issue
Block a user