diff options
author | Jeff Darcy <jdarcy@redhat.com> | 2014-02-11 00:19:57 +0000 |
---|---|---|
committer | Jeff Darcy <jdarcy@redhat.com> | 2014-03-11 17:50:53 +0000 |
commit | 6eaa28f976dce3d5dc9d7fbe08a14579bb021ef4 (patch) | |
tree | 5e60702b4dd90ae9f021adc95bd6c1323df444b6 /rpc/xdr/src | |
parent | 93882c439af4badfc2f1b5a9edc99eeb4a7aa93c (diff) |
Add GF_FOP_IPC for inter-translator communication.
Several features - e.g. encryption, erasure codes, or NSR - involve
multiple cooperating translators which sometimes need a "private" means
of communication amongst themselves. Historically we've used virtual or
synthetic xattrs, but that's not very elegant and clutters up the
getxattr/setxattr path which must also handle real xattr requests. This
new fop should address that.
The only argument is an int32_t "op" which should be recognized by the
target translator. It is recommended that translators using these
feature follow some convention regarding the ops that they define, to
avoid conflicts. Using a hash of the target translator's type string as
a base for a series of ops would probably be a good start. Any other
information can be passed in both directions using xdata.
The default behavior for this fop, as with any other, is to pass through
to FIRST_CHILD. That makes use of this fop "transparent" to other
translators that were written before it existed, but it also means that
it only really works with pass-through translators. If a routing
translator (such as DHT) or a fan-out translator (such as AFR) is
involved, the IPC might not reach its intended destination unless those
translators are modified to forward IPC fops along all paths.
If an IPC gets all the way to storage/posix it is considered an error,
much like an uncaught exception. We don't actually *do* anything in
that case, but we do flag it as an error in the log.
Change-Id: I7f37c9247ee35536f8136c7aea758e6fe04616c4
Signed-off-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'rpc/xdr/src')
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.c | 64 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.h | 44 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.x | 6 |
3 files changed, 70 insertions, 44 deletions
diff --git a/rpc/xdr/src/glusterfs3-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c index 3205c551e..6b59f4040 100644 --- a/rpc/xdr/src/glusterfs3-xdr.c +++ b/rpc/xdr/src/glusterfs3-xdr.c @@ -1587,44 +1587,41 @@ xdr_gfs3_discard_rsp (XDR *xdrs, gfs3_discard_rsp *objp) bool_t xdr_gfs3_zerofill_req (XDR *xdrs, gfs3_zerofill_req *objp) { - register int32_t *buf; + register int32_t *buf; buf = NULL; - if (!xdr_opaque (xdrs, objp->gfid, 16)) - return FALSE; - if (!xdr_quad_t (xdrs, &objp->fd)) - return FALSE; - if (!xdr_u_quad_t (xdrs, &objp->offset)) - return FALSE; - if (!xdr_u_quad_t (xdrs, &objp->size)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, - (u_int *) &objp->xdata.xdata_len, ~0)) - return FALSE; - return TRUE; + if (!xdr_opaque (xdrs, objp->gfid, 16)) + return FALSE; + if (!xdr_quad_t (xdrs, &objp->fd)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->offset)) + return FALSE; + if (!xdr_u_quad_t (xdrs, &objp->size)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) + return FALSE; + return TRUE; } bool_t xdr_gfs3_zerofill_rsp (XDR *xdrs, gfs3_zerofill_rsp *objp) { - register int32_t *buf; + register int32_t *buf; buf = NULL; - if (!xdr_int (xdrs, &objp->op_ret)) - return FALSE; - if (!xdr_int (xdrs, &objp->op_errno)) - return FALSE; - if (!xdr_gf_iatt (xdrs, &objp->statpre)) - return FALSE; - if (!xdr_gf_iatt (xdrs, &objp->statpost)) - return FALSE; - if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, - (u_int *) &objp->xdata.xdata_len, ~0)) - return FALSE; - return TRUE; + if (!xdr_int (xdrs, &objp->op_ret)) + return FALSE; + if (!xdr_int (xdrs, &objp->op_errno)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->statpre)) + return FALSE; + if (!xdr_gf_iatt (xdrs, &objp->statpost)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) + return FALSE; + return TRUE; } - bool_t xdr_gfs3_rchecksum_req (XDR *xdrs, gfs3_rchecksum_req *objp) { @@ -1705,6 +1702,19 @@ xdr_gfs3_rchecksum_rsp (XDR *xdrs, gfs3_rchecksum_rsp *objp) } bool_t +xdr_gfs3_ipc_req (XDR *xdrs, gfs3_ipc_req *objp) +{ + register int32_t *buf; + buf = NULL; + + if (!xdr_int (xdrs, &objp->op)) + return FALSE; + if (!xdr_bytes (xdrs, (char **)&objp->xdata.xdata_val, (u_int *) &objp->xdata.xdata_len, ~0)) + return FALSE; + return TRUE; +} + +bool_t xdr_gf_setvolume_req (XDR *xdrs, gf_setvolume_req *objp) { register int32_t *buf; diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h index 13566e694..c44a48680 100644 --- a/rpc/xdr/src/glusterfs3-xdr.h +++ b/rpc/xdr/src/glusterfs3-xdr.h @@ -937,30 +937,29 @@ struct gfs3_discard_rsp { typedef struct gfs3_discard_rsp gfs3_discard_rsp; struct gfs3_zerofill_req { - char gfid[16]; - quad_t fd; - u_quad_t offset; - u_quad_t size; - struct { - u_int xdata_len; - char *xdata_val; - } xdata; + char gfid[16]; + quad_t fd; + u_quad_t offset; + u_quad_t size; + struct { + u_int xdata_len; + char *xdata_val; + } xdata; }; typedef struct gfs3_zerofill_req gfs3_zerofill_req; struct gfs3_zerofill_rsp { - int op_ret; - int op_errno; - struct gf_iatt statpre; - struct gf_iatt statpost; - struct { - u_int xdata_len; - char *xdata_val; - } xdata; + int op_ret; + int op_errno; + struct gf_iatt statpre; + struct gf_iatt statpost; + struct { + u_int xdata_len; + char *xdata_val; + } xdata; }; typedef struct gfs3_zerofill_rsp gfs3_zerofill_rsp; - struct gfs3_rchecksum_req { quad_t fd; u_quad_t offset; @@ -987,6 +986,15 @@ struct gfs3_rchecksum_rsp { }; typedef struct gfs3_rchecksum_rsp gfs3_rchecksum_rsp; +struct gfs3_ipc_req { + int op; + struct { + u_int xdata_len; + char *xdata_val; + } xdata; +}; +typedef struct gfs3_ipc_req gfs3_ipc_req; + struct gf_setvolume_req { struct { u_int dict_len; @@ -1264,6 +1272,7 @@ extern bool_t xdr_gfs3_zerofill_req (XDR *, gfs3_zerofill_req*); extern bool_t xdr_gfs3_zerofill_rsp (XDR *, gfs3_zerofill_rsp*); extern bool_t xdr_gfs3_rchecksum_req (XDR *, gfs3_rchecksum_req*); extern bool_t xdr_gfs3_rchecksum_rsp (XDR *, gfs3_rchecksum_rsp*); +extern bool_t xdr_gfs3_ipc_req (XDR *, gfs3_ipc_req*); extern bool_t xdr_gf_setvolume_req (XDR *, gf_setvolume_req*); extern bool_t xdr_gf_setvolume_rsp (XDR *, gf_setvolume_rsp*); extern bool_t xdr_gf_getspec_req (XDR *, gf_getspec_req*); @@ -1364,6 +1373,7 @@ extern bool_t xdr_gfs3_zerofill_req (); extern bool_t xdr_gfs3_zerofill_rsp (); extern bool_t xdr_gfs3_rchecksum_req (); extern bool_t xdr_gfs3_rchecksum_rsp (); +extern bool_t xdr_gfs3_ipc_req (); extern bool_t xdr_gf_setvolume_req (); extern bool_t xdr_gf_setvolume_rsp (); extern bool_t xdr_gf_getspec_req (); diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x index 1edbda3ad..9fdc8f909 100644 --- a/rpc/xdr/src/glusterfs3-xdr.x +++ b/rpc/xdr/src/glusterfs3-xdr.x @@ -630,6 +630,11 @@ struct gfs3_fstat_req { opaque xdata<>; /* Extra data */ } ; +struct gfs3_ipc_req { + int op; + opaque xdata<>; +}; + struct gf_setvolume_req { opaque dict<>; @@ -744,6 +749,7 @@ struct gf_set_lk_ver_req { int lk_ver; }; + struct gf_event_notify_req { int op; opaque dict<>; |