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
This commit is contained in:
David van Moolenbroek 2016-06-17 18:02:29 +00:00
parent a7a79fa1f5
commit 7d0647db6a

View File

@ -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);
}