From: Al Viro <viro@ftp.linux.org.uk>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: trond.myklebust@fys.uio.no, dhowells@redhat.com,
linux-fsdevel@vger.kernel.org
Subject: Re: How to handle non-local renames?
Date: Thu, 28 Sep 2006 11:02:23 +0100 [thread overview]
Message-ID: <20060928100223.GY29920@ftp.linux.org.uk> (raw)
In-Reply-To: <E1GQeQV-00034M-00@dorka.pomaz.szeredi.hu>
On Fri, Sep 22, 2006 at 08:22:19AM +0200, Miklos Szeredi wrote:
> > I'm thinking something along the lines of the following patch on top of
> > David's d_materialise_dentry(), which is already in the 2.6.18-mm
> > kernels. Still untested (I'm working on that), but it attempts to do
> > what you were proposing:
> >
> > 1) If instantiating a directory, check for aliases
> > 2) If an alias is found in the dcache, attempt to rename the
> > existing dentry instead of instantiating the alias.
> > 3) Return ELOOP if the alias turns out to be a parent.
>
> What I'm still worried about is that by moving the alias across
> directories without holding the rename mutex, you are violating a
> premise in the cross directory rename locking rules:
>
> (2) if cross-directory rename holds the lock on filesystem, order will not
> change until rename acquires all locks. (Proof: other cross-directory
> renames will be blocked on filesystem lock and we don't start changing
> the order until we had acquired all locks).
>
> Possible solution:
>
> - if lookup is being called for last components in rename then
> s_vfs_rename_mutex is already held, we are OK. But currently we
> don't know if lookup is called from rename.
>
> - otherwise trylock on s_vfs_rename_mutex, if succeeds then OK.
>
> - if fails, then alias can't be moved, make the inode bad (which
> also unhashes it) and get a new inode, which will now be
> unaliased.
>
> Also need to trylock i_mutex on alias->d_parent->i_inode after having
> acquired s_vfs_rename_mutex for similar reasons.
>
> However it's getting rather ugly, and I'd rather have something
> simpler.
Simpler: if alias and our dentry share the parent, it's locked and
we can rename without s_vfs_rename_mutex. If they do not, walk the
tree under alias, unhash all non-directories and kill all directories.
We keep local renames, we keep renames within directory and cross-directory
rename on server ends up with invalidation when client notices it.
We don't _care_ if lookup() is not from rename. That's OK.
next prev parent reply other threads:[~2006-09-28 10:02 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-09-17 20:43 How to handle non-local renames? Miklos Szeredi
2006-09-18 16:38 ` Trond Myklebust
2006-09-18 18:00 ` Miklos Szeredi
2006-09-19 8:24 ` Miklos Szeredi
2006-09-22 0:00 ` Trond Myklebust
2006-09-22 6:22 ` Miklos Szeredi
2006-09-28 10:02 ` Al Viro [this message]
2006-09-28 10:03 ` Al Viro
2006-09-28 10:22 ` Miklos Szeredi
2006-09-28 10:16 ` Miklos Szeredi
2006-09-28 10:27 ` Al Viro
2006-09-28 10:53 ` Miklos Szeredi
2006-09-28 11:21 ` Al Viro
2006-09-28 11:44 ` Miklos Szeredi
2006-09-28 11:54 ` Al Viro
2006-09-28 12:31 ` Trond Myklebust
2006-09-28 12:42 ` Al Viro
2006-09-28 12:57 ` Trond Myklebust
2006-09-28 13:15 ` Al Viro
2006-09-28 13:31 ` Trond Myklebust
2006-09-28 14:20 ` Al Viro
2006-09-28 18:24 ` Trond Myklebust
2006-09-28 20:50 ` Randy Dunlap
2006-09-29 14:55 ` Trond Myklebust
2006-09-29 16:03 ` Randy Dunlap
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=20060928100223.GY29920@ftp.linux.org.uk \
--to=viro@ftp.linux.org.uk \
--cc=dhowells@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=trond.myklebust@fys.uio.no \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.