ncpfs [Regression] rmdir and rm -rf fail with device busy
Rmdir and or rm -rf are failing on an ncpfs mounted directory.
for example
root@precise:/mnt/ncp# mkdir a ; rmdir a rmdir: failed to remove `a': Device or resource busy
I bisected the change that introduced the regression to . commit 1d2ef5901483004d74947bbf78d5146c24038fe7 which follows. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
fs/namei.c +0 -0
@@ -2616,6 +2616,7 @@ int vfs_rmdir(struct inode *dir, struct dentry
*dentry)
if (!dir->i_op->rmdir)
return -EPERM;+ dget(dentry);
mutex_lock(&dentry->d_inode->i_mutex);
error = -EBUSY;@@ -2636,6 +2637,7 @@ int vfs_rmdir(struct inode *dir, struct dentry *dentry)
out:
mutex_unlock(&dentry->d_inode->i_mutex);
+ dput(dentry);
if (!error)
d_delete(dentry);
return error;
@@ -3025,6 +3027,7 @@ static int vfs_rename_dir(struct inode *old_dir,
struct dentry
if (error)
return error;+ dget(new_dentry);
if (target)
mutex_lock(&target->i_mutex);@@ -3045,6 +3048,7 @@ static int vfs_rename_dir(struct inode *old_dir, struct dentry
out:
if (target)
mutex_unlock(&target->i_mutex);
+ dput(new_dentry);
if (!error)
if (!(old_dir->i_sb->s_type->fs_flags &
FS_RENAME_DOES_D_MOVE))
d_move(old_dentry,new_dentry);Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Unfortunately this looks like a good patch.
So I narrowed down the the error path to the following two lines <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
fs/ncpfs/dir.c +0 -0
@@ -1035,8 +1035,6 @@ static int ncp_rmdir(struct inode *dir, struct
dentry *dentry)
*/
dentry_unhash(dentry);
error = -EBUSY;- if (!d_unhashed(dentry))
- goto out;
len = sizeof(__name);
error = ncp_io2vol(server, __name, &len, dentry->d_name.name,Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
However these are necessary as without them, the directory can be removed when it is actually in use.
So does anyone have any suggestions on how to fix this?
Thanks,
Dave.