mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +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:
parent
f73bae8367
commit
af7551cf13
1 changed files with 6 additions and 13 deletions
19
fs/super.c
19
fs/super.c
|
@ -930,8 +930,7 @@ 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);
|
||||
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)
|
||||
f(sb, arg);
|
||||
super_unlock_shared(sb);
|
||||
}
|
||||
if (locked)
|
||||
f(sb, arg);
|
||||
|
||||
spin_lock(&sb_lock);
|
||||
if (p)
|
||||
|
@ -991,18 +987,15 @@ struct super_block *user_get_super(dev_t dev, bool excl)
|
|||
|
||||
spin_lock(&sb_lock);
|
||||
list_for_each_entry(sb, &super_blocks, s_list) {
|
||||
if (sb->s_dev == dev) {
|
||||
if (sb->s_dev == dev) {
|
||||
bool locked;
|
||||
|
||||
sb->s_count++;
|
||||
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);
|
||||
|
|
Loading…
Add table
Reference in a new issue