From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4C5771D696; Mon, 11 Dec 2023 18:41:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="uifyJQS8" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9B91DC433C7; Mon, 11 Dec 2023 18:41:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702320096; bh=sbd5i/nTjnELi4z/6kzEQfoDA5HmfqxmI02it/pprsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uifyJQS840Rsfu9pd4+ta+fSPf4Jy13QiYklNwZ59bUJpgp3fJTovWZex3x/1iZIG TugNcv5LIXnBmWAsT5lhz1u4u52/R2llkZ+2vIkhUN6QCPIUOzKv2l0JpVa1vWJBUj Tee6LB6zYxtcqoOMSwZdYo1U4Ai780V0ISr87qDU= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Dave Chinner , Xiaoli Feng , Shyam Prasad N , Rohith Surabattula , Jeff Layton , Darrick Wong , fstests@vger.kernel.org, linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, David Howells , Steve French , Sasha Levin Subject: [PATCH 5.10 93/97] cifs: Fix non-availability of dedup breaking generic/304 Date: Mon, 11 Dec 2023 19:22:36 +0100 Message-ID: <20231211182023.825980782@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211182019.802717483@linuxfoundation.org> References: <20231211182019.802717483@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: linux-fsdevel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: David Howells [ Upstream commit 691a41d8da4b34fe72f09393505f55f28a8f34ec ] Deduplication isn't supported on cifs, but cifs doesn't reject it, instead treating it as extent duplication/cloning. This can cause generic/304 to go silly and run for hours on end. Fix cifs to indicate EOPNOTSUPP if REMAP_FILE_DEDUP is set in ->remap_file_range(). Note that it's unclear whether or not commit b073a08016a1 is meant to cause cifs to return an error if REMAP_FILE_DEDUP. Fixes: b073a08016a1 ("cifs: fix that return -EINVAL when do dedupe operation") Cc: stable@vger.kernel.org Suggested-by: Dave Chinner cc: Xiaoli Feng cc: Shyam Prasad N cc: Rohith Surabattula cc: Jeff Layton cc: Darrick Wong cc: fstests@vger.kernel.org cc: linux-cifs@vger.kernel.org cc: linux-fsdevel@vger.kernel.org Link: https://lore.kernel.org/r/3876191.1701555260@warthog.procyon.org.uk/ Signed-off-by: David Howells Signed-off-by: Steve French Signed-off-by: Sasha Levin --- fs/cifs/cifsfs.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index b87d6792b14ad..16155529e449f 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1093,7 +1093,9 @@ static loff_t cifs_remap_file_range(struct file *src_file, loff_t off, unsigned int xid; int rc; - if (remap_flags & ~(REMAP_FILE_DEDUP | REMAP_FILE_ADVISORY)) + if (remap_flags & REMAP_FILE_DEDUP) + return -EOPNOTSUPP; + if (remap_flags & ~REMAP_FILE_ADVISORY) return -EINVAL; cifs_dbg(FYI, "clone range\n"); -- 2.42.0