Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3596256rdb; Wed, 13 Sep 2023 17:55:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEUHobr5emC5+yq5LeOlyWxXBsFWICja5dtuDVl3XKgILjtGIvX1a5Fzjzci8jl1gv2DXL0 X-Received: by 2002:a05:6a00:99f:b0:68e:4834:4b25 with SMTP id u31-20020a056a00099f00b0068e48344b25mr5130232pfg.13.1694652925264; Wed, 13 Sep 2023 17:55:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694652925; cv=none; d=google.com; s=arc-20160816; b=gEHVSSmkVWJhZdpP8G9FPNw9NHxef/x52gsAoV/EFJFvZDVicUZJghLNHavphbffJY iAKOfBApkt7cXvrtUE6odgmFSXfq2QdSsiDFIBGGWE905TQDK1xZA7h7pN3w25UKuDC0 lQy9qy8KnlIWalDxdmfPQwvzCTA5uwB/aQzd7qUIxoKtNsruugEKQBYjYJwdkWeTslRg TpxkKP+8pGgSxjsvrxGiolA1Hn0KdTiphNpOOIXTaXV3h9LY3ZT4mBdwWx0yYB0jW7NR CQWoGK77ycerbvl1mOQTTMaoIwgKh8Ceif7lFxzOlUzFY1r5OG4FPvNeSv4v0kJhXhUd IeSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HT6xU4tcW9TDIgRseOglxWcshJSQ3PvzbPijNp+n/YM=; fh=btZ+eXd4/B+k0aLQGXrnrfsFmqhObyZ5fz+IgVc1gkM=; b=sEbHDiZJ39Tyt1u92TwZEGk6e06ivZWuCbfZ69PHf4YXLSEECT6Dv7bpQiHGXQOmMo A9palLdEZik5LmOl/27/xv6BG0SMoQAWZKP0viJyeuYWi5BDvbtBbWcOMEWXcDVfwEU8 zUUDKKQiZbhkn9wA5ZHPigO5Wco8QPGnYgydSIq/P+OIRQ9RtKyBqZzxf2fvmE/mHH1J O8LrSQNxpS2RrI1qJiW2CxTsf/y9YFiHQvv7vSDLBTed70kxUC6sSk4HbsN5HbDS6NA1 6XqdTQMiq/Z/n6t0LNngrqOEKhmc1iUudIrZqdUBuEFbPXIUgemBLrOKgdcpQfId/6Ff L69g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=3BgSZApF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [2620:137:e000::3:2]) by mx.google.com with ESMTPS id w20-20020a63fb54000000b00557447d5721si298139pgj.768.2023.09.13.17.55.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 17:55:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) client-ip=2620:137:e000::3:2; Authentication-Results: mx.google.com; dkim=pass header.i=@fromorbit-com.20230601.gappssmtp.com header.s=20230601 header.b=3BgSZApF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:2 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=fromorbit.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 3007681D82C8; Wed, 13 Sep 2023 16:42:17 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231515AbjIMXmN (ORCPT + 99 others); Wed, 13 Sep 2023 19:42:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229894AbjIMXmM (ORCPT ); Wed, 13 Sep 2023 19:42:12 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17B56CE4 for ; Wed, 13 Sep 2023 16:42:08 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id 98e67ed59e1d1-271d9823cacso327298a91.1 for ; Wed, 13 Sep 2023 16:42:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fromorbit-com.20230601.gappssmtp.com; s=20230601; t=1694648527; x=1695253327; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=HT6xU4tcW9TDIgRseOglxWcshJSQ3PvzbPijNp+n/YM=; b=3BgSZApF8fulkKRzZz5/WiO/dNF//D9ckcHVTAP0DuwzFRxjE+8T5p0uy7KRg675Vd /rfD1e9NVXUguk11Wl2qxlRQtq+fWi+tRHZ2FcyiqWMHytRxUasup3yi25TZl2jLV8l6 rCZdW2B2lPsKPNYMsa+nLf4v2GfKJ8fFoAe/YJAI0nw2kTrZABUYB6cXhvxyChZmwXgo yIjQjDw3ACBG/avQzbbUaN0TrhMP1Sq4F3iSUCN02UgmWgP2qQUJ1RMnUN5Zk9UrQGWR 1vIu85mubDqcVY2pg8XCo6YrJ8o/OmxVL/8OSTIcWduGKMT7hLCtNaNdJlYA9Qx/ph8c nXKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694648527; x=1695253327; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=HT6xU4tcW9TDIgRseOglxWcshJSQ3PvzbPijNp+n/YM=; b=K4NlMy/MghLKiTT3jXwG05WLusQVl5jkwdr5usXNNmGn2LhpLHDG0KZ4a+cVUR6TTT 1+5RIdf2mHPB16ICWoNLabRPeLb59t2tucPUcL0dc9ZEPfQWo0I0M9bVQPpl05LnafBB K+sRIBcTwdEG7Np96p7mLep0HaxAnViUJXj1ysWPusM45FIGn7zqejoOHVjCiX6us2n+ pYRAt9au/glstN+mmzJ1P3Wlll+ZkXPL4HOuS7sjL6wEqIYhiQTgZS7wyUTflCGVAce7 uTuhV4qoTSmN4fRQd3cl9nVrxAwilVvHFufUngeEN7L8QMD1RErQRYHxySWQVscZL9RD yqww== X-Gm-Message-State: AOJu0YwM1HmXzPd7kBj/ZC+IruwJmW9XISzjM48WTmQNfDLPlhl1pdOp +KsDEtFWzFt1HNrjul1MRnsleg== X-Received: by 2002:a17:90a:ab8d:b0:25f:20f:2f7d with SMTP id n13-20020a17090aab8d00b0025f020f2f7dmr3864635pjq.2.1694648527552; Wed, 13 Sep 2023 16:42:07 -0700 (PDT) Received: from dread.disaster.area (pa49-180-20-59.pa.nsw.optusnet.com.au. [49.180.20.59]) by smtp.gmail.com with ESMTPSA id ne10-20020a17090b374a00b002633fa95ac2sm1984921pjb.13.2023.09.13.16.42.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 16:42:06 -0700 (PDT) Received: from dave by dread.disaster.area with local (Exim 4.96) (envelope-from ) id 1qgZUh-000Nj6-0s; Thu, 14 Sep 2023 09:42:03 +1000 Date: Thu, 14 Sep 2023 09:42:03 +1000 From: Dave Chinner To: cheng.lin130@zte.com.cn Cc: djwong@kernel.org, linux-xfs@vger.kernel.org, linux-kernel@vger.kernel.org, jiang.yong5@zte.com.cn, wang.liang82@zte.com.cn, liu.dong3@zte.com.cn Subject: Re: [PATCH v3] xfs: introduce protection for drop nlink Message-ID: References: <202309131744458239465@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202309131744458239465@zte.com.cn> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Wed, 13 Sep 2023 16:42:17 -0700 (PDT) X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email On Wed, Sep 13, 2023 at 05:44:45PM +0800, cheng.lin130@zte.com.cn wrote: > From: Cheng Lin > > When abnormal drop_nlink are detected on the inode, > shutdown filesystem, to avoid corruption propagation. > > Signed-off-by: Cheng Lin > --- > fs/xfs/xfs_inode.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c > index 9e62cc500..40cc106ae 100644 > --- a/fs/xfs/xfs_inode.c > +++ b/fs/xfs/xfs_inode.c > @@ -919,6 +919,15 @@ xfs_droplink( > xfs_trans_t *tp, > xfs_inode_t *ip) > { > + > + if (VFS_I(ip)->i_nlink == 0) { > + xfs_alert(ip->i_mount, > + "%s: Deleting inode %llu with no links.", > + __func__, ip->i_ino); > + tp->t_flags |= XFS_TRANS_DIRTY; Marking the transaction dirty is not necessary. Otherwise this seems fine. -Dave. -- Dave Chinner david@fromorbit.com