aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorWang Shilong <wangsl.fnst@cn.fujitsu.com>2014-01-14 06:42:20 -0500
committerChris Mason <clm@fb.com>2014-01-28 16:20:36 -0500
commit2c21b4d733d6e50514e30ffd87110364ddda695b (patch)
tree95b303ca51649e3a934a6296042ada3d1dbea687 /fs/btrfs/inode.c
parente4355f34ef9fc75a93875fd075137ef2ea378883 (diff)
Btrfs: fix transaction abortion when remounting btrfs from RW to RO
Steps to reproduce: # mkfs.btrfs -f /dev/sda8 # mount /dev/sda8 /mnt -o flushoncommit # dd if=/dev/zero of=/mnt/data bs=4k count=102400 & # mount /dev/sda8 /mnt -o remount, ro When remounting RW to RO, the logic is to firstly set flag to RO and then commit transaction, however with option flushoncommit enabled,we will do RO check within committing transaction, so we get a transaction abortion here. Actually,here check is wrong, we should check if FS_STATE_ERROR is set, fix it. Reported-by: Qu Wenruo <quwenruo@cn.fujitsu.com> Suggested-by: Miao Xie <miaox@cn.fujitsu.com> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: Josef Bacik <jbacik@fb.com> Signed-off-by: Chris Mason <clm@fb.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 1ea19cea96d0..7b61ea3141e5 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -8477,7 +8477,7 @@ int btrfs_start_delalloc_inodes(struct btrfs_root *root, int delay_iput)
8477{ 8477{
8478 int ret; 8478 int ret;
8479 8479
8480 if (root->fs_info->sb->s_flags & MS_RDONLY) 8480 if (test_bit(BTRFS_FS_STATE_ERROR, &root->fs_info->fs_state))
8481 return -EROFS; 8481 return -EROFS;
8482 8482
8483 ret = __start_delalloc_inodes(root, delay_iput); 8483 ret = __start_delalloc_inodes(root, delay_iput);
@@ -8503,7 +8503,7 @@ int btrfs_start_delalloc_roots(struct btrfs_fs_info *fs_info, int delay_iput)
8503 struct list_head splice; 8503 struct list_head splice;
8504 int ret; 8504 int ret;
8505 8505
8506 if (fs_info->sb->s_flags & MS_RDONLY) 8506 if (test_bit(BTRFS_FS_STATE_ERROR, &fs_info->fs_state))
8507 return -EROFS; 8507 return -EROFS;
8508 8508
8509 INIT_LIST_HEAD(&splice); 8509 INIT_LIST_HEAD(&splice);