Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2741929rwd; Fri, 26 May 2023 10:30:11 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7lXEhPEBKJF3iLxuZEfWMtHk7TlumgqwM1DkAnkd4JVvBeGVKaObGHtSfRzgoroXJHAAl7 X-Received: by 2002:a05:6a20:3955:b0:10f:243c:a6e7 with SMTP id r21-20020a056a20395500b0010f243ca6e7mr160907pzg.13.1685122211408; Fri, 26 May 2023 10:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685122211; cv=none; d=google.com; s=arc-20160816; b=tmJAVsShDnZ77/a62teJqdOlLEVb6/mlsjPpT/L1YVEt9muskCXXetamZmWrmVtsjN A3LZ+EYnc5TgoeY36t+z/x7Gyy4t4NuLTEMGJPCe8ZcSIvO8QvlExS3xAiG3wPy+s2TZ /qtNYIzPjKuBtb3bHVldDQQrHKb5T2tSk/XvxwqHYhN8OITEo6hv0FcuOSReUjNhDWH9 uSoWwdRjqE44NnWI32xqixNKpUDF+IoWWbN/id4Z95fw4dH+AFz48CphEZ4HiQ7Sfr86 bjuoZcRKSoP96aoWBp5KMuZVqulhZws3gyc6lUIWCGsrd/GkhkTU/sOXjVzAfakdRX/0 /X/w== 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=kkWlPl9OY2OKB8e7s8p10JcYLC/4T+EuGxM70lrvD6g=; b=z/5kn1GaxKskJb9Eu1epuos1ES6+bt4jpI6Q2lpQxqZ9Hse5MHSPEEh1F9C/dTDWK2 gfSw37p8GzM6WkqB51r536RPW4ZE2VDdDAMbQ7LDLcXyMO1V6nwqSU3gbvn77QrPc6JX uSqeqiSS8zPZtX6pUmVXFdbi8c76/O2amjMls7Li0ZF1RYCLE3mBccmGmx3kDnGfBdcz Sl06fc2ZAwJO8JGaNLzx584QSxBQQqp+HJCHCm8mLg8GgA9X3tLE4hLk2+4I9yHbBvSB DUQ4cjftCj8FG21Rktcr7/MYhBOapd+YtM+6H1PGjoTKWuwc/eoJ6CFhknLzjGJvrdUq k/Ng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GXgdFunL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 200-20020a6302d1000000b0053489d58e12si1944208pgc.772.2023.05.26.10.29.58; Fri, 26 May 2023 10:30:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=GXgdFunL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237223AbjEZRFI (ORCPT + 99 others); Fri, 26 May 2023 13:05:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbjEZRFH (ORCPT ); Fri, 26 May 2023 13:05:07 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABA3CBC for ; Fri, 26 May 2023 10:05:06 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B6AD61A73 for ; Fri, 26 May 2023 17:05:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8EBD1C433EF; Fri, 26 May 2023 17:05:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1685120705; bh=ePK1BfFlvFrWar0yL2hBGckKFKq2mnc2EzLSm0R6ijc=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=GXgdFunLkyGrpkIU9YdEqlG2fBFk9ls+vr4FDXPuJGWqELhwebezmSz8ZUR5HR2da B8NYURXh77JegpXXuG8HPqF4UkB9PUu4sASuJEl1ME4u1LqzY47zim5rbmpJJmXHd2 vMAlAcqxK8UURKtgU5YSO0npZFMmsQwgjKjr6YUYY9JA1A+RfYkV38jDXerzOBg5M7 Z3/oTIeEuOK04HAm3otUSozyENpAkWbYyQhyavImhT1oTkYTDgTr3/jQZtXEV7WqKn wR/rmo/c4CeOGo5oSTdlB0x2N7f2jLHsQZRS5CF/YPUJe0pGbAdK+M1LYBWippl8Zi VVZlpvYs0S57w== Date: Fri, 26 May 2023 10:05:03 -0700 From: Jaegeuk Kim To: Chao Yu Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] f2fs: fix to set noatime and immutable flag for quota file Message-ID: References: <20230525082508.2320763-1-chao@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230525082508.2320763-1-chao@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/25, Chao Yu wrote: > We should set noatime bit for quota files, since no one cares about > atime of quota file, and we should set immutalbe bit as well, due to > nobody should write to the file through exported interfaces. > > Meanwhile this patch use inode_lock to avoid race condition during > inode->i_flags, f2fs_inode->i_flags update. > > Signed-off-by: Chao Yu > --- > v2: > - fix to detect i_flags status correctly. > fs/f2fs/super.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c > index 51812f459581..1cf84c993d7c 100644 > --- a/fs/f2fs/super.c > +++ b/fs/f2fs/super.c > @@ -2763,7 +2763,17 @@ static int f2fs_quota_enable(struct super_block *sb, int type, int format_id, > } > > /* Don't account quota for quota files to avoid recursion */ > + inode_lock(qf_inode); > qf_inode->i_flags |= S_NOQUOTA; > + > + if (!(F2FS_I(qf_inode)->i_flags & F2FS_NOATIME_FL) || > + !(F2FS_I(qf_inode)->i_flags & F2FS_IMMUTABLE_FL)) { What about this? if ((F2FS_I(qf_inode)->i_flags & qf_flag) != qf_flag) > + F2FS_I(qf_inode)->i_flags |= > + F2FS_NOATIME_FL | F2FS_IMMUTABLE_FL; > + f2fs_set_inode_flags(qf_inode); > + } > + inode_unlock(qf_inode); > + > err = dquot_load_quota_inode(qf_inode, type, format_id, flags); > iput(qf_inode); > return err; > -- > 2.40.1