From: Wu Fengguang <fengguang.wu@intel.com>
To: Dave Chinner <david@fromorbit.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Jan Kara <jack@suse.cz>, Christoph Hellwig <hch@lst.de>,
LKML <linux-kernel@vger.kernel.org>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [PATCH 1/3] writeback: introduce wbc.for_sync to cover the two sync stages
Date: Mon, 2 May 2011 11:23:35 +0800 [thread overview]
Message-ID: <20110502032335.GA13191@localhost> (raw)
In-Reply-To: <20110501074603.GC13542@dastard>
On Sun, May 01, 2011 at 03:46:04PM +0800, Dave Chinner wrote:
> On Sun, May 01, 2011 at 06:36:06AM +0800, Wu Fengguang wrote:
> > sync(2) is performed in two stages: the WB_SYNC_NONE sync and the
> > WB_SYNC_ALL sync. Tag both stages with wbc.for_sync for livelock
> > prevention.
> >
> > Note that writeback_inodes_sb() is called by not only sync(), they
> > are treated the same because the other callers need also need livelock
> > prevention.
> >
> > Impacts:
> >
> > - it changes the order in which pages/inodes are synced to disk. Now in
> > the WB_SYNC_NONE stage, it won't proceed to write the next inode until
> > finished with the current inode.
> >
> > - this adds a new field to the writeback trace events and may possibly
> > break some scripts.
> .....
> > --- linux-next.orig/mm/page-writeback.c 2011-05-01 06:35:16.000000000 +0800
> > +++ linux-next/mm/page-writeback.c 2011-05-01 06:35:17.000000000 +0800
> > @@ -892,12 +892,12 @@ int write_cache_pages(struct address_spa
> > range_whole = 1;
> > cycled = 1; /* ignore range_cyclic tests */
> > }
> > - if (wbc->sync_mode == WB_SYNC_ALL)
> > + if (wbc->for_sync)
> > tag = PAGECACHE_TAG_TOWRITE;
> > else
> > tag = PAGECACHE_TAG_DIRTY;
> > retry:
> > - if (wbc->sync_mode == WB_SYNC_ALL)
> > + if (wbc->for_sync)
> > tag_pages_for_writeback(mapping, index, end);
> > done_index = index;
> > while (!done && (index <= end)) {
>
> Doesn't that break anything that uses
> filemap_write_and_wait{_range}() or filemap_fdatawrite{_range}()?
> e.g. fsync, sync buffered writes, etc? i.e. everything that
> currently relies on WB_SYNC_ALL for data integrity writeback is now
> b0rken except for sync(1)?
Right, they'll become livelockable.. Good catch, thanks! I'll update
the patches to do
- if (wbc->sync_mode == WB_SYNC_ALL)
+ if (wbc->sync_mode == WB_SYNC_ALL || wbc->tagged_sync)
The alternative is to ask the other WB_SYNC_ALL callers to set
wbc.tagged_sync, but that seems more error prone.
Thanks,
Fengguang
next prev parent reply other threads:[~2011-05-02 3:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-30 22:36 [PATCH 0/3] sync livelock fixes Wu Fengguang
2011-04-30 22:36 ` [PATCH 1/3] writeback: introduce wbc.for_sync to cover the two sync stages Wu Fengguang
2011-05-01 7:46 ` Dave Chinner
2011-05-02 3:23 ` Wu Fengguang [this message]
2011-04-30 22:36 ` [PATCH 2/3] writeback: update dirtied_when for synced inode to prevent livelock Wu Fengguang
2011-04-30 22:36 ` [PATCH 3/3] writeback: avoid extra sync work at enqueue time Wu Fengguang
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=20110502032335.GA13191@localhost \
--to=fengguang.wu@intel.com \
--cc=akpm@linux-foundation.org \
--cc=david@fromorbit.com \
--cc=hch@lst.de \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--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).