]> Zhao Yanbai Git Server - minix.git/commitdiff
VFS: fix aborting queued requests after FS crash 14/3314/1
authorDavid van Moolenbroek <david@minix3.org>
Fri, 17 Jun 2016 18:02:29 +0000 (18:02 +0000)
committerDavid van Moolenbroek <david@minix3.org>
Fri, 17 Jun 2016 18:02:29 +0000 (18:02 +0000)
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

minix/servers/vfs/worker.c

index 5cc35faedf55e1af77ee3f9e73355ca00e5082d2..117a93bad312c50a0b6a2ec96dbe8f4a082a042e 100644 (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);
 }