summaryrefslogtreecommitdiff
path: root/linux-uml/linux-uml-2.6.7/HostFs-2.6-fd_leak.patch
diff options
context:
space:
mode:
Diffstat (limited to 'linux-uml/linux-uml-2.6.7/HostFs-2.6-fd_leak.patch')
-rw-r--r--linux-uml/linux-uml-2.6.7/HostFs-2.6-fd_leak.patch53
1 files changed, 53 insertions, 0 deletions
diff --git a/linux-uml/linux-uml-2.6.7/HostFs-2.6-fd_leak.patch b/linux-uml/linux-uml-2.6.7/HostFs-2.6-fd_leak.patch
index e69de29bb2..8b6d6bf790 100644
--- a/linux-uml/linux-uml-2.6.7/HostFs-2.6-fd_leak.patch
+++ b/linux-uml/linux-uml-2.6.7/HostFs-2.6-fd_leak.patch
@@ -0,0 +1,53 @@
+
+In detail, on 2.4 we used force_delete() to make sure inode were not cached,
+and we then close the host file when the inode is cleared; when porting to 2.6
+the "force_delete" thing was dropped, and this patch adds a fix for this
+(by setting drop_inode = generic_delete_inode).
+Search for drop_inode in the 2.6 Documentation/filesystems/vfs.txt for info about this.
+
+Signed-off-by: Paolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
+---
+
+ uml-linux-2.6.7-paolo/fs/hostfs/hostfs_kern.c | 16 +++++++++++++++-
+ 1 files changed, 15 insertions(+), 1 deletion(-)
+
+diff -puN fs/hostfs/hostfs_kern.c~HostFs-2.6-fd_leak fs/hostfs/hostfs_kern.c
+--- uml-linux-2.6.7/fs/hostfs/hostfs_kern.c~HostFs-2.6-fd_leak 2004-06-29 21:03:01.138464296 +0200
++++ uml-linux-2.6.7-paolo/fs/hostfs/hostfs_kern.c 2004-06-29 21:03:01.141463840 +0200
+@@ -284,13 +284,25 @@ static struct inode *hostfs_alloc_inode(
+ return(&hi->vfs_inode);
+ }
+
++static void hostfs_delete_inode(struct inode *inode)
++{
++ if(HOSTFS_I(inode)->fd != -1) {
++ close_file(&HOSTFS_I(inode)->fd);
++ printk("Closing host fd in .delete_inode\n");
++ HOSTFS_I(inode)->fd = -1;
++ }
++ clear_inode(inode);
++}
++
+ static void hostfs_destroy_inode(struct inode *inode)
+ {
+ if(HOSTFS_I(inode)->host_filename)
+ kfree(HOSTFS_I(inode)->host_filename);
+
+- if(HOSTFS_I(inode)->fd != -1)
++ if(HOSTFS_I(inode)->fd != -1) {
+ close_file(&HOSTFS_I(inode)->fd);
++ printk("Closing host fd in .destroy_inode\n");
++ }
+
+ kfree(HOSTFS_I(inode));
+ }
+@@ -302,6 +314,8 @@ static void hostfs_read_inode(struct ino
+
+ static struct super_operations hostfs_sbops = {
+ .alloc_inode = hostfs_alloc_inode,
++ .drop_inode = generic_delete_inode,
++ .delete_inode = hostfs_delete_inode,
+ .destroy_inode = hostfs_destroy_inode,
+ .read_inode = hostfs_read_inode,
+ .statfs = hostfs_statfs,
+_