]> Zhao Yanbai Git Server - minix.git/commitdiff
VFS: set w_drv_sendrec only when needed 43/943/2
authorDavid van Moolenbroek <david@minix3.org>
Sat, 24 Aug 2013 10:29:39 +0000 (12:29 +0200)
committerLionel Sambuc <lionel@minix3.org>
Tue, 18 Feb 2014 10:25:02 +0000 (11:25 +0100)
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

servers/vfs/device.c

index 2e285a6f93df6bd2d704eef0eeb4fea4d54ec3f7..4d0ce596d6b523d71f0731af251fce84050edac5 100644 (file)
@@ -559,8 +559,12 @@ int gen_opcl(
   if (op == DEV_OPEN && dp->dmap_style == STYLE_DEVA) {
        fp->fp_task = dp->dmap_driver;
        self->w_task = dp->dmap_driver;
+       self->w_drv_sendrec = &dev_mess;
+
        worker_wait();
+
        self->w_task = NONE;
+       self->w_drv_sendrec = NULL;
   }
 
   if (is_bdev)
@@ -770,7 +774,6 @@ int asyn_io(endpoint_t drv_e, message *mess_ptr)
   int r;
 
   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);
 
@@ -894,8 +897,12 @@ int clone_opcl(
        /* Wait for reply when driver is asynchronous */
        fp->fp_task = dp->dmap_driver;
        self->w_task = dp->dmap_driver;
+       self->w_drv_sendrec = &dev_mess;
+
        worker_wait();
+
        self->w_task = NONE;
+       self->w_drv_sendrec = NULL;
   }
 
   if (op == DEV_OPEN && dev_mess.REP_STATUS >= 0) {
@@ -1071,7 +1078,6 @@ void open_reply(void)
        return;
   }
   *wp->w_drv_sendrec = job_m_in;
-  wp->w_drv_sendrec = NULL;
   worker_signal(wp);   /* Continue open */
 }