diff options
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r-- | fs/btrfs/file.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 05df688c96f4..f903433f5bdf 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -892,6 +892,17 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb, | |||
892 | if (err) | 892 | if (err) |
893 | goto out; | 893 | goto out; |
894 | 894 | ||
895 | /* | ||
896 | * If BTRFS flips readonly due to some impossible error | ||
897 | * (fs_info->fs_state now has BTRFS_SUPER_FLAG_ERROR), | ||
898 | * although we have opened a file as writable, we have | ||
899 | * to stop this write operation to ensure FS consistency. | ||
900 | */ | ||
901 | if (root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { | ||
902 | err = -EROFS; | ||
903 | goto out; | ||
904 | } | ||
905 | |||
895 | file_update_time(file); | 906 | file_update_time(file); |
896 | BTRFS_I(inode)->sequence++; | 907 | BTRFS_I(inode)->sequence++; |
897 | 908 | ||