aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namespace.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/namespace.c')
-rw-r--r--fs/namespace.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/namespace.c b/fs/namespace.c
index 98ebc78b21ab..7e6f2c9dc7c4 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -449,6 +449,10 @@ int sb_prepare_remount_readonly(struct super_block *sb)
449 struct mount *mnt; 449 struct mount *mnt;
450 int err = 0; 450 int err = 0;
451 451
452 /* Racy optimization. Recheck the counter under MNT_WRITE_HOLD */
453 if (atomic_long_read(&sb->s_remove_count))
454 return -EBUSY;
455
452 br_write_lock(vfsmount_lock); 456 br_write_lock(vfsmount_lock);
453 list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) { 457 list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) {
454 if (!(mnt->mnt.mnt_flags & MNT_READONLY)) { 458 if (!(mnt->mnt.mnt_flags & MNT_READONLY)) {
@@ -460,6 +464,9 @@ int sb_prepare_remount_readonly(struct super_block *sb)
460 } 464 }
461 } 465 }
462 } 466 }
467 if (!err && atomic_long_read(&sb->s_remove_count))
468 err = -EBUSY;
469
463 if (!err) { 470 if (!err) {
464 sb->s_readonly_remount = 1; 471 sb->s_readonly_remount = 1;
465 smp_wmb(); 472 smp_wmb();