linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: Christoph Hellwig <hch@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	linux-fsdevel@vger.kernel.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Jens Axboe <jens.axboe@oracle.com>
Subject: Re: [PATCH] vfs: Fix sys_sync() and fsync_super() reliability
Date: Thu, 23 Apr 2009 15:07:24 +0200	[thread overview]
Message-ID: <20090423130724.GA20896@duck.suse.cz> (raw)
In-Reply-To: <20090423111040.GB4833@infradead.org>

On Thu 23-04-09 07:10:40, Christoph Hellwig wrote:
> On Wed, Apr 22, 2009 at 05:56:20PM +0200, Jan Kara wrote:
> > So far, do_sync() called:
> >   sync_inodes(0);
> >   sync_supers();
> >   sync_filesystems(0);
> >   sync_filesystems(1);
> >   sync_inodes(1);
> > 
> > This ordering makes it kind of hard for filesystems as sync_inodes(0) need not
> > submit all the IO (for example it skips inodes with I_SYNC set) so e.g. forcing
> > transaction to disk in ->sync_fs() is not really enough. Therefore sys_sync has
> > not been completely reliable on some filesystems (ext3, ext4, reiserfs, ocfs2
> > and others are hit by this) when racing e.g. with background writeback. A
> > similar problem hits also other filesystems (e.g. ext2) because of
> > write_supers() being called before the sync_inodes(1).
> > 
> > Change the ordering of calls in do_sync() - this requires a new function
> > sync_blkdevs() to preserve the property that block devices are always synced
> > after write_super() / sync_fs() call.
> > 
> > The same issue is fixed in __fsync_super() function used on umount /
> > remount read-only.
> 
> This looks reasonable, but I always fear we break something when
> touching this path. It would be really nice if we could rewrite do_sync
> to sit ontop of __fsync_super.  E.g. do a 
> 
> 	for_each_sb()
> 		__fsync_super(sb, ASYNC);
> 	for_each_sb()
> 		__fsync_super(sb, SYNC);
> 
> so that we have one central place that makes sure a filesystem is
> properly synced.
  OK, makes sence. Will do.

> Another thing I want to do in this area is sort out the meaning of
> write_super.  I'd really prefer to have every filesystem implement
> ->sync_fs for actual data-integerity syncs, and only leave ->write_super
> for the periodic writeouts, as the current implementation is extrenly
> confusing and causes a lot of trouble for filesystems doing their own
> periodic sb writeback.
  Yes, that would be nice but I guess it's a partly a separate issue
(and has to touch a lot of filesystems). I'll keep write_supers() call in
the next version of the patch so that this split isn't made harded by it.

								Honza
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

  reply	other threads:[~2009-04-23 13:07 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-22 15:56 [PATCH 0/2] Fix sys_sync() bug and slightly cleanup the code Jan Kara
2009-04-22 15:56 ` [PATCH] vfs: Fix sys_sync() and fsync_super() reliability Jan Kara
2009-04-22 17:16   ` Trond Myklebust
2009-04-22 17:23     ` Jan Kara
2009-04-23 11:10   ` Christoph Hellwig
2009-04-23 13:07     ` Jan Kara [this message]
2009-04-23 13:09       ` Christoph Hellwig
2009-04-22 15:56 ` [PATCH] vfs: Merge sync_supers(), sync_filesystems() and sync_blockdevs() Jan Kara
2009-04-22 17:20   ` Trond Myklebust
2009-04-23 11:06   ` Christoph Hellwig
2009-04-23 12:31   ` Christoph Hellwig

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=20090423130724.GA20896@duck.suse.cz \
    --to=jack@suse.cz \
    --cc=akpm@linux-foundation.org \
    --cc=hch@infradead.org \
    --cc=jens.axboe@oracle.com \
    --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).