From: Al Viro <viro@ZenIV.linux.org.uk>
To: Miklos Szeredi <miklos@szeredi.hu>
Cc: sage@newdream.net, zach.brown@oracle.com,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [patch] vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems
Date: Mon, 21 Jul 2008 20:02:16 +0100 [thread overview]
Message-ID: <20080721190215.GH28946@ZenIV.linux.org.uk> (raw)
In-Reply-To: <E1KKtlz-0008B9-BM@pomaz-ex.szeredi.hu>
On Mon, Jul 21, 2008 at 01:41:47PM +0200, Miklos Szeredi wrote:
> From: Miklos Szeredi <mszeredi@suse.cz>
>
> vfs_rename_dir() doesn't properly account for filesystems with
> FS_RENAME_DOES_D_MOVE. If new_dentry has a target inode attached, it
> unhashes the new_dentry prior to the rename() iop and rehashes it
> after, but doesn't account for the possibility that rename() may have
> swapped {old,new}_dentry. For FS_RENAME_DOES_D_MOVE filesystems, it
> rehashes new_dentry (now the old renamed-from name, which d_move()
> expected to go away), such that a subsequent lookup will find it.
>
> This was caught by the recently posted POSIX fstest suite, rename/10.t
> test 62 (and others) on ceph.
>
> Fix by not rehashing the new dentry. Rehashing would only make sense
> if the rename failed (which should happen extremely rarely), but we
> cannot handle that case correctly 100% of the time anyway, so...
Lovely. AFAICS, that's a fallout from
commit 349457ccf2592c14bdf13b6706170ae2e94931b1
Author: Mark Fasheh <mark.fasheh@oracle.com>
Date: Fri Sep 8 14:22:21 2006 -0700
[PATCH] Allow file systems to manually d_move() inside of ->rename()
that had allowed that crap for directories. Note that d_rehash() used
to be needed (d_move() would unhash the source otherwise) and d_move()
used to be unconditional until the changeset above.
It's _probably_ OK now, but I'd really like to think about NFS behaviour.
There are subtle traps in that area.
BTW, failing rename() is trivial - just have a non-empty target...
next prev parent reply other threads:[~2008-07-21 19:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-21 11:41 [patch] vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems Miklos Szeredi
2008-07-21 19:02 ` Al Viro [this message]
-- strict thread matches above, loose matches on Subject: below --
2008-07-11 19:47 [PATCH] " Sage Weil
2008-07-11 20:53 ` Miklos Szeredi
2008-07-11 22:12 ` Zach Brown
2008-07-18 10:59 ` Miklos Szeredi
2008-07-18 19:44 ` Zach Brown
2008-07-11 22:15 ` Sage Weil
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=20080721190215.GH28946@ZenIV.linux.org.uk \
--to=viro@zeniv.linux.org.uk \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=sage@newdream.net \
--cc=zach.brown@oracle.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;
as well as URLs for NNTP newsgroup(s).