Re: oopses in kobjects in 2.6.0-test11 (was Re: kobject patch)

From: Andrey Borzenkov
Date: Sun Dec 28 2003 - 07:45:04 EST


On Tuesday 09 December 2003 01:48, Greg KH wrote:
> Ok, I'm ccing lkml and everyone else who has been in on this thread at
> different times. This is based on a patch from Andrey that was/is in
> the -mm tree for a while.
>

what about second part in sysfs/dir.c? How relevant is it?

-andrey

>
> > > - after this oops has been fixed I got next one now in sysfs. The
> > > problem is sysfs_remove_dir would unlink all children including
> > > directories for subordinate kobjects. Resulting in dget/dput
> > > mismatch. I usually got oops due to the fact that d_delete in
> > > remove_dir would free inode and then simple_rmdir would try to access
> > > it.
> > >
> > > The patch avoids calling extra d_delete/unlink on already-deleted
> > > dentry. I hate this patch but anything better apparently requires
> > > complete redesign of sysfs implementation. Unlinking busy directory
> > > is otherwise impossible and I am afraid it will show itself somewhere
> > > else.
> > >
> > >
> > >
> > > 25-akpm/fs/sysfs/dir.c | 12 ++++++++++--
> > > 25-akpm/lib/kobject.c | 4 ++--
> > > 2 files changed, 12 insertions(+), 4 deletions(-)
> > >
> > > diff -puN fs/sysfs/dir.c~kobject-oops-fixes fs/sysfs/dir.c
> > > --- 25/fs/sysfs/dir.c~kobject-oops-fixes Thu Oct 9 01:46:51 2003
> > > +++ 25-akpm/fs/sysfs/dir.c Thu Oct 9 01:46:51 2003
> > > @@ -82,8 +82,16 @@ static void remove_dir(struct dentry * d
> > > {
> > > struct dentry * parent = dget(d->d_parent);
> > > down(&parent->d_inode->i_sem);
> > > - d_delete(d);
> > > - simple_rmdir(parent->d_inode,d);
> > > + /*
> > > + * It is possible that parent has already been removed, in which
> > > + * case directory is already unhashed and dput.
> > > + * Note that this won't update parent->d_inode->i_nlink; OTOH
> > > + * parent should already be dead
> > > + */
> > > + if (!d_unhashed(d)) {
> > > + d_delete(d);
> > > + simple_rmdir(parent->d_inode,d);
> > > + }
> > >
> > > pr_debug(" o %s removing done (%d)\n",d->d_name.name,
> > > atomic_read(&d->d_count));

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