瀏覽代碼

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 <dsterba@suse.cz>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
David Sterba 12 年之前
父節點
當前提交
6ef3de9c92
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      fs/btrfs/super.c

+ 6 - 0
fs/btrfs/super.c

@@ -1340,6 +1340,12 @@ static int btrfs_remount(struct super_block *sb, int *flags, char *data)
 		if (ret)
 		if (ret)
 			goto restore;
 			goto restore;
 	} else {
 	} 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) {
 		if (fs_info->fs_devices->rw_devices == 0) {
 			ret = -EACCES;
 			ret = -EACCES;
 			goto restore;
 			goto restore;