VFS: set w_drv_sendrec only when needed

As with w_task, this ensures that the field remains cleared if it is
not used. Without this, worker_stop could mistakenly identify a thread
as talking to a device driver rather than a (crashed) file server.

Change-Id: I7d3ebed3efc3cd4f5c891f61c67a6463109b6376
This commit is contained in:
David van Moolenbroek 2013-08-24 12:29:39 +02:00 committed by Lionel Sambuc
parent 7d02ecdbb4
commit a75c47e5ac

View file

@ -559,8 +559,12 @@ int gen_opcl(
if (op == DEV_OPEN && dp->dmap_style == STYLE_DEVA) { if (op == DEV_OPEN && dp->dmap_style == STYLE_DEVA) {
fp->fp_task = dp->dmap_driver; fp->fp_task = dp->dmap_driver;
self->w_task = dp->dmap_driver; self->w_task = dp->dmap_driver;
self->w_drv_sendrec = &dev_mess;
worker_wait(); worker_wait();
self->w_task = NONE; self->w_task = NONE;
self->w_drv_sendrec = NULL;
} }
if (is_bdev) if (is_bdev)
@ -770,7 +774,6 @@ int asyn_io(endpoint_t drv_e, message *mess_ptr)
int r; int r;
assert(!IS_BDEV_RQ(mess_ptr->m_type)); assert(!IS_BDEV_RQ(mess_ptr->m_type));
self->w_drv_sendrec = mess_ptr; /* Remember where result should be stored */
r = asynsend3(drv_e, mess_ptr, AMF_NOREPLY); r = asynsend3(drv_e, mess_ptr, AMF_NOREPLY);
@ -894,8 +897,12 @@ int clone_opcl(
/* Wait for reply when driver is asynchronous */ /* Wait for reply when driver is asynchronous */
fp->fp_task = dp->dmap_driver; fp->fp_task = dp->dmap_driver;
self->w_task = dp->dmap_driver; self->w_task = dp->dmap_driver;
self->w_drv_sendrec = &dev_mess;
worker_wait(); worker_wait();
self->w_task = NONE; self->w_task = NONE;
self->w_drv_sendrec = NULL;
} }
if (op == DEV_OPEN && dev_mess.REP_STATUS >= 0) { if (op == DEV_OPEN && dev_mess.REP_STATUS >= 0) {
@ -1071,7 +1078,6 @@ void open_reply(void)
return; return;
} }
*wp->w_drv_sendrec = job_m_in; *wp->w_drv_sendrec = job_m_in;
wp->w_drv_sendrec = NULL;
worker_signal(wp); /* Continue open */ worker_signal(wp); /* Continue open */
} }