Linux-f2fs-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Hongwei <glqhw@qq.com>
Cc: linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
Subject: Re: [f2fs-dev] Can F2FS roll forward after fdatasync()?
Date: Wed, 3 Jun 2020 10:18:16 -0700	[thread overview]
Message-ID: <20200603171816.GC85814@google.com> (raw)
In-Reply-To: <tencent_2E2E902BD0A10D8A67C92DE7EC6D887BCB0A@qq.com>

Hi Hongwei,

On 05/29, Hongwei wrote:
> Hi,
> >On 05/28, Hongwei wrote:
> >> Hi F2FS experts,
> >> As written in f2fs_do_sync_file():
> >> "Both of fdatasync() and fsync() are able to be recovered from sudden-power-off."
> >>
> >> Please consider this workflow:
> >> 1. Start atomic write
> >> 2. Multiple file writes
> >> 3. Commit atomic write
> >> 4. fdatasync()
> >> 5. Powerloss.
> >>
> >> In the 4th step, the fdatasync() doesn't wait for node writeback.
> >> So we may loss node blocks after powerloss.
> >>
> >> If the data blocks are persisted but node blocks aren't, can the recovery program recover the transaction?
> >
> >#3 will guarantee the blocks written by #2. So, if there's no written between #3
> >and #4, I think we have nothing to recover.
> >Does this make sense to you?
> 
> Thanks for your reply. Please consider this:
> f2fs_do_sync_file() doesn't wait for node writeback if atomic==1. So it is possible that after #3, node is still writing back.
> #4 fdatasync() doesn't wait for node write back either.
> Considering node writeback BIO is flagged with PREFLUSH and FUA, it may take a long time to complete.
> Therefore, when #5 power failure happens, it is possible that the node block is not persisted?
> If I was correct about this, can the recovery program recover the transaction?

I see. That can be the issue tho, is there a real usecase for this? I mean,
given atomic writes by sqlite, next transaction will be also serialized with
another atomic writes, which we could bypass waiting node writes.

Thanks,

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


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

  reply	other threads:[~2020-06-03 17:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-28 15:34 [f2fs-dev] Can F2FS roll forward after fdatasync()? Hongwei
2020-05-28 17:26 ` Jaegeuk Kim
2020-05-29 13:02   ` Hongwei
2020-06-03 17:18     ` Jaegeuk Kim [this message]
2020-06-04 13:24       ` Hongwei Qin
     [not found]       ` <CAKvRR0QjB8u-MnG7om5skFAg_y68vb5b2jjL-VdMOFhHcKqc2g@mail.gmail.com>
     [not found]         ` <20200604161332.GA187121@google.com>
2020-06-05  4:19           ` Hongwei Qin

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=20200603171816.GC85814@google.com \
    --to=jaegeuk@kernel.org \
    --cc=glqhw@qq.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    /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