Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280162
b: refs/heads/master
c: dabe0dc
h: refs/heads/master
v: v3
  • Loading branch information
Al Viro committed Jan 4, 2012
1 parent e8fb6e4 commit d365d57
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cf31e70d6cf93f19fe9bf1144966ef40991ac723
refs/heads/master: dabe0dc194d5d56d379a8994fff47392744b6491
20 changes: 13 additions & 7 deletions trunk/fs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ bool grab_super_passive(struct super_block *sb)
spin_unlock(&sb_lock);

if (down_read_trylock(&sb->s_umount)) {
if (sb->s_root)
if (sb->s_root && (sb->s_flags & MS_BORN))
return true;
up_read(&sb->s_umount);
}
Expand Down Expand Up @@ -505,7 +505,7 @@ void sync_supers(void)
spin_unlock(&sb_lock);

down_read(&sb->s_umount);
if (sb->s_root && sb->s_dirt)
if (sb->s_root && sb->s_dirt && (sb->s_flags & MS_BORN))
sb->s_op->write_super(sb);
up_read(&sb->s_umount);

Expand Down Expand Up @@ -540,7 +540,7 @@ void iterate_supers(void (*f)(struct super_block *, void *), void *arg)
spin_unlock(&sb_lock);

down_read(&sb->s_umount);
if (sb->s_root)
if (sb->s_root && (sb->s_flags & MS_BORN))
f(sb, arg);
up_read(&sb->s_umount);

Expand Down Expand Up @@ -575,7 +575,7 @@ void iterate_supers_type(struct file_system_type *type,
spin_unlock(&sb_lock);

down_read(&sb->s_umount);
if (sb->s_root)
if (sb->s_root && (sb->s_flags & MS_BORN))
f(sb, arg);
up_read(&sb->s_umount);

Expand Down Expand Up @@ -616,7 +616,7 @@ struct super_block *get_super(struct block_device *bdev)
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
/* still alive? */
if (sb->s_root)
if (sb->s_root && (sb->s_flags & MS_BORN))
return sb;
up_read(&sb->s_umount);
/* nope, got unmounted */
Expand Down Expand Up @@ -676,7 +676,7 @@ struct super_block *user_get_super(dev_t dev)
spin_unlock(&sb_lock);
down_read(&sb->s_umount);
/* still alive? */
if (sb->s_root)
if (sb->s_root && (sb->s_flags & MS_BORN))
return sb;
up_read(&sb->s_umount);
/* nope, got unmounted */
Expand Down Expand Up @@ -763,7 +763,8 @@ static void do_emergency_remount(struct work_struct *work)
sb->s_count++;
spin_unlock(&sb_lock);
down_write(&sb->s_umount);
if (sb->s_root && sb->s_bdev && !(sb->s_flags & MS_RDONLY)) {
if (sb->s_root && sb->s_bdev && (sb->s_flags & MS_BORN) &&
!(sb->s_flags & MS_RDONLY)) {
/*
* What lock protects sb->s_flags??
*/
Expand Down Expand Up @@ -1146,6 +1147,11 @@ int freeze_super(struct super_block *sb)
return -EBUSY;
}

if (!(sb->s_flags & MS_BORN)) {
up_write(&sb->s_umount);
return 0; /* sic - it's "nothing to do" */
}

if (sb->s_flags & MS_RDONLY) {
sb->s_frozen = SB_FREEZE_TRANS;
smp_wmb();
Expand Down

0 comments on commit d365d57

Please sign in to comment.