From: Sage Weil <sage@newdream.net>
To: viro@ZenIV.linux.org.uk, linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mszeredi@suse.cz,
Miklos Szeredi <miklos@suse.cz>
Subject: [PATCH 7/7] vfs: fix vfs_rename_dir for FS_RENAME_DOES_D_MOVE filesystems
Date: Wed, 30 Mar 2011 15:09:28 -0700 [thread overview]
Message-ID: <1301522968-4382-8-git-send-email-sage@newdream.net> (raw)
In-Reply-To: <1301522968-4382-1-git-send-email-sage@newdream.net>
From: Miklos Szeredi <miklos@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. Currently all
FS_RENAME_DOES_D_MOVE filesystems compensate for this by failing in
d_revalidate.
The bug was introduced by: commit 349457ccf2592c14bdf13b6706170ae2e94931b1
"[PATCH] Allow file systems to manually d_move() inside of ->rename()"
Fix by not rehashing the new dentry. Rehashing used to be needed by
d_move() but isn't anymore.
Reported-by: Sage Weil <sage@newdream.net>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
---
fs/namei.c | 2 --
1 files changed, 0 insertions(+), 2 deletions(-)
diff --git a/fs/namei.c b/fs/namei.c
index d376688..98119a5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -3252,8 +3252,6 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry,
dont_mount(new_dentry);
}
mutex_unlock(&target->i_mutex);
- if (d_unhashed(new_dentry))
- d_rehash(new_dentry);
}
if (!error)
if (!(old_dir->i_sb->s_type->fs_flags & FS_RENAME_DOES_D_MOVE))
--
1.7.0
prev parent reply other threads:[~2011-03-30 22:02 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-30 22:09 [PATCH 0/7] Do not dentry_unhash() in VFS Sage Weil
2011-03-30 22:09 ` [PATCH 1/7] vfs: dentry_unhash immediately prior to rmdir Sage Weil
2011-03-30 22:09 ` [PATCH 2/7] vfs: remove dget() from dentry_unhash() Sage Weil
2011-03-30 22:09 ` [PATCH 3/7] vfs: push dentry_unhash on rmdir into file systems Sage Weil
2011-03-30 22:09 ` [PATCH 4/7] vfs: push dentry_unhash on rename_dir " Sage Weil
2011-03-31 3:09 ` Dave Chinner
2011-03-31 4:40 ` Sage Weil
2011-03-30 22:09 ` [PATCH 5/7] vfs: update dentry_unhash() comment Sage Weil
2011-03-30 22:09 ` [PATCH 6/7] libfs: drop unneeded dentry_unhash Sage Weil
2011-03-30 22:09 ` Sage Weil [this message]
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=1301522968-4382-8-git-send-email-sage@newdream.net \
--to=sage@newdream.net \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=miklos@suse.cz \
--cc=mszeredi@suse.cz \
--cc=viro@ZenIV.linux.org.uk \
/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
all inboxes | Powered by JetHome®