From: Ingo van Lil <inguin@gmx.de>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] hostfs leaks file descriptors
Date: Tue, 04 Nov 2008 15:53:37 +0100 [thread overview]
Message-ID: <491061F1.7030909@gmx.de> (raw)
[-- Attachment #1: Type: text/plain, Size: 409 bytes --]
Hi there,
when hostfs is used as the UML's root filesystem its file descriptors
aren't closed when the kernel is rebooted. Subsequently, after a couple
of reboots the guest will reach the maximum number of allowed file
descriptors (usually 1024) and fail to open any more files.
I tried to fix the problem myself, see patch. It works for me, but I'm
not sure if it's the correct solution.
Cheers,
Ingo
[-- Attachment #2: hostfs-close-files-on-exit.patch --]
[-- Type: text/plain, Size: 806 bytes --]
Index: hostfs_kern.c
===================================================================
--- hostfs_kern.c (revision 8135)
+++ hostfs_kern.c (working copy)
@@ -16,6 +16,7 @@
#include <linux/list.h>
#include <linux/statfs.h>
#include <linux/kdev_t.h>
+#include <linux/mount.h>
#include <asm/uaccess.h>
#include "hostfs.h"
#include "kern_util.h"
@@ -1037,3 +1038,17 @@
module_init(init_hostfs)
module_exit(exit_hostfs)
MODULE_LICENSE("GPL");
+
+static void hostfs_exitcall(void)
+{
+ struct super_block *root_sb = current->fs->rootmnt->mnt_sb;
+ if (root_sb->s_type == &hostfs_type) {
+ struct inode *inode;
+ list_for_each_entry(inode, &root_sb->s_inodes, i_sb_list) {
+ if(HOSTFS_I(inode)->fd != -1) {
+ close_file(&HOSTFS_I(inode)->fd);
+ }
+ }
+ }
+}
+__uml_exitcall(hostfs_exitcall);
[-- Attachment #3: Type: text/plain, Size: 363 bytes --]
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
[-- Attachment #4: Type: text/plain, Size: 194 bytes --]
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
reply other threads:[~2008-11-04 14:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=491061F1.7030909@gmx.de \
--to=inguin@gmx.de \
--cc=user-mode-linux-devel@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox