Commit 76cc071a06afb4d2dd17bb1b855a233a419e7e02
Committed by
Al Viro
1 parent
7ce605d93b
Exists in
master
and in
39 other branches
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>
Showing 1 changed file with 9 additions and 1 deletions Side-by-side Diff
fs/ncpfs/dir.c
... | ... | @@ -1144,8 +1144,16 @@ |
1144 | 1144 | old_dentry->d_parent->d_name.name, old_dentry->d_name.name, |
1145 | 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 | 1152 | dentry_unhash(new_dentry); |
1153 | + error = -EBUSY; | |
1154 | + if (!d_unhashed(new_dentry)) | |
1155 | + goto out; | |
1156 | + } | |
1149 | 1157 | |
1150 | 1158 | ncp_age_dentry(server, old_dentry); |
1151 | 1159 | ncp_age_dentry(server, new_dentry); |