linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v2] f2fs: fix to set noatime and immutable flag for quota file
Date: Fri, 26 May 2023 10:05:03 -0700	[thread overview]
Message-ID: <ZHDmv2hLR9WZ16Pl@google.com> (raw)
In-Reply-To: <20230525082508.2320763-1-chao@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 <chao@kernel.org>
> ---
> 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


_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

  reply	other threads:[~2023-05-26 17:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-25  8:25 [f2fs-dev] [PATCH v2] f2fs: fix to set noatime and immutable flag for quota file Chao Yu
2023-05-26 17:05 ` Jaegeuk Kim [this message]
2023-05-27  0:16   ` Chao Yu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZHDmv2hLR9WZ16Pl@google.com \
    --to=jaegeuk@kernel.org \
    --cc=chao@kernel.org \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).