From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:44522 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933021AbeFGRjQ (ORCPT ); Thu, 7 Jun 2018 13:39:16 -0400 From: Mark Fasheh To: Al Viro Cc: linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org, "Darrick J . Wong" , Adam Borowski , David Sterba , Mark Fasheh Subject: [PATCH v3 2/2] vfs: dedupe should return EPERM if permission is not granted Date: Thu, 7 Jun 2018 10:38:54 -0700 Message-Id: <20180607173854.15747-3-mfasheh@suse.de> In-Reply-To: <20180607173854.15747-1-mfasheh@suse.de> References: <20180607173854.15747-1-mfasheh@suse.de> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: Right now we return EINVAL if a process does not have permission to dedupe a file. This was an oversight on my part. EPERM gives a true description of the nature of our error, and EINVAL is already used for the case that the filesystem does not support dedupe. Signed-off-by: Mark Fasheh Reviewed-by: Darrick J. Wong Acked-by: David Sterba --- fs/read_write.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/read_write.c b/fs/read_write.c index 71e9077f8bc1..7188982e2733 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -2050,7 +2050,7 @@ int vfs_dedupe_file_range(struct file *file, struct file_dedupe_range *same) if (info->reserved) { info->status = -EINVAL; } else if (!allow_file_dedupe(dst_file)) { - info->status = -EINVAL; + info->status = -EPERM; } else if (file->f_path.mnt != dst_file->f_path.mnt) { info->status = -EXDEV; } else if (S_ISDIR(dst->i_mode)) { -- 2.15.1