Commit 1494583de59dfad2e3a6788ce9817e658d32df22
1 parent
e7fe0585ca
Exists in
master
and in
7 other branches
fix get_active_super()/umount() race
This one needs restarts... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 7 additions and 7 deletions Side-by-side Diff
fs/super.c
... | ... | @@ -471,17 +471,17 @@ |
471 | 471 | if (!bdev) |
472 | 472 | return NULL; |
473 | 473 | |
474 | +restart: | |
474 | 475 | spin_lock(&sb_lock); |
475 | 476 | list_for_each_entry(sb, &super_blocks, s_list) { |
476 | 477 | if (list_empty(&sb->s_instances)) |
477 | 478 | continue; |
478 | - if (sb->s_bdev != bdev) | |
479 | - continue; | |
480 | - | |
481 | - if (grab_super(sb)) /* drops sb_lock */ | |
482 | - return sb; | |
483 | - | |
484 | - spin_lock(&sb_lock); | |
479 | + if (sb->s_bdev == bdev) { | |
480 | + if (grab_super(sb)) /* drops sb_lock */ | |
481 | + return sb; | |
482 | + else | |
483 | + goto restart; | |
484 | + } | |
485 | 485 | } |
486 | 486 | spin_unlock(&sb_lock); |
487 | 487 | return NULL; |