Re: Linux 2.4.33-rc1

Grant Coady
2006-06-18T22:33:22Z

On Sun, 18 Jun 2006 10:37:18 -0300, Marcelo Tosatti <marcelo@kvack.org> 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);
> }
> up(&nd.dentry->d_inode->i_sem);
>+ if (inode)
>+ iput(inode);
> exit1:
> path_release(&nd);
> exit:

An odd thing happening is that after editing /etc/lilo.conf I get the
vim backup file: "/etc/lilo.co~" instead of "/etc/lilo.conf~" -- this
was happening before the above patch, with -rc1. Very weird. I'm
editing lilo.conf to have the box reboot to 2.6.16.20, since it is
semi-headless (has KVM, but I usually it run via ssh terminal).

Grant.