From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2D808C43458 for ; Mon, 27 Jul 2020 14:32:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 05187207FC for ; Mon, 27 Jul 2020 14:32:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595860376; bh=0ZJWlq1G8erVgH9EJ/RuAJrxn1aUU9FfBEqTpkzpFxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=o5FEg8/5MQH1YAcAf6bCnBZDAyi/s+Y/rRwGPU0UHdPPQGiNPPOXILAfG9su4B3eO nlWeQ5xMAC38dBaVIvS1u1lcZEBjBeOPQxLOHFCKhkvo57flIYs45qeu4TIKUUDkR2 m/VrrP89WtLemgev/xhUFnEklMbxtxhRDvquP3Yw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730576AbgG0Ocz (ORCPT ); Mon, 27 Jul 2020 10:32:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:46138 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731224AbgG0OS3 (ORCPT ); Mon, 27 Jul 2020 10:18:29 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5045F2070A; Mon, 27 Jul 2020 14:18:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859508; bh=0ZJWlq1G8erVgH9EJ/RuAJrxn1aUU9FfBEqTpkzpFxc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DKMBjkNHoKRWaGZxXSKU2FVTDQqChUDaNEbz6HYI5w3Vi12lkLiklR+v0IEC0RMYE 1ehOKKYb33MQf51fNWZyRxSCAnRuRpA7c6HlZihLFxKneBNoK19jF94xIqEzNhDerr fzprGb2iEDSVs3Tnr3xY0RX79Wrrmmd0wwFw1jxw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Steve French , Patrick Fernie , Ronnie Sahlberg , Pavel Shilovsky , Zhang Xiaoxu Subject: [PATCH 5.4 107/138] Revert "cifs: Fix the target file was deleted when rename failed." Date: Mon, 27 Jul 2020 16:05:02 +0200 Message-Id: <20200727134930.819342802@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134925.228313570@linuxfoundation.org> References: <20200727134925.228313570@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Steve French commit 0e6705182d4e1b77248a93470d6d7b3013d59b30 upstream. This reverts commit 9ffad9263b467efd8f8dc7ae1941a0a655a2bab2. Upon additional testing with older servers, it was found that the original commit introduced a regression when using the old SMB1 dialect and rsyncing over an existing file. The patch will need to be respun to address this, likely including a larger refactoring of the SMB1 and SMB3 rename code paths to make it less confusing and also to address some additional rename error cases that SMB3 may be able to workaround. Signed-off-by: Steve French Reported-by: Patrick Fernie CC: Stable Acked-by: Ronnie Sahlberg Acked-by: Pavel Shilovsky Acked-by: Zhang Xiaoxu Signed-off-by: Greg Kroah-Hartman --- fs/cifs/inode.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) --- a/fs/cifs/inode.c +++ b/fs/cifs/inode.c @@ -1791,7 +1791,6 @@ cifs_rename2(struct inode *source_dir, s FILE_UNIX_BASIC_INFO *info_buf_target; unsigned int xid; int rc, tmprc; - bool new_target = d_really_is_negative(target_dentry); if (flags & ~RENAME_NOREPLACE) return -EINVAL; @@ -1868,13 +1867,8 @@ cifs_rename2(struct inode *source_dir, s */ unlink_target: - /* - * If the target dentry was created during the rename, try - * unlinking it if it's not negative - */ - if (new_target && - d_really_is_positive(target_dentry) && - (rc == -EACCES || rc == -EEXIST)) { + /* Try unlinking the target dentry if it's not negative */ + if (d_really_is_positive(target_dentry) && (rc == -EACCES || rc == -EEXIST)) { if (d_is_dir(target_dentry)) tmprc = cifs_rmdir(target_dir, target_dentry); else