net/9p: This patch implements TLERROR/RLERROR on the 9P client.
authorArun R Bharadwaj <arun@linux.vnet.ibm.com>
Wed, 28 Jul 2010 08:47:26 +0000 (14:17 +0530)
committerEric Van Hensbergen <ericvh@gmail.com>
Thu, 28 Oct 2010 14:08:45 +0000 (09:08 -0500)
Signed-off-by: Arun R Bharadwaj <arun@linux.vnet.ibm.com>
Signed-off-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
include/net/9p/9p.h
net/9p/client.c

index a8de812..a4a1b04 100644 (file)
@@ -86,6 +86,8 @@ do { \
 
 /**
  * enum p9_msg_t - 9P message types
+ * @P9_TLERROR: not used
+ * @P9_RLERROR: response for any failed request for 9P2000.L
  * @P9_TSTATFS: file system status request
  * @P9_RSTATFS: file system status response
  * @P9_TSYMLINK: make symlink request
@@ -137,6 +139,8 @@ do { \
  */
 
 enum p9_msg_t {
+       P9_TLERROR = 6,
+       P9_RLERROR,
        P9_TSTATFS = 8,
        P9_RSTATFS,
        P9_TLOPEN = 12,
index 83bf054..c155cc4 100644 (file)
@@ -450,32 +450,43 @@ static int p9_check_errors(struct p9_client *c, struct p9_req_t *req)
                return err;
        }
 
-       if (type == P9_RERROR) {
+       if (type == P9_RERROR || type == P9_RLERROR) {
                int ecode;
-               char *ename;
 
-               err = p9pdu_readf(req->rc, c->proto_version, "s?d",
-                                                       &ename, &ecode);
-               if (err) {
-                       P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse error%d\n",
-                                                                       err);
-                       return err;
-               }
+               if (!p9_is_proto_dotl(c)) {
+                       char *ename;
 
-               if (p9_is_proto_dotu(c) ||
-                       p9_is_proto_dotl(c))
-                       err = -ecode;
+                       err = p9pdu_readf(req->rc, c->proto_version, "s?d",
+                                                               &ename, &ecode);
+                       if (err)
+                               goto out_err;
 
-               if (!err || !IS_ERR_VALUE(err))
-                       err = p9_errstr2errno(ename, strlen(ename));
+                       if (p9_is_proto_dotu(c))
+                               err = -ecode;
 
-               P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename);
+                       if (!err || !IS_ERR_VALUE(err)) {
+                               err = p9_errstr2errno(ename, strlen(ename));
+
+                               P9_DPRINTK(P9_DEBUG_9P, "<<< RERROR (%d) %s\n", -ecode, ename);
+
+                               kfree(ename);
+                       }
+               } else {
+                       err = p9pdu_readf(req->rc, c->proto_version, "d", &ecode);
+                       err = -ecode;
+
+                       P9_DPRINTK(P9_DEBUG_9P, "<<< RLERROR (%d)\n", -ecode);
+               }
 
-               kfree(ename);
        } else
                err = 0;
 
        return err;
+
+out_err:
+       P9_DPRINTK(P9_DEBUG_ERROR, "couldn't parse error%d\n", err);
+
+       return err;
 }
 
 /**