From: David Sterba Date: Fri, 13 Sep 2013 15:41:20 +0000 (+0200) Subject: btrfs: refuse to remount read-write after abort X-Git-Tag: v3.12-rc2~5^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ef3de9c9252b186720122d3ae7122a81d49f8ee;p=profile%2Fivi%2Fkernel-x86-ivi.git btrfs: refuse to remount read-write after abort It's still possible to flip the filesystem into RW mode after it's remounted RO due to an abort. There are lots of places that check for the superblock error bit and will not write data, but we should not let the filesystem appear read-write. Signed-off-by: David Sterba Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/super.c b/fs/btrfs/super.c index b341da3..6ab0df5 100644 --- a/fs/btrfs/super.c +++ b/fs/btrfs/super.c @@ -1340,6 +1340,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data) if (ret) goto restore; } else { + if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state)) { + btrfs_err(fs_info, + "Remounting read-write after error is not allowed\n"); + ret = -EINVAL; + goto restore; + } if (fs_info->fs_devices->rw_devices == 0) { ret = -EACCES; goto restore;