Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2739652pxj; Mon, 31 May 2021 09:32:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCQTV4A3+b7srfQ8LVPSc8jhHE+gJQrxqfG0ZJy8j7DMu3KpktPYQKooN+t62GI6Q8KcXQ X-Received: by 2002:aa7:ca1a:: with SMTP id y26mr5314045eds.314.1622478721074; Mon, 31 May 2021 09:32:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622478721; cv=none; d=google.com; s=arc-20160816; b=HN3HAEsOeJIXd4EBSSbEz7zdM4f919FAN5fGN3DWmS3r3bz4m5Jcp+wSWY4YhUzpht bozLAWbhhCl+D/5pkS/EcPb34Eo6ZienhVE+382oIVasM7gkzMtaGdtNdym3I2oZUuF9 LINxl7AJoNfRtsODCzEuuPOhNAtL4lZe339vHotw3yZGFN0poKpCV0eo9LcSyRq88FFQ ajrj0Az630AZ9HzJ3uHdW1j1VN2vRzimUJKhXcO55qijgU8dIpH6GTZ5+KC8kez18TvO lV2l3iki+xJObXwkkxVn3o25yCgzL7xK/TYx2avCTxNmDiuieVPw2badbR9tt/z+UwOO hZyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=PbEL9tKZTuJwAW+WKajWQJumWelkdyzUKM5T/VR6Rgc=; b=Qsk9tA8tsHi83qFf021hLivfHx8dFTOAYJoZilzDOt91ZIFC29BiBOEV+/3wQbom24 30F5OMzIqGTty5FED6mSFZc2N5mmmECBXH2j+Zv8GLcwJQJKncN2IpUmT1N2uvVacKLo /v0qDRLXMHFC/K3E2OK3Gvy4VxMm1G1S4ffJ5Zqg15rJyQtJF18A9fnm5ZO6GBxbjFDS JahJ/YbNboN3S167OAnt9zEl06rVqFd3eV4CT1+vTZTB9jHrDo0wfjHtkQUmX19pkj6M xOrfxTZwdXElqKi8ElSmP3tWxTV0posLm/Md/UxJY/4ubj99dSrirdiQK5cNXDG1lnkd sQ5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XVu6oo0C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i10si16002330ejd.683.2021.05.31.09.31.31; Mon, 31 May 2021 09:32:01 -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=@linuxfoundation.org header.s=korg header.b=XVu6oo0C; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233940AbhEaQ3U (ORCPT + 99 others); Mon, 31 May 2021 12:29:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:40718 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233103AbhEaOph (ORCPT ); Mon, 31 May 2021 10:45:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5C4F36143D; Mon, 31 May 2021 13:55:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622469320; bh=J92z31Ks7LNs9W0RjN69gwEGe59n8IsFFyb+fj2tIz8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XVu6oo0CnzILWfTPtOthOeV9GRT1q30HcOhEd32q/VBa3rTErC7mbAnMEv1ce+3Op ArLw5FhW9kCQ9Q3ZNL/pUJ3EZZJHkdnoExE4zhsFqg1c4U9x3seyM9U4YvxHzNd/hK vNzWanwyCLJiDf6n7JGWQOydrthcZ/E1QUEjbUMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, David Howells , Marc Dionne , linux-afs@lists.infradead.org, Linus Torvalds Subject: [PATCH 5.12 153/296] afs: Fix the nlink handling of dir-over-dir rename Date: Mon, 31 May 2021 15:13:28 +0200 Message-Id: <20210531130709.009434618@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130703.762129381@linuxfoundation.org> References: <20210531130703.762129381@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: David Howells commit f610a5a29c3cfb7d37bdfa4ef52f72ea51f24a76 upstream. Fix rename of one directory over another such that the nlink on the deleted directory is cleared to 0 rather than being decremented to 1. This was causing the generic/035 xfstest to fail. Fixes: e49c7b2f6de7 ("afs: Build an abstraction around an "operation" concept") Signed-off-by: David Howells Reviewed-by: Marc Dionne cc: linux-afs@lists.infradead.org Link: https://lore.kernel.org/r/162194384460.3999479.7605572278074191079.stgit@warthog.procyon.org.uk/ # v1 Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- fs/afs/dir.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/fs/afs/dir.c +++ b/fs/afs/dir.c @@ -1842,7 +1842,9 @@ static void afs_rename_edit_dir(struct a new_inode = d_inode(new_dentry); if (new_inode) { spin_lock(&new_inode->i_lock); - if (new_inode->i_nlink > 0) + if (S_ISDIR(new_inode->i_mode)) + clear_nlink(new_inode); + else if (new_inode->i_nlink > 0) drop_nlink(new_inode); spin_unlock(&new_inode->i_lock); }