aboutsummaryrefslogtreecommitdiffstats
path: root/fs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/super.c')
-rw-r--r--fs/super.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/fs/super.c b/fs/super.c
index 2a49fed77453..a64f36208797 100644
--- a/fs/super.c
+++ b/fs/super.c
@@ -542,25 +542,33 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)
542 shrink_dcache_sb(sb); 542 shrink_dcache_sb(sb);
543 sync_filesystem(sb); 543 sync_filesystem(sb);
544 544
545 lock_kernel();
545 /* If we are remounting RDONLY and current sb is read/write, 546 /* If we are remounting RDONLY and current sb is read/write,
546 make sure there are no rw files opened */ 547 make sure there are no rw files opened */
547 if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) { 548 if ((flags & MS_RDONLY) && !(sb->s_flags & MS_RDONLY)) {
548 if (force) 549 if (force)
549 mark_files_ro(sb); 550 mark_files_ro(sb);
550 else if (!fs_may_remount_ro(sb)) 551 else if (!fs_may_remount_ro(sb)) {
552 unlock_kernel();
551 return -EBUSY; 553 return -EBUSY;
554 }
552 retval = vfs_dq_off(sb, 1); 555 retval = vfs_dq_off(sb, 1);
553 if (retval < 0 && retval != -ENOSYS) 556 if (retval < 0 && retval != -ENOSYS) {
557 unlock_kernel();
554 return -EBUSY; 558 return -EBUSY;
559 }
555 } 560 }
556 remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY); 561 remount_rw = !(flags & MS_RDONLY) && (sb->s_flags & MS_RDONLY);
557 562
558 if (sb->s_op->remount_fs) { 563 if (sb->s_op->remount_fs) {
559 retval = sb->s_op->remount_fs(sb, &flags, data); 564 retval = sb->s_op->remount_fs(sb, &flags, data);
560 if (retval) 565 if (retval) {
566 unlock_kernel();
561 return retval; 567 return retval;
568 }
562 } 569 }
563 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK); 570 sb->s_flags = (sb->s_flags & ~MS_RMT_MASK) | (flags & MS_RMT_MASK);
571 unlock_kernel();
564 if (remount_rw) 572 if (remount_rw)
565 vfs_dq_quota_on_remount(sb); 573 vfs_dq_quota_on_remount(sb);
566 return 0; 574 return 0;
@@ -581,9 +589,7 @@ static void do_emergency_remount(struct work_struct *work)
581 * 589 *
582 * What lock protects sb->s_flags?? 590 * What lock protects sb->s_flags??
583 */ 591 */
584 lock_kernel();
585 do_remount_sb(sb, MS_RDONLY, NULL, 1); 592 do_remount_sb(sb, MS_RDONLY, NULL, 1);
586 unlock_kernel();
587 } 593 }
588 up_write(&sb->s_umount); 594 up_write(&sb->s_umount);
589 put_super(sb); 595 put_super(sb);