linux-f2fs-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Hong Mei Li <a21834@motorola.com>
Cc: Zhiming Yuan <a14194@motorola.com>,
	linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [PATCH] f2fs: add memory barrier for wait list and pages count
Date: Wed, 9 Mar 2016 17:03:38 -0800	[thread overview]
Message-ID: <20160310010338.GA56809@jaegeuk.gateway> (raw)
In-Reply-To: <CAAde8TA5GZF62UHOck8zgFW=ShcGWLp_2=KZNopRoCpa_PuNFQ@mail.gmail.com>

Hi Hong Mei,

In order to avoid this problem, we already added wq_has_sleeper() which calls
smp_mb() in end_io, and use io_schedule_timeout() instead of io_schedule() in
wait_on_all_pages_writeback().

How do you think whether this is enough or not?

Thanks,

On Wed, Mar 09, 2016 at 01:42:12PM -0800, Hong Mei Li wrote:
> From: Hong-Mei Li <a21834@motorola.com>
> 
> 
> Sometimes, f2fs fdatasync would stuck at wait_on_all_pages_writeback
> with pages count == 0 and itself in the waitlist.
> 
> Fix it by adding an explicit smp_mb() after writting wait list, to make
> sure the store is done before get_pages.
> And add another memory barrier in wakeup side, to make sure cpu reading
> wait list happens after decreased pages count syncing to memory.
> 
> Signed-off-by: Hong-Mei Li <a21834@motorola.com>
> Cc: linux-f2fs-devel@lists.sourceforge.net
> Cc: Jaegeuk Kim <jaegeuk@kernel.org>
> 
> ---
>  fs/f2fs/checkpoint.c | 1 +
>  fs/f2fs/data.c       | 1 +
>  2 files changed, 2 insertions(+)
> 
> diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c
> index 3842af9..4e5acab 100644
> --- a/fs/f2fs/checkpoint.c
> +++ b/fs/f2fs/checkpoint.c
> @@ -899,6 +899,7 @@ static void wait_on_all_pages_writeback(struct
> f2fs_sb_info *sbi)
>         for (;;) {
>                 prepare_to_wait(&sbi->cp_wait, &wait, TASK_UNINTERRUPTIBLE);
> 
> +               smp_mb();
>                 if (!get_pages(sbi, F2FS_WRITEBACK))
>                         break;
> 
> diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> index 5c06db1..b1d383c 100644
> --- a/fs/f2fs/data.c
> +++ b/fs/f2fs/data.c
> @@ -75,6 +75,7 @@ static void f2fs_write_end_io(struct bio *bio)
>                 dec_page_count(sbi, F2FS_WRITEBACK);
>         }
> 
> +       smp_mb();
>         if (!get_pages(sbi, F2FS_WRITEBACK) &&
>                         !list_empty(&sbi->cp_wait.task_list))
>                 wake_up(&sbi->cp_wait);
> -- 
> 1.9.1

------------------------------------------------------------------------------
Transform Data into Opportunity.
Accelerate data analysis in your applications with
Intel Data Analytics Acceleration Library.
Click to learn more.
http://pubads.g.doubleclick.net/gampad/clk?id=278785111&iu=/4140

       reply	other threads:[~2016-03-10  1:03 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <CAAde8TA5GZF62UHOck8zgFW=ShcGWLp_2=KZNopRoCpa_PuNFQ@mail.gmail.com>
2016-03-10  1:03 ` Jaegeuk Kim [this message]
     [not found]   ` <CAAde8TBW=7=L4JQJ0yTdRxrh5dpOt0KQCubKKxDuOcemvOHGBw@mail.gmail.com>
2016-03-10 20:18     ` [PATCH] f2fs: add memory barrier for wait list and pages count 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=20160310010338.GA56809@jaegeuk.gateway \
    --to=jaegeuk@kernel.org \
    --cc=a14194@motorola.com \
    --cc=a21834@motorola.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;
as well as URLs for NNTP newsgroup(s).