[Confirmed, cause found] Re: BUG in rmdir changes

Alexander Viro (viro@math.psu.edu)
Thu, 10 Dec 1998 13:52:23 -0500 (EST)


On Wed, 9 Dec 1998, Matthias Hanisch wrote:

> I've seen the same behavior and did some more investigations yesterday.
> The problem are the rmdir changes in the VFS introduced with 2.1.131.
>
> The busy devices are caused by the removal of an non-existant directory.
>
> Look at the following session:
>
> pingu:~# umount /tmp
> pingu:~# mount /tmp
> pingu:~# rmdir /tmp/aaaaaaaaaaaaaaaa
> rmdir: /tmp/aaaaaaaaaaaaaaaa: No such file or directory
> pingu:~# umount /tmp
> umount: /tmp: device is busy
>
> I've put some printk's in the umount code and it seems that the root
> dentry has d_count = 2 at umount -> BUSY.

WHAT? All changes in rmdir are far off from the path demonstarted here.
do_rmdir() has been changed, but all changes are below the test for
negative dentry. It shouldn't even get to the code in quest... Wait.
static inline int do_rmdir(const char * name)
{
int error;
struct dentry *dir;
struct dentry *dentry;

dentry = lookup_dentry(name, NULL, 0);
error = PTR_ERR(dentry);
if (IS_ERR(dentry))
goto exit;

dir = dget(dentry->d_parent);

error = -ENOENT;
if (!dentry->d_inode)
goto exit;

Arrgh!!! OK, I've got it. Sheesh... dget() should happen immediately
after the check for negative dentry.

Looks like we've caught it - fix being to move the line with dget()
immediately below the check. I'll roll the patch as soon as I'll get to
the Linux box where I have an official tree.
Al

-- 
There are no "civil aviation for dummies" books out there and most of
you would probably be scared and spend a lot of your time looking up
if there was one. :-)			  Jordan Hubbard in c.u.b.f.m

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/