linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Harkes <jaharkes@cs.cmu.edu>
To: linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] coda: file count cannot be used to discover last close
Date: Fri, 20 Jul 2007 10:26:51 -0400	[thread overview]
Message-ID: <20070720142651.GO8857@delft.aura.cs.cmu.edu> (raw)
In-Reply-To: <20070720053807.GD21668@ftp.linux.org.uk>

On Fri, Jul 20, 2007 at 06:38:07AM +0100, Al Viro wrote:
> On Fri, Jul 20, 2007 at 12:10:00AM -0400, Jan Harkes wrote:
> > I will try to find a clean way to block the close syscall until fput
> > drops the last reference. However I realize that such an implementation
> > would not be acceptable for other file systems, and there are some
> > interesting unresolved details such as 'which close is going to be the
> > last close'.
> 
> Simply impossible.

As usual you are correct.

Originally Coda only used the CODA_CLOSE upcall which was called from
fops->release (fput). The problem was that we had various errors that
never managed to make it back to the user. So I split up the operation
into the part that does the write back and is the source of most errors.
(CODA_STORE, called from fops->flush) and the part that drops the last
reference (CODA_RELEASE, called from fops->release).

I've actually only used the _STORE/_RELEASE upcalls in a development
version, so the old code is not only still around, it is the typically
used variant.

I'll submit a patch that removes those upcalls, they will never work the
way I hoped.

> Why does CODA need special warranties in that area, anyway?

I don't think it really needs special warranties. The intent is to write
back data only when the last reference has been released. Ideally we
would like to return errors that occur during this writeback to the
application. Clearly the latter isn't possible.

> Related question: does fsync() force the writeback?

I think it should, but at the moment it does not. My guess on why the
implementation isn't there is that it mesh well with the last-writer
close model. The cache manager actually doesn't trigger any write back
operations until the owrite counter drops to 0 and this happens only
after all open for write descriptors for a file have been released. As a
result it was a bit of a hack to get the _STORE/_RELEASE variant to work
because it couldn't rely on the counter dropping to 0, which is one of
the reasons why I never released a Coda client that actually uses those
new upcalls.

We do have an upcall that is sent when fsync is called and could use
that. For fsync we could ignore that owrite counter. I am not sure if
the in-kernel implementation is correct, I would expect that it should
be an atomic operation wrt. other writers to be able to guarantee that
the resulting file actually contains what we expect but right now it
looks like it does grab the inode mutex when it syncs the file to disk
but releases the lock before it sends an upcall to the cache manager.

Jan


  reply	other threads:[~2007-07-20 14:26 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-19 21:45 [PATCH] coda: kill file_count abuse Christoph Hellwig
2007-07-19 22:16 ` Jan Harkes
2007-07-20  0:45   ` David Chinner
2007-07-20  0:53     ` Al Viro
2007-07-20  2:36       ` David Chinner
2007-07-20  3:16         ` Al Viro
2007-07-20  4:10           ` [PATCH] coda: file count cannot be used to discover last close Jan Harkes
2007-07-20  5:38             ` Al Viro
2007-07-20 14:26               ` Jan Harkes [this message]
2007-07-20  6:03           ` [PATCH] coda: kill file_count abuse David Chinner
2007-07-20  2:40       ` Jan Harkes

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=20070720142651.GO8857@delft.aura.cs.cmu.edu \
    --to=jaharkes@cs.cmu.edu \
    --cc=linux-fsdevel@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).