Received: by 2002:a17:90b:8d0:0:0:0:0 with SMTP id ds16csp4879501pjb; Mon, 27 Jul 2020 07:27:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/X8ndjW3q5EX1qWxS4us+/K6RTrC0GArnh0ZIdyDv6fgfSCgY082h5XwvEEX+y4jA7kaU X-Received: by 2002:a05:6402:21e6:: with SMTP id ce6mr16718288edb.275.1595860059468; Mon, 27 Jul 2020 07:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595860059; cv=none; d=google.com; s=arc-20160816; b=Xlq2p7OGMxTb2XLC93m0i16q4GhbuBjeiQonC6ILOTEWa4Mq2IyUyIIUnUgoyeO61t OEl/wp1qkUqAh+1gYC/mD5OoA2w2t4+qBatG2vN/Q1R5MUVRDXKqhKo7tAZzrk6ZYr+T VbR1UBWmuKj30E7hTIDicD1kM6gYZK9C/7FXzdYHhPYpl1Sq1iWmqEzzmx0Io5YA0x2e d3M1JnizMddJzUCLQ92ieNZX2bQuA2kfN1lgexZuz1k+J28HvNVxg87KElX6AHHVD8Mx 9Ybr1yhmeFCFiKMSwHc+qyPKN3QosnMDs4SblMTuG5alg0+c8lBq0SC2oQyYZPugV05D ZiBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=UXmHGVLS1oZ8iAcXShcev5BfmUyl8Eu5/rb+YDzT880=; b=G9YQSAkPDV1PgbScdw8o9ZJGCXm3ZFPLJNl6J1EGN/iDx2Mju0xRTtaCk33GIWDty7 FX778LoiPTI76nyDmxtij62zrlS52Ps+6YVxD+x1W61LvzqkM2Qvp19dSdynQ1ltOnaw eUobl+lBYmzhaqeaQuJpg4mJfWMoeMTHQaOaMkn34vDZfifRJMnOEO3pi2DuN9shjBiN /dkKLXsjBG8aGHhi62wSPO7R2SKMfwsyD4FzQfglTkvKYC0Ap++xvq+PSJRGxkMwGr/X M/DbcTVy/RfZf6UXkd3n2eMoAoRMsqc16KiQ6prYXNEVbhUcioyHP/tBdQnmyiDVWhAf zRKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZmSXR+Kr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dn20si5797923ejc.409.2020.07.27.07.27.17; Mon, 27 Jul 2020 07:27:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=ZmSXR+Kr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732335AbgG0OYz (ORCPT + 99 others); Mon, 27 Jul 2020 10:24:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:54466 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732314AbgG0OYq (ORCPT ); Mon, 27 Jul 2020 10:24:46 -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 BDEB32083E; Mon, 27 Jul 2020 14:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859886; bh=J8sibqxTOUhnRXX9MLrBVHdwW6emw3YaiKL6e8OxHHo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZmSXR+KrWWMOL3nTGbDfFtHvrmaMo8I4OMLe4SFGVewakKnKAGZVIx+Pwb6NRo34U QDtyzisyS1YTqdwXFd+BTe/IrgnhVLg4cfTuPCTu7nl2L/ftASpQY1A/m4IgrS0kGK kUDYaY5R5BTnEFxVUKqCytOBmEqG7mN6X0hSHgbA= 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.7 143/179] Revert "cifs: Fix the target file was deleted when rename failed." Date: Mon, 27 Jul 2020 16:05:18 +0200 Message-Id: <20200727134939.598871064@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@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 @@ -1855,7 +1855,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; @@ -1932,13 +1931,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