public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Theodore Tso <tytso@mit.edu>
To: Chris Mason <chris.mason@oracle.com>
Cc: "Måns Rullgård" <mans@mansr.com>,
	linux-kernel@vger.kernel.org, linux-ext4@vger.kernel.org
Subject: Re: Zero length files - an alternative approach?
Date: Mon, 30 Mar 2009 10:06:59 -0400	[thread overview]
Message-ID: <20090330140659.GH13356@mit.edu> (raw)
In-Reply-To: <1238416886.30488.6.camel@think.oraclecorp.com>

On Mon, Mar 30, 2009 at 08:41:26AM -0400, Chris Mason wrote:
> > 
> > Consider this scenario:
> > 
> > 1. Create/write/close newfile
> > 2. Rename newfile to oldfile
> 
> 2a. create oldfile again
> 2b. fsync oldfile
> 
> > 3. Open/read oldfile.  This must return the new contents.
> > 4. System crash and reboot before delayed allocation/flush complete
> > 5. Open/read oldfile.  Old contents now returned.
> > 
> 
> What happens to the new generation of oldfile?  We could insert
> dependency tracking so that we know the fsync of oldfile is supposed to
> also fsync the rename'd new file.  But then picture a loop of operations
> doing renames and creating files in the place of the old one...that
> dependency tracking gets ugly in a hurry.

If there are any calls to link(2) to create hard links to oldfile or
newfile intermingled in this sequence, life also gets very
entertaining.

> Databases know how to do all of this, but filesystems don't implement
> most of the database transactional features.

Yep, we'd have to implement a rollback log to get this right, which
would also impact performance.  My guess is that just aggressively
forcing out the data write before the rename() is going to cost less
in performance, and is certainly much easier to implement.

   		       		      	     - Ted

  reply	other threads:[~2009-03-30 14:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-29 10:43 Zero length files - an alternative approach? Graham Murray
2009-03-29 11:22 ` Måns Rullgård
2009-03-29 12:02   ` Andreas T.Auer
2009-03-29 12:10     ` Måns Rullgård
2009-03-29 13:49       ` Pavel Machek
2009-03-29 20:16         ` David Newall
2009-03-30 12:41   ` Chris Mason
2009-03-30 14:06     ` Theodore Tso [this message]
2009-03-29 16:49 ` Avi Kivity
     [not found] <cl0KI-3zZ-3@gated-at.bofh.it>
     [not found] ` <cl1oA-4El-9@gated-at.bofh.it>
     [not found]   ` <clp6o-91-17@gated-at.bofh.it>
2009-03-30 21:10     ` Bodo Eggert

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=20090330140659.GH13356@mit.edu \
    --to=tytso@mit.edu \
    --cc=chris.mason@oracle.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mans@mansr.com \
    /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