aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index b437d3bdf95e..1bf37d15b174 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -172,6 +172,7 @@ static int run_delalloc_nocow(struct inode *inode, u64 start, u64 end)
172 u64 loops = 0; 172 u64 loops = 0;
173 u64 total_fs_bytes; 173 u64 total_fs_bytes;
174 struct btrfs_root *root = BTRFS_I(inode)->root; 174 struct btrfs_root *root = BTRFS_I(inode)->root;
175 struct btrfs_block_group_cache *block_group;
175 struct extent_buffer *leaf; 176 struct extent_buffer *leaf;
176 int found_type; 177 int found_type;
177 struct btrfs_path *path; 178 struct btrfs_path *path;
@@ -230,16 +231,20 @@ again:
230 if (bytenr == 0) 231 if (bytenr == 0)
231 goto not_found; 232 goto not_found;
232 233
234 if (btrfs_count_snapshots_in_path(root, path, inode->i_ino,
235 bytenr) != 1) {
236 goto not_found;
237 }
238
233 /* 239 /*
234 * we may be called by the resizer, make sure we're inside 240 * we may be called by the resizer, make sure we're inside
235 * the limits of the FS 241 * the limits of the FS
236 */ 242 */
237 if (bytenr + extent_num_bytes > total_fs_bytes) 243 block_group = btrfs_lookup_block_group(root->fs_info,
244 bytenr);
245 if (!block_group || block_group->ro)
238 goto not_found; 246 goto not_found;
239 247
240 if (btrfs_count_snapshots_in_path(root, path, bytenr) != 1) {
241 goto not_found;
242 }
243 248
244 start = extent_end; 249 start = extent_end;
245 } else { 250 } else {