a3470f
From 2dd394a27166f4e08ad9521ad47b6c0d3fa83432 Mon Sep 17 00:00:00 2001
a3470f
From: Amar Tumballi <amarts@redhat.com>
a3470f
Date: Fri, 17 Nov 2017 10:35:26 +0530
a3470f
Subject: [PATCH 224/236] protocol/server: Backport patch to reduce duplicate
a3470f
 code in server-rpc-fops.c
a3470f
a3470f
> Signed-off-by: Amar Tumballi <amarts@redhat.com>
a3470f
> (cherry picked from commit a81c0c2b9abdcb8ad73d0a226b53120d84082a09)
a3470f
> (upstream patch review link https://review.gluster.org/#/c/19638/)
a3470f
> BUG: 1549505
a3470f
a3470f
BUG: 1535281
a3470f
Change-Id: I33475c44665665cf08ecda798d6fd07455396584
a3470f
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
a3470f
Reviewed-on: https://code.engineering.redhat.com/gerrit/136210
a3470f
Tested-by: RHGS Build Bot <nigelb@redhat.com>
a3470f
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
a3470f
---
a3470f
 xlators/protocol/server/src/server-rpc-fops.c | 1199 +++++--------------------
a3470f
 1 file changed, 208 insertions(+), 991 deletions(-)
a3470f
a3470f
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
a3470f
index c947f06..21f78a3 100644
a3470f
--- a/xlators/protocol/server/src/server-rpc-fops.c
a3470f
+++ b/xlators/protocol/server/src/server-rpc-fops.c
a3470f
@@ -32,6 +32,7 @@
a3470f
                 ret = RPCSVC_ACTOR_ERROR;                       \
a3470f
         } while (0)
a3470f
 
a3470f
+
a3470f
 void
a3470f
 forget_inode_if_no_dentry (inode_t *inode)
a3470f
 {
a3470f
@@ -3450,7 +3451,48 @@ err:
a3470f
 
a3470f
         return ret;
a3470f
 }
a3470f
+
a3470f
+
a3470f
 /* Fop section */
a3470f
+static inline int
a3470f
+rpc_receive_common (rpcsvc_request_t *req, call_frame_t **fr,
a3470f
+                    server_state_t **st, ssize_t *xdrlen, void *args,
a3470f
+                    void *xdrfn, glusterfs_fop_t fop)
a3470f
+{
a3470f
+        int ret = -1;
a3470f
+        ssize_t len = 0;
a3470f
+
a3470f
+        len = xdr_to_generic (req->msg[0], args, (xdrproc_t)xdrfn);
a3470f
+        if (len < 0) {
a3470f
+                /* failed to decode msg; */
a3470f
+                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+                goto out;
a3470f
+        }
a3470f
+
a3470f
+        /* Few fops use the xdr size to get the vector sizes */
a3470f
+        if (xdrlen)
a3470f
+                *xdrlen = len;
a3470f
+
a3470f
+        *fr = get_frame_from_request (req);
a3470f
+        if (!(*fr)) {
a3470f
+                /* something wrong, mostly no memory */
a3470f
+                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+                goto out;
a3470f
+        }
a3470f
+        (*fr)->root->op = fop;
a3470f
+
a3470f
+        *st = CALL_STATE ((*fr));
a3470f
+        if (!(*fr)->root->client->bound_xl) {
a3470f
+                /* auth failure, mostly setvolume is not successful */
a3470f
+                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+                goto out;
a3470f
+        }
a3470f
+        ret = 0;
a3470f
+
a3470f
+out:
a3470f
+        return ret;
a3470f
+}
a3470f
+
a3470f
 
a3470f
 int
a3470f
 server3_3_stat (rpcsvc_request_t *req)
a3470f
@@ -3465,25 +3507,9 @@ server3_3_stat (rpcsvc_request_t *req)
a3470f
                 return 0;
a3470f
 
