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 <[email protected]>
---
linux-2.6.9-current-paolo/fs/hostfs/hostfs_kern.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff -puN fs/hostfs/hostfs_kern.c~uml-HostFs-2.6-fd_leak fs/hostfs/hostfs_kern.c
--- linux-2.6.9-current/fs/hostfs/hostfs_kern.c~uml-HostFs-2.6-fd_leak 2004-10-07 17:38:01.075378432 +0200
+++ linux-2.6.9-current-paolo/fs/hostfs/hostfs_kern.c 2004-10-07 20:21:52.868718656 +0200
@@ -290,7 +290,6 @@ static void hostfs_delete_inode(struct i
{
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);
@@ -301,9 +300,11 @@ static void hostfs_destroy_inode(struct
if(HOSTFS_I(inode)->host_filename)
kfree(HOSTFS_I(inode)->host_filename);
+ /*XXX: This should not happen, probably. The check is here for
+ * additional safety.*/
if(HOSTFS_I(inode)->fd != -1) {
close_file(&HOSTFS_I(inode)->fd);
- printk("Closing host fd in .destroy_inode\n");
+ printk(KERN_DEBUG "Closing host fd in .destroy_inode\n");
}
kfree(HOSTFS_I(inode));
_