diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index 48dfb8e4baf20276e8ac801ae84eb3a9e8583e4e..56304c400db57eb828730e5b99ed3f378b708331 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c @@ -2856,8 +2856,10 @@ static long btrfs_fallocate(struct file *file, int mode, } ret = btrfs_qgroup_reserve_data(inode, cur_offset, last_byte - cur_offset); - if (ret < 0) + if (ret < 0) { + free_extent_map(em); break; + } } else { /* * Do not need to reserve unwritten extent for this