Skip to content

Commit deccae4

Browse files
masonclkdave
authored andcommitted
btrfs: can_nocow_file_extent should pass down args->strict from callers
Commit 619104b ("btrfs: move common NOCOW checks against a file extent into a helper") changed our call to btrfs_cross_ref_exist() to always pass false for the 'strict' parameter. We're passing this down through the stack so that we can do a full check for cross references during swapfile activation. With strict always false, this test fails: btrfs subvol create swappy chattr +C swappy fallocate -l1G swappy/swapfile chmod 600 swappy/swapfile mkswap swappy/swapfile btrfs subvol snap swappy swapsnap btrfs subvol del -C swapsnap btrfs fi sync / sync;sync;sync swapon swappy/swapfile The fix is to just use args->strict, and everyone except swapfile activation is passing false. Fixes: 619104b ("btrfs: move common NOCOW checks against a file extent into a helper") CC: stable@vger.kernel.org # 6.1+ Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Chris Mason <clm@fb.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 7833b86 commit deccae4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ static int can_nocow_file_extent(struct btrfs_path *path,
18641864

18651865
ret = btrfs_cross_ref_exist(root, btrfs_ino(inode),
18661866
key->offset - args->extent_offset,
1867-
args->disk_bytenr, false, path);
1867+
args->disk_bytenr, args->strict, path);
18681868
WARN_ON_ONCE(ret > 0 && is_freespace_inode);
18691869
if (ret != 0)
18701870
goto out;

0 commit comments

Comments
 (0)