Commit 73e6b229 authored by Paolo \'Blaisorblade\' Giarrusso's avatar Paolo \'Blaisorblade\' Giarrusso Committed by Linus Torvalds

[PATCH] uml: fix fd leak with HostFs

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: default avatarPaolo 'Blaisorblade' Giarrusso <blaisorblade_spam@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 73584381
...@@ -290,7 +290,6 @@ static void hostfs_delete_inode(struct inode *inode) ...@@ -290,7 +290,6 @@ static void hostfs_delete_inode(struct inode *inode)
{ {
if(HOSTFS_I(inode)->fd != -1) { if(HOSTFS_I(inode)->fd != -1) {
close_file(&HOSTFS_I(inode)->fd); close_file(&HOSTFS_I(inode)->fd);
printk("Closing host fd in .delete_inode\n");
HOSTFS_I(inode)->fd = -1; HOSTFS_I(inode)->fd = -1;
} }
clear_inode(inode); clear_inode(inode);
...@@ -301,9 +300,11 @@ static void hostfs_destroy_inode(struct inode *inode) ...@@ -301,9 +300,11 @@ static void hostfs_destroy_inode(struct inode *inode)
if(HOSTFS_I(inode)->host_filename) if(HOSTFS_I(inode)->host_filename)
kfree(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) { if(HOSTFS_I(inode)->fd != -1) {
close_file(&HOSTFS_I(inode)->fd); 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)); kfree(HOSTFS_I(inode));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment