From: Thomas Veerman Date: Fri, 15 Jul 2011 14:11:34 +0000 (+0000) Subject: Don't panic if owner has vanished before reply X-Git-Tag: v3.2.0~457 X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/mem/static/tz-link.htm?a=commitdiff_plain;h=902e0e27e0802c722957153ba3dda0b79b9ec94f;p=minix.git Don't panic if owner has vanished before reply --- diff --git a/servers/vfs/select.c b/servers/vfs/select.c index 705030785..6d84ff35e 100644 --- a/servers/vfs/select.c +++ b/servers/vfs/select.c @@ -777,18 +777,18 @@ int status; return; } - /* The filp must be busy waiting for a reply. */ - assert(f->filp_select_flags & FSF_BUSY); - assert(f->filp_count >= 1); /* There should be at least one owner */ - - /* Find vnode and check we got a reply from the device we expected */ - vp = f->filp_vno; - assert(vp != NULL); - assert((vp->v_mode & I_TYPE) == I_CHAR_SPECIAL); /* Must be char. special */ - if (vp->v_sdev != dev) { - printf("VFS (%s:%d): expected reply from dev %d not %d\n", - vp->v_sdev, dev); - return; + /* Is the filp still in use and busy waiting for a reply? The owner might + * have vanished before the driver was able to reply. */ + if (f->filp_count >= 1 && (f->filp_select_flags & FSF_BUSY)) { + /* Find vnode and check we got a reply from the device we expected */ + vp = f->filp_vno; + assert(vp != NULL); + assert((vp->v_mode & I_TYPE) == I_CHAR_SPECIAL); /* Must be char. special */ + if (vp->v_sdev != dev) { + printf("VFS (%s:%d): expected reply from dev %d not %d\n", + vp->v_sdev, dev); + return; + } } /* No longer waiting for a reply from this device */