mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-01 10:45:49 +00:00
fix get_active_super()/umount() race
This one needs restarts... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
e7fe0585ca
commit
1494583de5
14
fs/super.c
14
fs/super.c
@ -471,17 +471,17 @@ struct super_block *get_active_super(struct block_device *bdev)
|
||||
if (!bdev)
|
||||
return NULL;
|
||||
|
||||
restart:
|
||||
spin_lock(&sb_lock);
|
||||
list_for_each_entry(sb, &super_blocks, s_list) {
|
||||
if (list_empty(&sb->s_instances))
|
||||
continue;
|
||||
if (sb->s_bdev != bdev)
|
||||
continue;
|
||||
|
||||
if (grab_super(sb)) /* drops sb_lock */
|
||||
return sb;
|
||||
|
||||
spin_lock(&sb_lock);
|
||||
if (sb->s_bdev == bdev) {
|
||||
if (grab_super(sb)) /* drops sb_lock */
|
||||
return sb;
|
||||
else
|
||||
goto restart;
|
||||
}
|
||||
}
|
||||
spin_unlock(&sb_lock);
|
||||
return NULL;
|
||||
|
Loading…
Reference in New Issue
Block a user