summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/inode.c
diff options
context:
space:
mode:
authorRobbie Ko2016-10-07 04:01:29 +0200
committerFilipe Manana2017-02-24 01:38:01 +0100
commit91e1f56a8b3c94cb5ac9ce12b806134dc33c1eeb (patch)
treecf195dc2a83a87b24a495a8cb7357f17f690f117 /fs/btrfs/inode.c
parentBtrfs: bulk delete checksum items in the same leaf (diff)
downloadkernel-qcow2-linux-91e1f56a8b3c94cb5ac9ce12b806134dc33c1eeb.tar.gz
kernel-qcow2-linux-91e1f56a8b3c94cb5ac9ce12b806134dc33c1eeb.tar.xz
kernel-qcow2-linux-91e1f56a8b3c94cb5ac9ce12b806134dc33c1eeb.zip
Btrfs: fix leak of subvolume writers counter
When falling back from a nocow write to a regular cow write, we were leaking the subvolume writers counter in 2 situations, preventing snapshot creation from ever completing in the future, as it waits for that counter to go down to zero before the snapshot creation starts. Signed-off-by: Robbie Ko <robbieko@synology.com> Reviewed-by: Filipe Manana <fdmanana@suse.com> [Improved changelog and subject] Signed-off-by: Filipe Manana <fdmanana@suse.com>
Diffstat (limited to 'fs/btrfs/inode.c')
-rw-r--r--fs/btrfs/inode.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index c38391e948d9..4efe9d82944c 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -1331,10 +1331,16 @@ next_slot:
* either valid or do not exist.
*/
if (csum_exist_in_range(fs_info, disk_bytenr,
- num_bytes))
+ num_bytes)) {
+ if (!nolock)
+ btrfs_end_write_no_snapshoting(root);
goto out_check;
- if (!btrfs_inc_nocow_writers(fs_info, disk_bytenr))
+ }
+ if (!btrfs_inc_nocow_writers(fs_info, disk_bytenr)) {
+ if (!nolock)
+ btrfs_end_write_no_snapshoting(root);
goto out_check;
+ }
nocow = 1;
} else if (extent_type == BTRFS_FILE_EXTENT_INLINE) {
extent_end = found_key.offset +