[PATCH 8/7] fs: free_write_pipe() fix

From: Peter Zijlstra
Date: Sun Jan 28 2007 - 07:18:06 EST



From: Ingo Molnar <mingo@xxxxxxx>

file_kill() has to look at the file's inode (for the barrier logic),
hence make sure we free the inode before the file.

Signed-off-by: Ingo Molnar <mingo@xxxxxxx>
---
fs/pipe.c | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)

Index: linux/fs/pipe.c
===================================================================
--- linux.orig/fs/pipe.c
+++ linux/fs/pipe.c
@@ -945,12 +945,17 @@ struct file *create_write_pipe(void)
return ERR_PTR(err);
}

-void free_write_pipe(struct file *f)
+void free_write_pipe(struct file *file)
{
- free_pipe_info(f->f_dentry->d_inode);
- dput(f->f_path.dentry);
- mntput(f->f_path.mnt);
- put_filp(f);
+ struct dentry *dentry = file->f_path.dentry;
+ struct vfsmount *mnt = file->f_path.mnt;
+
+ free_pipe_info(file->f_dentry->d_inode);
+ file->f_path.dentry = NULL;
+ file->f_path.mnt = NULL;
+ put_filp(file);
+ dput(dentry);
+ mntput(mnt);
}

struct file *create_read_pipe(struct file *wrf)


-
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/