aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/file.c')
-rw-r--r--fs/btrfs/file.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c
index a9e0a4eaf3d9..c800d58f3013 100644
--- a/fs/btrfs/file.c
+++ b/fs/btrfs/file.c
@@ -225,6 +225,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
225 225
226 split->bdev = em->bdev; 226 split->bdev = em->bdev;
227 split->flags = flags; 227 split->flags = flags;
228 split->compress_type = em->compress_type;
228 ret = add_extent_mapping(em_tree, split); 229 ret = add_extent_mapping(em_tree, split);
229 BUG_ON(ret); 230 BUG_ON(ret);
230 free_extent_map(split); 231 free_extent_map(split);
@@ -239,6 +240,7 @@ int btrfs_drop_extent_cache(struct inode *inode, u64 start, u64 end,
239 split->len = em->start + em->len - (start + len); 240 split->len = em->start + em->len - (start + len);
240 split->bdev = em->bdev; 241 split->bdev = em->bdev;
241 split->flags = flags; 242 split->flags = flags;
243 split->compress_type = em->compress_type;
242 244
243 if (compressed) { 245 if (compressed) {
244 split->block_len = em->block_len; 246 split->block_len = em->block_len;
@@ -891,6 +893,17 @@ static ssize_t btrfs_file_aio_write(struct kiocb *iocb,
891 if (err) 893 if (err)
892 goto out; 894 goto out;
893 895
896 /*
897 * If BTRFS flips readonly due to some impossible error
898 * (fs_info->fs_state now has BTRFS_SUPER_FLAG_ERROR),
899 * although we have opened a file as writable, we have
900 * to stop this write operation to ensure FS consistency.
901 */
902 if (root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) {
903 err = -EROFS;
904 goto out;
905 }
906
894 file_update_time(file); 907 file_update_time(file);
895 BTRFS_I(inode)->sequence++; 908 BTRFS_I(inode)->sequence++;
896 909