From: David van Moolenbroek Date: Fri, 17 Jun 2016 18:02:29 +0000 (+0000) Subject: VFS: fix aborting queued requests after FS crash X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zpipe.c?a=commitdiff_plain;h=7d0647db6a1e46e7289a13effb6163d41a717cf5;p=minix.git VFS: fix aborting queued requests after FS crash The new asserts from git-29e004d exposed an issue in how VFS handles aborting file system (FS) requests that are queued for a FS (as opposed to sent to it) when that FS crashes. In that scenario, the queued worker has its w_task set to NONE, because there is no ongoing communication. However, worker_stop() is called on it regardless, which used to abort the request only if w_task was not set to NONE, leading to an improperly aborted request, a warning, and a VFS crash a bit later. This patch changes worker_stop() so that w_task need not be set to a valid endpoint for FS requests to be properly aborted. Change-Id: Ib73db285e689ae4742b15cba26137bf340bc303b --- diff --git a/minix/servers/vfs/worker.c b/minix/servers/vfs/worker.c index 5cc35faed..117a93bad 100644 --- a/minix/servers/vfs/worker.c +++ b/minix/servers/vfs/worker.c @@ -535,22 +535,17 @@ void worker_signal(struct worker_thread *worker) void worker_stop(struct worker_thread *worker) { ASSERTW(worker); /* Make sure we have a valid thread */ - if (worker->w_task != NONE) { - /* This thread is communicating with a driver or file server */ - if (worker->w_drv_sendrec != NULL) { /* Driver */ - worker->w_drv_sendrec->m_type = EIO; - worker->w_drv_sendrec = NULL; - } else if (worker->w_sendrec != NULL) { /* FS */ - worker->w_sendrec->m_type = EIO; - worker->w_sendrec = NULL; - } else { - panic("reply storage consistency error"); /* Oh dear */ - } - } else { - /* This shouldn't happen at all... */ - printf("VFS: stopping worker not blocked on any task?\n"); - util_stacktrace(); - } + /* This thread is communicating with a driver or file server */ + if (worker->w_drv_sendrec != NULL) { /* Driver */ + assert(worker->w_task != NONE); + worker->w_drv_sendrec->m_type = EIO; + worker->w_drv_sendrec = NULL; + } else if (worker->w_sendrec != NULL) { /* FS */ + /* worker->w_task may be NONE if the FS message was still queued */ + worker->w_sendrec->m_type = EIO; + worker->w_sendrec = NULL; + } else + panic("reply storage consistency error"); /* Oh dear */ worker_wake(worker); }