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 5F8BD321B8; Mon, 11 Dec 2023 18:59:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="ZAq/Esfi" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79385C433C8; Mon, 11 Dec 2023 18:59:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1702321176; bh=30XXDdWmj0e19sZG+Zen0i8d9uyhtB2aNJrO599Ta7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZAq/EsfifH4qskHexjR5X/LPhT3n6T0zVgW96xoHIbuSB9V0P/L6Ihqxowdh9nsVA lbrR1FveGgliRFsKUUm/Z/asMXr/THd9ivRrV6f6GmBUeeIXN54wJTSOimn2+i5dLI SHVEK/v4bVM8Qicx34OfqNUwTn7OvjYkMmdHs+EU= 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.15 138/141] cifs: Fix non-availability of dedup breaking generic/304 Date: Mon, 11 Dec 2023 19:23:17 +0100 Message-ID: <20231211182032.604454432@linuxfoundation.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20231211182026.503492284@linuxfoundation.org> References: <20231211182026.503492284@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.15-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 af688e39f31ac..9bbead15a0287 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -1144,7 +1144,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