aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/super.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/super.c b/fs/super.c
index 44971d7df1ce..1f72e0d42d8f 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -425,7 +425,7 @@ void sync_supers(void)
425 * mounted on the device given. %NULL is returned if no match is found. 425 * mounted on the device given. %NULL is returned if no match is found.
426 */ 426 */
427 427
428struct super_block * get_super(struct block_device *bdev) 428struct super_block *get_super(struct block_device *bdev)
429{ 429{
430 struct super_block *sb; 430 struct super_block *sb;
431 431
@@ -441,13 +441,14 @@ rescan:
441 sb->s_count++; 441 sb->s_count++;
442 spin_unlock(&sb_lock); 442 spin_unlock(&sb_lock);
443 down_read(&sb->s_umount); 443 down_read(&sb->s_umount);
444 /* still alive? */
444 if (sb->s_root) 445 if (sb->s_root)
445 return sb; 446 return sb;
446 up_read(&sb->s_umount); 447 up_read(&sb->s_umount);
447 /* restart only when sb is no longer on the list */ 448 /* nope, got unmounted */
448 spin_lock(&sb_lock); 449 spin_lock(&sb_lock);
449 if (__put_super_and_need_restart(sb)) 450 __put_super(sb);
450 goto rescan; 451 goto rescan;
451 } 452 }
452 } 453 }
453 spin_unlock(&sb_lock); 454 spin_unlock(&sb_lock);
@@ -487,7 +488,7 @@ restart:
487 return NULL; 488 return NULL;
488} 489}
489 490
490struct super_block * user_get_super(dev_t dev) 491struct super_block *user_get_super(dev_t dev)
491{ 492{
492 struct super_block *sb; 493 struct super_block *sb;
493 494
@@ -500,13 +501,14 @@ rescan:
500 sb->s_count++; 501 sb->s_count++;
501 spin_unlock(&sb_lock); 502 spin_unlock(&sb_lock);
502 down_read(&sb->s_umount); 503 down_read(&sb->s_umount);
504 /* still alive? */
503 if (sb->s_root) 505 if (sb->s_root)
504 return sb; 506 return sb;
505 up_read(&sb->s_umount); 507 up_read(&sb->s_umount);
506 /* restart only when sb is no longer on the list */ 508 /* nope, got unmounted */
507 spin_lock(&sb_lock); 509 spin_lock(&sb_lock);
508 if (__put_super_and_need_restart(sb)) 510 __put_super(sb);
509 goto rescan; 511 goto rescan;
510 } 512 }
511 } 513 }
512 spin_unlock(&sb_lock); 514 spin_unlock(&sb_lock);