Re: Linux 2.4.33-rc1

From: Grant Coady
Date: Sun Jun 18 2006 - 19:06:17 EST


On Mon, 19 Jun 2006 00:37:36 +0200, Willy Tarreau <w@xxxxxx> wrote:

>Hi Grant,
>
>On Mon, Jun 19, 2006 at 08:25:06AM +1000, Grant Coady wrote:
>> On Sun, 18 Jun 2006 10:37:18 -0300, Marcelo Tosatti <marcelo@xxxxxxxxx> wrote:
>>
>> >Can you please try the attached patch.
>> >
>> >Grab a reference to the victim inode before calling vfs_unlink() to avoid
>> >it vanishing under us.
>> >
>> >diff --git a/fs/namei.c b/fs/namei.c
>> >index 42cce98..7993283 100644
>> >--- a/fs/namei.c
>> >+++ b/fs/namei.c
>> >@@ -1509,6 +1509,7 @@ asmlinkage long sys_unlink(const char *
>> > char * name;
>> > struct dentry *dentry;
>> > struct nameidata nd;
>> >+ struct inode *inode = NULL;
>> >
>> > name = getname(pathname);
>> > if(IS_ERR(name))
>> >@@ -1527,11 +1528,16 @@ asmlinkage long sys_unlink(const char *
>> > /* Why not before? Because we want correct error value */
>> > if (nd.last.name[nd.last.len])
>> > goto slashes;
>> >+ inode = dentry->d_inode;
>> >+ if (inode)
>> >+ atomic_inc(&inode->i_count);
>> > error = vfs_unlink(nd.dentry->d_inode, dentry);
>> > exit2:
>> > dput(dentry);
>> > }
>
>Could you add this line here, because your oops still looks like the NULL
>is close to this area :
>
>+ printk(KERN_DEBUG "nd.dentry->d_inode = %p\n", nd.dentry->d_inode);

It didn't get there for the segfault case, gets there for local file
delete

After:
grant@sempro:~$ dmesg >dmesg
grant@sempro:~$ rm dmesg

Jun 19 08:49:17 sempro kernel: nd.dentry->d_inode = f73f4b80

After:
grant@sempro:~$ dmesg >/home/share/dmesg-test
grant@sempro:~$ rm /home/share/dmesg-test
Segmentation fault

Nothing reported by debug or syslog, oops in messages.

Cheers,
Grant.
-
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/