{"Operation not permitted", EPERM},
{"wstat prohibited", EPERM},
{"No such file or directory", ENOENT},
+ {"directory entry not found", ENOENT},
{"file not found", ENOENT},
{"Interrupted system call", EINTR},
{"Input/output error", EIO},
dprintk(DEBUG_MUX, "waiting for response: %d\n", req->tcall->tag);
ret = wait_event_interruptible(v9ses->read_wait,
((v9ses->transport->status != Connected) ||
- (req->rcall != 0) || dprintcond(v9ses, req)));
+ (req->rcall != 0) || (req->err < 0) ||
+ dprintcond(v9ses, req)));
dprintk(DEBUG_MUX, "got it: rcall %p\n", req->rcall);
+
+ spin_lock(&v9ses->muxlock);
+ list_del(&req->next);
+ spin_unlock(&v9ses->muxlock);
+
+ if (req->err < 0)
+ return req->err;
+
if (v9ses->transport->status == Disconnected)
return -ECONNRESET;
- if (ret == 0) {
- spin_lock(&v9ses->muxlock);
- list_del(&req->next);
- spin_unlock(&v9ses->muxlock);
- }
-
return ret;
}
if (!v9ses)
return -EINVAL;
+ if (!v9ses->transport || v9ses->transport->status != Connected)
+ return -EIO;
+
if (rcall)
*rcall = NULL;
tcall->tag = tid;
req.tcall = tcall;
+ req.err = 0;
req.rcall = NULL;
ret = v9fs_send(v9ses, &req);
}
err = read_message(v9ses, rcall, v9ses->maxdata + V9FS_IOHDRSZ);
- if (err < 0) {
- kfree(rcall);
- break;
- }
spin_lock(&v9ses->muxlock);
- list_for_each_entry_safe(rreq, rptr, &v9ses->mux_fcalls, next) {
- if (rreq->tcall->tag == rcall->tag) {
- req = rreq;
- req->rcall = rcall;
- break;
+ if (err < 0) {
+ list_for_each_entry_safe(rreq, rptr, &v9ses->mux_fcalls, next) {
+ rreq->err = err;
+ }
+ if(err != -ERESTARTSYS)
+ eprintk(KERN_ERR,
+ "Transport error while reading message %d\n", err);
+ } else {
+ list_for_each_entry_safe(rreq, rptr, &v9ses->mux_fcalls, next) {
+ if (rreq->tcall->tag == rcall->tag) {
+ req = rreq;
+ req->rcall = rcall;
+ break;
+ }
}
}
spin_unlock(&v9ses->muxlock);
if (!req) {
- dprintk(DEBUG_ERROR,
- "unexpected response: id %d tag %d\n",
- rcall->id, rcall->tag);
+ if (err >= 0)
+ dprintk(DEBUG_ERROR,
+ "unexpected response: id %d tag %d\n",
+ rcall->id, rcall->tag);
kfree(rcall);
}
set_current_state(TASK_INTERRUPTIBLE);
}
+ v9ses->transport->close(v9ses->transport);
+
/* Inform all pending processes about the failure */
wake_up_all(&v9ses->read_wait);