]> Zhao Yanbai Git Server - minix.git/commitdiff
VFS: don't garbage collect if file is already closed
authorThomas Veerman <thomas@minix3.org>
Fri, 15 Feb 2013 15:09:24 +0000 (16:09 +0100)
committerThomas Veerman <thomas@minix3.org>
Thu, 21 Feb 2013 10:29:08 +0000 (10:29 +0000)
servers/vfs/filedes.c

index b0a19911e228080aca22fe694102a594e0557064..b3914757b561698c024ff850fd0a1d3b108915c2 100644 (file)
@@ -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;