Skip to contentSkip to conversation

fs: unlock the superblock during iterate_supers_type

PATCH Applied Darrick J. Wong 3 participants 3 messages Jun 11, 2025 – Jun 12, 2025 VFS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: unlock the superblock during iterate_supers_type

From: Darrick J. Wong <[email protected]>

This function takes super_lock in shared mode, so it should release the same lock.

Cc <[email protected]> # v6.16-rc1
Fixes af7551cf13cf7f ("super: remove pointless s_root checks")
---
 fs/super.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/super.c +3 -1
index 21799e213fd747..80418ca8e215bb 100644
@@ -964,8 +964,10 @@ void iterate_supers_type(struct file_system_type *type,
 		spin_unlock(&sb_lock);
 
 		locked = super_lock_shared(sb);
-		if (locked)
+		if (locked) {
 			f(sb, arg);
+			super_unlock_shared(sb);
+		}
 
 		spin_lock(&sb_lock);
 		if (p)
reviewer Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

This function takes super_lock in shared mode, so it should release the same lock.

Cc <[email protected]> # v6.16-rc1
Fixes af7551cf13cf7f ("super: remove pointless s_root checks")

Indeed that was an oversight. Thanks for catching it! Feel free to add:

Honza

Quoted 20 lines
---
 fs/super.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
fs/super.c +3 -1
index 21799e213fd747..80418ca8e215bb 100644
@@ -964,8 +964,10 @@ void iterate_supers_type(struct file_system_type *type,
 		spin_unlock(&sb_lock);
 
 		locked = super_lock_shared(sb);
-		if (locked)
+		if (locked) {
 			f(sb, arg);
+			super_unlock_shared(sb);
+		}
 
 		spin_lock(&sb_lock);
 		if (p)
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR
maintainer Applied
#2 lore raw
In reply to Darrick J. Wong
Quoted 4 lines · Darrick J. Wong

This function takes super_lock in shared mode, so it should release the same lock.

https://youtu.be/m6uvv1aS5_I?si=8e0DYW802X30y2UM&t=224

---

Applied to the vfs.fixes branch of the vfs/vfs.git tree. Patches in the vfs.fixes branch should appear in linux-next soon.

Please report any outstanding bugs that were missed during review in a new review to the original patch series allowing us to drop it.

It's encouraged to provide Acked-bys and Reviewed-bys even though the patch has now been applied. If possible patch trailers will be updated.

Note that commit hashes shown below are subject to change due to rebase, trailer updates or similar. If in doubt, please check the listed branch.

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/vfs/vfs.git
branch: vfs.fixes

[1/1] fs: unlock the superblock during iterate_supers_type

      https://git.kernel.org/vfs/vfs/c/0b9d62a47149