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 3/4] f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation
Date: Tue, 30 Jul 2024 16:26:12 +0000	[thread overview]
Message-ID: <ZqkUJAMJzW_4ANhY@google.com> (raw)
In-Reply-To: <9e6c0e72-a175-4432-bada-564464698c3f@kernel.org>

On 07/30, Chao Yu wrote:
> On 2024/7/30 0:26, Jaegeuk Kim wrote:
> > On 07/26, Chao Yu wrote:
> > > We should always truncate pagecache while truncating on-disk data.
> > > 
> > > Fixes: a46bebd502fe ("f2fs: synchronize atomic write aborts")
> > > Signed-off-by: Chao Yu <chao@kernel.org>
> > > ---
> > > v2:
> > > - fix to use cow_inode instead of inode
> > >   fs/f2fs/file.c | 1 +
> > >   1 file changed, 1 insertion(+)
> > > 
> > > diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> > > index 6c62f76474d1..54886ddcb8ab 100644
> > > --- a/fs/f2fs/file.c
> > > +++ b/fs/f2fs/file.c
> > > @@ -2202,6 +2202,7 @@ static int f2fs_ioc_start_atomic_write(struct file *filp, bool truncate)
> > >   		F2FS_I(fi->cow_inode)->atomic_inode = inode;
> > >   	} else {
> > >   		/* Reuse the already created COW inode */
> > > +		truncate_setsize(fi->cow_inode, 0);
> > 
> > What if the below truncation failed?
> 
> What about just dropping page cache and do not set isize to 0?

Can we also check if there's any dirty page before truncating it?

> 
> Thanks,
> 
> > 
> > >   		ret = f2fs_do_truncate_blocks(fi->cow_inode, 0, true);
> > >   		if (ret) {
> > >   			f2fs_up_write(&fi->i_gc_rwsem[WRITE]);
> > > -- 
> > > 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:[~2024-07-30 16:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-26  1:22 [f2fs-dev] [PATCH v2 3/4] f2fs: atomic: fix to truncate pagecache before on-disk metadata truncation Chao Yu
2024-07-29 16:26 ` Jaegeuk Kim
2024-07-30  1:29   ` Chao Yu
2024-07-30 16:26     ` Jaegeuk Kim [this message]
2024-07-31  8:18       ` Chao Yu
2024-07-31 20:27         ` Jaegeuk Kim

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=ZqkUJAMJzW_4ANhY@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).