From: Dave Chiluk <chiluk@canonical.com>
To: Petr Vandrovec <petr@vandrovec.name>, linux-kernel@vger.kernel.org
Subject: ncpfs [Regression] rmdir and rm -rf fail with device busy
Date: Tue, 14 May 2013 10:23:04 -0500 [thread overview]
Message-ID: <519256D8.9000807@canonical.com> (raw)
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.
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
diff --git a/fs/namei.c b/fs/namei.c
index b52bc68..f478836 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -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);
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Unfortunately this looks like a good patch.
So I narrowed down the the error path to the following two lines
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
diff --git a/fs/ncpfs/dir.c b/fs/ncpfs/dir.c
index 8163260..5701aed 100644
--- a/fs/ncpfs/dir.c
+++ b/fs/ncpfs/dir.c
@@ -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,
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
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.
reply other threads:[~2013-05-14 15:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=519256D8.9000807@canonical.com \
--to=chiluk@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=petr@vandrovec.name \
/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