a3470f
         /* Initialize args first, then decode */
a3470f
-
a3470f
-        ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_stat_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_STAT;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_stat_req, GF_FOP_STAT);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -3522,26 +3548,9 @@ server3_3_setattr (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return 0;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_setattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_SETATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_setattr_req, GF_FOP_SETATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -3582,25 +3591,9 @@ server3_3_fsetattr (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fsetattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FSETATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fsetattr_req, GF_FOP_FSETATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -3640,26 +3633,9 @@ server3_3_fallocate(rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fallocate_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FALLOCATE;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fallocate_req, GF_FOP_FALLOCATE);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -3702,26 +3678,9 @@ server3_3_discard(rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_discard_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_DISCARD;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_discard_req, GF_FOP_DISCARD);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -3763,26 +3722,9 @@ server3_3_zerofill(rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_zerofill_req);
a3470f
-        if (ret < 0) {
a3470f
-                /*failed to decode msg*/;
a3470f
-                req->rpc_err = GARBAGE_ARGS;
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                /* something wrong, mostly insufficient memory*/
a3470f
-                req->rpc_err = GARBAGE_ARGS; /* TODO */
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_ZEROFILL;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                req->rpc_err = GARBAGE_ARGS;
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_zerofill_req, GF_FOP_ZEROFILL);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -3813,50 +3755,31 @@ out:
a3470f
 int
a3470f
 server3_3_ipc (rpcsvc_request_t *req)
a3470f
 {
a3470f
+        server_state_t  *state          = NULL;
a3470f
         call_frame_t    *frame          = NULL;
a3470f
         gfs3_ipc_req     args           = {0,};
a3470f
         int              ret            = -1;
a3470f
         int              op_errno       = 0;
a3470f
-        dict_t          *xdata          = NULL;
a3470f
         xlator_t        *bound_xl       = NULL;
a3470f
 
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_ipc_req);
a3470f
-        if (ret < 0) {
a3470f
-                /*failed to decode msg*/;
a3470f
-                req->rpc_err = GARBAGE_ARGS;
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                /* something wrong, mostly insufficient memory*/
a3470f
-                req->rpc_err = GARBAGE_ARGS; /* TODO */
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_ipc_req, GF_FOP_IPC);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
-        frame->root->op = GF_FOP_IPC;
a3470f
 
a3470f
         bound_xl = frame->root->client->bound_xl;
a3470f
-        if (!bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                req->rpc_err = GARBAGE_ARGS;
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        GF_PROTOCOL_DICT_UNSERIALIZE (bound_xl, xdata,
a3470f
+        GF_PROTOCOL_DICT_UNSERIALIZE (bound_xl, state->xdata,
a3470f
                                       args.xdata.xdata_val,
a3470f
                                       args.xdata.xdata_len,
a3470f
                                       ret, op_errno, out);
a3470f
 
a3470f
         ret = 0;
a3470f
         STACK_WIND (frame, server_ipc_cbk, bound_xl, bound_xl->fops->ipc,
a3470f
-                    args.op, xdata);
a3470f
-        if (xdata) {
a3470f
-                dict_unref(xdata);
a3470f
-        }
a3470f
+                    args.op, state->xdata);
a3470f
 
a3470f
 out:
a3470f
         free (args.xdata.xdata_val);
a3470f
@@ -3872,7 +3795,7 @@ server3_3_seek (rpcsvc_request_t *req)
a3470f
 {
a3470f
         server_state_t        *state          = NULL;
a3470f
         call_frame_t          *frame          = NULL;
a3470f
-        struct gfs3_seek_req   args           = {{0,},};
a3470f
+        gfs3_seek_req          args           = {{0,},};
a3470f
         int                    ret            = -1;
a3470f
         int                    op_errno       = 0;
a3470f
         dict_t                *xdata          = NULL;
a3470f
@@ -3881,26 +3804,9 @@ server3_3_seek (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_seek_req);
a3470f
-        if (ret < 0) {
a3470f
-                /*failed to decode msg*/;
a3470f
-                req->rpc_err = GARBAGE_ARGS;
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                /* something wrong, mostly insufficient memory*/
a3470f
-                req->rpc_err = GARBAGE_ARGS; /* TODO */
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_SEEK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_seek_req, GF_FOP_SEEK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -3911,6 +3817,7 @@ server3_3_seek (rpcsvc_request_t *req)
a3470f
         state->what = args.what;
a3470f
         memcpy(state->resolve.gfid, args.gfid, 16);
a3470f
 
a3470f
+        bound_xl = frame->root->client->bound_xl;
a3470f
         GF_PROTOCOL_DICT_UNSERIALIZE (bound_xl, xdata,
a3470f
                                       args.xdata.xdata_val,
a3470f
                                       args.xdata.xdata_len,
a3470f
@@ -3940,26 +3847,9 @@ server3_3_readlink (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_readlink_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_READLINK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_readlink_req, GF_FOP_READLINK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4001,30 +3891,12 @@ server3_3_create (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.bname = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_create_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_CREATE;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_create_req, GF_FOP_CREATE);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
-
a3470f
         state->resolve.bname  = gf_strdup (args.bname);
a3470f
         state->mode           = args.mode;
a3470f
         state->umask          = args.umask;
a3470f
@@ -4072,25 +3944,9 @@ server3_3_open (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_open_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_OPEN;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_open_req, GF_FOP_OPEN);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4129,25 +3985,9 @@ server3_3_readv (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 goto out;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_read_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_READ;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_read_req, GF_FOP_READ);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4192,26 +4032,9 @@ server3_3_writev (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        len = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_write_req);
a3470f
-        if (len < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_WRITE;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, &len, &args,
a3470f
+                                  xdr_gfs3_write_req, GF_FOP_WRITE);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4418,26 +4241,9 @@ server3_3_fsync (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fsync_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FSYNC;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fsync_req, GF_FOP_FSYNC);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4477,26 +4283,9 @@ server3_3_flush (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_flush_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FLUSH;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_flush_req, GF_FOP_FLUSH);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4535,26 +4324,9 @@ server3_3_ftruncate (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_ftruncate_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FTRUNCATE;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_ftruncate_req, GF_FOP_FTRUNCATE);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4593,26 +4365,9 @@ server3_3_fstat (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fstat_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FSTAT;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fstat_req, GF_FOP_FSTAT);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4650,26 +4405,9 @@ server3_3_truncate (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_truncate_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_TRUNCATE;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_truncate_req, GF_FOP_TRUNCATE);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4710,26 +4448,9 @@ server3_3_unlink (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.bname = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_unlink_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_UNLINK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_unlink_req, GF_FOP_UNLINK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4774,26 +4495,9 @@ server3_3_setxattr (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.dict.dict_val = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_setxattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_SETXATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_setxattr_req, GF_FOP_SETXATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4852,26 +4556,10 @@ server3_3_fsetxattr (rpcsvc_request_t *req)
a3470f
                 return ret;
a3470f
 
a3470f
         args.dict.dict_val = alloca (req->msg[0].iov_len);
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fsetxattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
 
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FSETXATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fsetxattr_req, GF_FOP_FSETXATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -4928,26 +4616,10 @@ server3_3_fxattrop (rpcsvc_request_t *req)
a3470f
                 return ret;
a3470f
 
a3470f
         args.dict.dict_val = alloca (req->msg[0].iov_len);
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fxattrop_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FXATTROP;
a3470f
 
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fxattrop_req, GF_FOP_FXATTROP);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5005,26 +4677,9 @@ server3_3_xattrop (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.dict.dict_val = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_xattrop_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_XATTROP;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_xattrop_req, GF_FOP_XATTROP);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5079,26 +4734,9 @@ server3_3_getxattr (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.name = alloca (256);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_getxattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_GETXATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_getxattr_req, GF_FOP_GETXATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5142,26 +4780,10 @@ server3_3_fgetxattr (rpcsvc_request_t *req)
a3470f
                 return ret;
a3470f
 
a3470f
         args.name = alloca (256);
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fgetxattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
 
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FGETXATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fgetxattr_req, GF_FOP_FGETXATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5204,26 +4826,10 @@ server3_3_removexattr (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.name = alloca (256);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_removexattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_REMOVEXATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_removexattr_req,
a3470f
+                                  GF_FOP_REMOVEXATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5262,26 +4868,10 @@ server3_3_fremovexattr (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.name = alloca (4096);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fremovexattr_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FREMOVEXATTR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fremovexattr_req,
a3470f
+                                  GF_FOP_FREMOVEXATTR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5322,26 +4912,9 @@ server3_3_opendir (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_opendir_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_OPENDIR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_opendir_req, GF_FOP_OPENDIR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5379,26 +4952,10 @@ server3_3_readdirp (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_readdirp_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_READDIRP;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_readdirp_req,
a3470f
+                                  GF_FOP_READDIRP);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5450,26 +5007,9 @@ server3_3_readdir (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_readdir_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_READDIR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_readdir_req, GF_FOP_READDIR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5518,26 +5058,9 @@ server3_3_fsyncdir (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fsyncdir_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FSYNCDIR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fsyncdir_req, GF_FOP_FSYNCDIR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5579,26 +5102,9 @@ server3_3_mknod (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.bname = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_mknod_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_MKNOD;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_mknod_req, GF_FOP_MKNOD);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5647,26 +5153,9 @@ server3_3_mkdir (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.bname = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_mkdir_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_MKDIR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_mkdir_req, GF_FOP_MKDIR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5712,26 +5201,9 @@ server3_3_rmdir (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.bname = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_rmdir_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_RMDIR;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_rmdir_req, GF_FOP_RMDIR);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5776,26 +5248,9 @@ server3_3_inodelk (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.volume = alloca (256);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_inodelk_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_INODELK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_inodelk_req, GF_FOP_INODELK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5864,26 +5319,11 @@ server3_3_finodelk (rpcsvc_request_t *req)
a3470f
                 return ret;
a3470f
 
a3470f
         args.volume = alloca (256);
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_finodelk_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
 
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FINODELK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_finodelk_req,
a3470f
+                                  GF_FOP_FINODELK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -5956,26 +5396,10 @@ server3_3_entrylk (rpcsvc_request_t *req)
a3470f
         args.volume = alloca (256);
a3470f
         args.name   = alloca (256);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_entrylk_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_ENTRYLK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_entrylk_req,
a3470f
+                                  GF_FOP_ENTRYLK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6021,26 +5445,10 @@ server3_3_fentrylk (rpcsvc_request_t *req)
a3470f
         args.name   = alloca (256);
a3470f
         args.volume = alloca (256);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_fentrylk_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_FENTRYLK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_fentrylk_req,
a3470f
+                                  GF_FOP_FENTRYLK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6083,26 +5491,9 @@ server3_3_access (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_access_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_ACCESS;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_access_req, GF_FOP_ACCESS);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6144,26 +5535,9 @@ server3_3_symlink (rpcsvc_request_t *req)
a3470f
         args.bname    = alloca (req->msg[0].iov_len);
a3470f
         args.linkname = alloca (4096);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_symlink_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_SYMLINK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_symlink_req, GF_FOP_SYMLINK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6209,25 +5583,9 @@ server3_3_link (rpcsvc_request_t *req)
a3470f
 
a3470f
         args.newbname = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_link_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_LINK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_link_req, GF_FOP_LINK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6272,26 +5630,9 @@ server3_3_rename (rpcsvc_request_t *req)
a3470f
         args.oldbname = alloca (req->msg[0].iov_len);
a3470f
         args.newbname = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_rename_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_RENAME;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_rename_req, GF_FOP_RENAME);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6334,22 +5675,9 @@ server3_3_lease (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_lease_req);
a3470f
-        if (ret < 0) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_LEASE;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_lease_req, GF_FOP_LEASE);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6386,25 +5714,9 @@ server3_3_lk (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args, (xdrproc_t)xdr_gfs3_lk_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_LK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_lk_req, GF_FOP_LK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6492,26 +5804,10 @@ server3_3_rchecksum (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_rchecksum_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_RCHECKSUM;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_rchecksum_req,
a3470f
+                                  GF_FOP_RCHECKSUM);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6537,6 +5833,7 @@ out:
a3470f
         return ret;
a3470f
 }
a3470f
 
a3470f
+
a3470f
 int
a3470f
 server_null (rpcsvc_request_t *req)
a3470f
 {
a3470f
@@ -6564,32 +5861,11 @@ server3_3_lookup (rpcsvc_request_t *req)
a3470f
         args.bname           = alloca (req->msg[0].iov_len);
a3470f
         args.xdata.xdata_val = alloca (req->msg[0].iov_len);
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_lookup_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto err;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_lookup_req, GF_FOP_LOOKUP);
a3470f
+        if (ret != 0) {
a3470f
                 goto err;
a3470f
         }
a3470f
-        frame->root->op = GF_FOP_LOOKUP;
a3470f
-
a3470f
-        /* NOTE: lookup() uses req->ino only to identify if a lookup()
a3470f
-         *       is requested for 'root' or not
a3470f
-         */
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
 
a3470f
         state->resolve.type   = RESOLVE_DONTCARE;
a3470f
 
a3470f
@@ -6633,26 +5909,9 @@ server3_3_statfs (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_statfs_req);
a3470f
-        if (ret < 0) {
a3470f
-                //failed to decode msg;
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                // something wrong, mostly insufficient memory
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_STATFS;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_statfs_req, GF_FOP_STATFS);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6688,23 +5947,10 @@ server3_3_getactivelk (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_getactivelk_req);
a3470f
-        if (ret < 0) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_GETACTIVELK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_getactivelk_req,
a3470f
+                                  GF_FOP_GETACTIVELK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6743,24 +5989,10 @@ server3_3_setactivelk (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_setactivelk_req);
a3470f
-        if (ret < 0) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        frame->root->op = GF_FOP_SETACTIVELK;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, NULL, &args,
a3470f
+                                  xdr_gfs3_setactivelk_req,
a3470f
+                                  GF_FOP_SETACTIVELK);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
@@ -6805,25 +6037,10 @@ server3_3_compound (rpcsvc_request_t *req)
a3470f
         if (!req)
a3470f
                 return ret;
a3470f
 
a3470f
-        ret = xdr_to_generic (req->msg[0], &args,
a3470f
-                              (xdrproc_t)xdr_gfs3_compound_req);
a3470f
-        if (ret < 0) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-
a3470f
-        len = ret;
a3470f
-        frame = get_frame_from_request (req);
a3470f
-        if (!frame) {
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
-                goto out;
a3470f
-        }
a3470f
-        frame->root->op = GF_FOP_COMPOUND;
a3470f
-
a3470f
-        state = CALL_STATE (frame);
a3470f
-        if (!frame->root->client->bound_xl) {
a3470f
-                /* auth failure, request on subvolume without setvolume */
a3470f
-                SERVER_REQ_SET_ERROR (req, ret);
a3470f
+        ret = rpc_receive_common (req, &frame, &state, &len, &args,
a3470f
+                                  xdr_gfs3_compound_req,
a3470f
+                                  GF_FOP_COMPOUND);
a3470f
+        if (ret != 0) {
a3470f
                 goto out;
a3470f
         }
a3470f
 
a3470f
-- 
a3470f
1.8.3.1
a3470f