From: Filipe Manana <[email protected]> Checking if the destination root is read-only was being performed only for clone operations. Make deduplication check it as well, as it does not make sense to not do it, even if it is an operation that does not change the file contents (such as defrag for example, which checks first if the root is read-only).
Signed-off-by: Filipe Manana <[email protected]> --- fs/btrfs/ioctl.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index ffe940ceb80a..4e9efc93340e 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c @@ -3907,12 +3907,8 @@ static int btrfs_remap_file_range_prep(struct file *file_in, loff_t pos_in, u64 wb_len; int ret; - if (!(remap_flags & REMAP_FILE_DEDUP)) { - struct btrfs_root *root_out = BTRFS_I(inode_out)->root; - - if (btrfs_root_readonly(root_out)) - return -EROFS; - } + if (btrfs_root_readonly(BTRFS_I(inode_out)->root)) + return -EROFS; if (file_in->f_path.mnt != file_out->f_path.mnt || inode_in->i_sb != inode_out->i_sb) -- 2.11.0
