[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1306528939-30636-18-git-send-email-sage@newdream.net>
Date: Fri, 27 May 2011 13:42:10 -0700
From: Sage Weil <sage@...dream.net>
To: hch@...radead.org, viro@...IV.linux.org.uk
Cc: linux-fsdevel@...r.kernel.org, Sage Weil <sage@...dream.net>,
Petr Vandrovec <petr@...drovec.name>,
linux-kernel@...r.kernel.org
Subject: [PATCH 17/26] ncpfs: fix rename over directory with dangling references
ncpfs does not handle references to unlinked directories (or so it would
seem given the ncp_rmdir check). Since it is also possible to rename over
an empty directory, perform the same check here.
CC: Petr Vandrovec <petr@...drovec.name>
CC: linux-kernel@...r.kernel.org
Signed-off-by: Sage Weil <sage@...dream.net>
---
fs/ncpfs/dir.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 81c287d..9c51f62 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -1144,8 +1144,16 @@ static int ncp_rename(struct inode *old_dir, struct dentry *old_dentry,
old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
new_dentry->d_parent->d_name.name, new_dentry->d_name.name);
- if (new_dentry->d_inode && S_ISDIR(new_dentry->d_inode->i_mode))
+ if (new_dentry->d_inode && S_ISDIR(new_dentry->d_inode->i_mode)) {
+ /*
+ * fail with EBUSY if there are still references to this
+ * directory.
+ */
dentry_unhash(new_dentry);
+ error = -EBUSY;
+ if (!d_unhashed(new_dentry))
+ goto out;
+ }
ncp_age_dentry(server, old_dentry);
ncp_age_dentry(server, new_dentry);
--
1.7.0
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists