From: Thomas Veerman Date: Fri, 15 Feb 2013 15:09:24 +0000 (+0100) Subject: VFS: don't garbage collect if file is already closed X-Git-Tag: v3.3.0~1136 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=2b90964e33703be3876c2301fda50150c4f8b9e2;p=minix.git VFS: don't garbage collect if file is already closed --- diff --git a/servers/vfs/filedes.c b/servers/vfs/filedes.c index b0a19911e..b3914757b 100644 --- a/servers/vfs/filedes.c +++ b/servers/vfs/filedes.c @@ -86,6 +86,15 @@ void *do_filp_gc(void *UNUSED(arg)) for (f = &filp[0]; f < &filp[NR_FILPS]; f++) { if (!(f->filp_state & FS_INVALIDATED)) continue; + + if (f->filp_mode == FILP_CLOSED || f->filp_vno == NULL) { + /* File was already closed before gc could kick in */ + assert(f->filp_count <= 0); + f->filp_state &= ~FS_INVALIDATED; + f->filp_count = 0; + continue; + } + assert(f->filp_vno != NULL); vp = f->filp_vno;