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=ham 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 07DAFC433E0 for ; Thu, 30 Jul 2020 08:15:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D69472074B for ; Thu, 30 Jul 2020 08:15:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596096931; bh=qnVZu9crdHTCyMWJNFk+Ro1TPn3vWi+nlVvrtDnRP+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=0dnCf0UwUFBpwGJcJT7AehaESKWq5uyMyh7fgoS62uLjYT/aBeZG9b78EggN7SYL3 V2j5u4m9zARnJeGIjjIkOttvMWCvtV1RmbjPMT3D7Q0Hr78100PDzJpDaRKstt5dEd wrS6JeCxw5pjCP9ad2OHcRFPG513SR/0QojT4/Kg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730225AbgG3IP3 (ORCPT ); Thu, 30 Jul 2020 04:15:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:50942 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729032AbgG3ILk (ORCPT ); Thu, 30 Jul 2020 04:11:40 -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 90C992074B; Thu, 30 Jul 2020 08:11:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596096700; bh=qnVZu9crdHTCyMWJNFk+Ro1TPn3vWi+nlVvrtDnRP+I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ru43QaJ1rXugetJEdJg/vdjShrn+Pc0pXQafpFKlGEJK2Jkw/5QnDuIj37nAjG6ZN hDLSJrAVxUidgK13l/jjQeOKbfmx6cOeG8rjLJnec+MbQ2gATfe+evvkSpQojP23vB wmBvnaDosyMoQUW/bp/+yEEKVITTFM0r6jiaa/wU= 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 4.4 26/54] Revert "cifs: Fix the target file was deleted when rename failed." Date: Thu, 30 Jul 2020 10:05:05 +0200 Message-Id: <20200730074422.463592386@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200730074421.203879987@linuxfoundation.org> References: <20200730074421.203879987@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 @@ -1737,7 +1737,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; @@ -1814,13 +1813,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