public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Chris Mason <mason@suse.com>
To: Christoph Hellwig <hch@infradead.org>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lockfs patch for 2.6
Date: Sat, 13 Mar 2004 10:20:14 -0500	[thread overview]
Message-ID: <1079191213.4187.243.camel@watt.suse.com> (raw)
In-Reply-To: <20040313131447.A25900@infradead.org>

On Sat, 2004-03-13 at 08:14, Christoph Hellwig wrote:
> On Tue, Mar 09, 2004 at 04:31:25PM -0500, Chris Mason wrote:
> > Hello everyone,
> > 
> > In order to get consistent snapshots with the device mapper code, you
> > need to sync and lock down any filesystems sitting on top of the
> > device.  This isn't as critical in the 2.6 code since it can do writable
> > snapshots, but it is still nice to have things properly synced and
> > consistent.  
> > 
> > I've had various forms of this against 2.4, the ugly part was always the
> > locking to make sure a new FS wasn't mounted on the source while the
> > snapshot was being setup.  Here's my 2.6 version, with the DM code
> > contributed by Kevin Corry.  The basic idea is to add a semaphore to the
> > block device that gets used to make sure there are no new mounts.
> 
> Okay, I actually took a look at the XFS freeze code and it seems the
> current infrastructure doesn't suite XFS very well.
> 
> What XFS currently does when freezing is
> 
> 1.	set a flag in the mount structure that blocks all new writes
> 2.	flush all file data
> 3.	set a flag blocking all new transactions
> 4.	flush any dirty inode state into buffers
> 5.	push out all buffers to disk
> 6.	mark the filesystem clean
> 
> Now how does this fit into generic freeze/thaw fs structure?
> 
> 1.	should probably move into the VFS (generic_file_write)
> 
> 2,4,5	basically is fsync_bdev except that we have no chance to block
> transaction that way.  So either we need two calls into the fs or have
> some trivial state in the superblock that tells xfs to block transaction,
> basically an enum { FS_UNFROZEN, FS_FROZEN_WRITE, FS_FROZEN_FULL };
> 
> and a function fs_check_frozen similar to xfs_check_frozen that makes the
> caller block until the fs is unfrozen.
> 
> Doing it that way would get rid of lots of mess in XFS so I'm all for it :)

This is basically how reiserfs does it.  Various critical spots (like
the code to start a transaction) check to see if the FS is frozen.

I'll rework the patch as we've discussed on Friday, if you need it
broken up differently, please let me know.

-chris



  reply	other threads:[~2004-03-13 15:18 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-09 21:31 [PATCH] lockfs patch for 2.6 Chris Mason
2004-03-12  9:31 ` Christoph Hellwig
2004-03-12 15:50   ` Chris Mason
2004-03-12 15:51     ` Christoph Hellwig
2004-03-13 13:14 ` Christoph Hellwig
2004-03-13 15:20   ` Chris Mason [this message]
2004-03-13 16:33     ` Christoph Hellwig
2004-03-14 14:00       ` Christoph Hellwig
2004-03-14 15:23         ` Chris Mason
2004-03-26 10:25           ` Christoph Hellwig
2004-03-26 13:28             ` Chris Mason
2004-04-01 20:35             ` Chris Mason
2004-04-01 22:32               ` Kevin Corry
2004-04-02 20:00               ` Kevin Corry
2004-04-02 20:02                 ` Christoph Hellwig
2004-04-02 20:26                   ` Kevin Corry
2004-03-14 18:44         ` Andrew Morton
2004-03-14 18:52           ` Christoph Hellwig
2004-03-14 18:56           ` Chris Mason

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=1079191213.4187.243.camel@watt.suse.com \
    --to=mason@suse.com \
    --cc=hch@infradead.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