Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2660926pxj; Mon, 31 May 2021 07:39:40 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzh98mKYGZFLSlUcMpRkNpiC8gJw/nimqYWT16zF31VyBciw0koEAP1ztCim4dgFCKNhTxH X-Received: by 2002:a5d:89c1:: with SMTP id a1mr17583698iot.73.1622471980270; Mon, 31 May 2021 07:39:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622471980; cv=none; d=google.com; s=arc-20160816; b=b+ptyODoWJS0Z4PHzr8J3AfPdUIx/jLxiyVi5fCUKO6OONRjVNGbuWoCpzywqVU/sa uvpqvgxVugIv82FDTE5U2wE0GyLEYY28Gvij3LekiHZWtaGExDxgA1yHyKcPbWoOqLv5 7x4tvNRn21N42Fnx1nA2QUbHrAwzQKeNLEtAWDRglNYgATtKAKX0LNy64SRpEkJxz7Bi 5UAJ/uYo4BGXBumUfdnQthtHWSDjN8NtCk3bMjypaJLtfiu+kcgaAoaQlCNDSsAqMn9w ZShRpJ83Os2xum8QAAnQHiiP+K8elTDuFjo6whx6opiiEz/0Y0YC/wehUbfECC6Z8aX7 ED7Q== 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=zjMma1BEAeIJyASvgoAtyhyjUj/EtUxyKxe874oMRIo=; b=lUdayBYqhkTP5n3azoFOENZ5KOuZrNe2mW5ucXFD/eGXQEu1sY6SUxHHo5JsTeH9/I opU5PsbSznDLFbk+dX9vim88KSvU4W2NYo+0grtXQ9Lrx9TXCv3itnJG6Y8ThfZiruPX orQ8/sFRsmdG6o8NAw0YvQI2Nqz40dURpCwlPr2NgGfMecAy2G5AWl3dMOKe80HOsMHR K01pd4FqnXwPIQMZtcnuw+N/CttVo05x1vPFP55wl6WU6l2o7KD5X42tl5zT39AsccLW NHUzLs27wo2AasE9y2DbocrPWFlCMASuyCgNMFHis3AJGHRdY5oFRodCRvJVZlq8jo6C dGmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=pmEXiyuD; 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 q3si16100642ilu.88.2021.05.31.07.39.27; Mon, 31 May 2021 07:39:40 -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=pmEXiyuD; 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 S233883AbhEaOka (ORCPT + 99 others); Mon, 31 May 2021 10:40:30 -0400 Received: from mail.kernel.org ([198.145.29.99]:60392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232879AbhEaN5x (ORCPT ); Mon, 31 May 2021 09:57:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4897C61934; Mon, 31 May 2021 13:35:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1622468118; bh=6POFTNX1dh2UhJ8ERwGW7D+0auUtxdRNsMSCAl6IMjU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=pmEXiyuD/5GmVrDMZgCzJ8EjOYkcgt7hrSL3jVjIL7Zpis5Nq2YYf0mRiNshQzmWF bldxRMJlgry5VpXJ9CVJe0lY8K1G50RSu2go1Zwl9g2V24p2b7LRP91NUHV0oTrrO0 voHgShP97lXG77bGUUsRB9KKGSPp1pX5Ud5a+V+4= 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.10 124/252] afs: Fix the nlink handling of dir-over-dir rename Date: Mon, 31 May 2021 15:13:09 +0200 Message-Id: <20210531130702.210803769@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210531130657.971257589@linuxfoundation.org> References: <20210531130657.971257589@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 @@ -1837,7 +1837,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); }