From: <blaisorblade_spam@yahoo.it>

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>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 25-akpm/fs/hostfs/hostfs_kern.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletion(-)

diff -puN fs/hostfs/hostfs_kern.c~uml-fixes-an-host-fd-leak-caused-by-hostfs fs/hostfs/hostfs_kern.c
--- 25/fs/hostfs/hostfs_kern.c~uml-fixes-an-host-fd-leak-caused-by-hostfs	2004-07-05 16:00:37.095381096 -0700
+++ 25-akpm/fs/hostfs/hostfs_kern.c	2004-07-05 16:00:37.099380488 -0700
@@ -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,
_