aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ncpfs/dir.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2011-05-27 16:42:10 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-05-28 01:02:53 -0400
commit76cc071a06afb4d2dd17bb1b855a233a419e7e02 (patch)
tree24210edc60b09e2efe562499b7b844826d051bab /fs/ncpfs/dir.c
parent7ce605d93b775e8a960b0be244f7be565e73b3c1 (diff)
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@vandrovec.name> CC: linux-kernel@vger.kernel.org Signed-off-by: Sage Weil <sage@newdream.net> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ncpfs/dir.c')
-rw-r--r--fs/ncpfs/dir.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 81c287d105d5..9c51f621e901 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,
1144 old_dentry->d_parent->d_name.name, old_dentry->d_name.name, 1144 old_dentry->d_parent->d_name.name, old_dentry->d_name.name,
1145 new_dentry->d_parent->d_name.name, new_dentry->d_name.name); 1145 new_dentry->d_parent->d_name.name, new_dentry->d_name.name);
1146 1146
1147 if (new_dentry->d_inode && S_ISDIR(new_dentry->d_inode->i_mode)) 1147 if (new_dentry->d_inode && S_ISDIR(new_dentry->d_inode->i_mode)) {
1148 /*
1149 * fail with EBUSY if there are still references to this
1150 * directory.
1151 */
1148 dentry_unhash(new_dentry); 1152 dentry_unhash(new_dentry);
1153 error = -EBUSY;
1154 if (!d_unhashed(new_dentry))
1155 goto out;
1156 }
1149 1157
1150 ncp_age_dentry(server, old_dentry); 1158 ncp_age_dentry(server, old_dentry);
1151 ncp_age_dentry(server, new_dentry); 1159 ncp_age_dentry(server, new_dentry);