Skip to content

Commit

Permalink
fix get_active_super()/umount() race
Browse files Browse the repository at this point in the history
This one needs restarts...

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed May 21, 2010
1 parent e7fe058 commit 1494583
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 1494583

Please sign in to comment.