Unverified Commit af7551cf authored by Christian Brauner's avatar Christian Brauner
Browse files

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: default avatarJan Kara <jack@suse.cz>
Signed-off-by: default avatarChristian Brauner <brauner@kernel.org>
parent f73bae83
Loading
Loading
Loading
Loading
+6 −13
Original line number Diff line number Diff line
@@ -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);