mirror of
https://github.com/edk2-porting/linux-next.git
synced 2025-01-25 23:26:03 +08:00
btrfs: fix inode reserve space leak due to nowait buffered write
During a nowait buffered write, if we fail to balance dirty pages we exit
btrfs_buffered_write() without releasing the delalloc space reserved for
an extent, resulting in leaking space from the inode's block reserve.
So fix that by releasing the delalloc space for the extent when balancing
dirty pages fails.
Reported-by: kernel test robot <yujie.liu@intel.com>
Link: https://lore.kernel.org/all/202210111304.d369bc32-yujie.liu@intel.com
Fixes: 965f47aeb5
("btrfs: make btrfs_buffered_write nowait compatible")
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
parent
a348c8d4f6
commit
eb81b682b1
@ -1607,8 +1607,10 @@ static noinline ssize_t btrfs_buffered_write(struct kiocb *iocb,
|
||||
release_bytes = reserve_bytes;
|
||||
again:
|
||||
ret = balance_dirty_pages_ratelimited_flags(inode->i_mapping, bdp_flags);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
btrfs_delalloc_release_extents(BTRFS_I(inode), reserve_bytes);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is going to setup the pages array with the number of
|
||||
|
Loading…
Reference in New Issue
Block a user