summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-09-03 11:46:21 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-04 01:45:41 -0700
commit2c400f60cad3ac0b9dbf1be06b48675d40fcc824 (patch)
treed2593d77e0e24a9ffc63f247a2e737c70bde2571
parent64443fa783c9c43a597440164b35fd8131b7f4d3 (diff)
gfid: protocol/xdr changes to handle gfid based fops.
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 971 (dynamic volume management) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=971
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.c152
-rw-r--r--rpc/xdr/src/glusterfs3-xdr.h63
-rw-r--r--xlators/protocol/client/src/client.c6
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c548
-rw-r--r--xlators/protocol/server/src/server-resolve.c4
-rw-r--r--xlators/protocol/server/src/server.h2
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c242
7 files changed, 608 insertions, 409 deletions
diff --git a/rpc/xdr/src/glusterfs3-xdr.c b/rpc/xdr/src/glusterfs3-xdr.c
index f18a2535834..d9453c44ad2 100644
--- a/rpc/xdr/src/glusterfs3-xdr.c
+++ b/rpc/xdr/src/glusterfs3-xdr.c
@@ -24,7 +24,6 @@
*/
#include "glusterfs3-xdr.h"
-#include "iatt.h"
bool_t
xdr_gf_statfs (XDR *xdrs, gf_statfs *objp)
@@ -78,6 +77,9 @@ xdr_gf_iatt (XDR *xdrs, gf_iatt *objp)
register int32_t *buf;
if (xdrs->x_op == XDR_ENCODE) {
+ if (!xdr_vector (xdrs, (char *)objp->ia_gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ia_ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ia_gen))
@@ -133,6 +135,9 @@ xdr_gf_iatt (XDR *xdrs, gf_iatt *objp)
}
return TRUE;
} else if (xdrs->x_op == XDR_DECODE) {
+ if (!xdr_vector (xdrs, (char *)objp->ia_gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ia_ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ia_gen))
@@ -189,6 +194,10 @@ xdr_gf_iatt (XDR *xdrs, gf_iatt *objp)
return TRUE;
}
+ if (!xdr_vector (xdrs, (char *)objp->ia_gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
+
if (!xdr_u_quad_t (xdrs, &objp->ia_ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ia_gen))
@@ -232,6 +241,9 @@ xdr_gfs3_stat_req (XDR *xdrs, gfs3_stat_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -262,6 +274,9 @@ xdr_gfs3_readlink_req (XDR *xdrs, gfs3_readlink_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -296,6 +311,9 @@ xdr_gfs3_mknod_req (XDR *xdrs, gfs3_mknod_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->pargfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->par))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -308,6 +326,9 @@ xdr_gfs3_mknod_req (XDR *xdrs, gfs3_mknod_req *objp)
return FALSE;
if (!xdr_string (xdrs, &objp->bname, ~0))
return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val,
+ (u_int *) &objp->dict.dict_len, ~0))
+ return FALSE;
return TRUE;
}
@@ -336,6 +357,9 @@ xdr_gfs3_mkdir_req (XDR *xdrs, gfs3_mkdir_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->pargfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->par))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -346,6 +370,9 @@ xdr_gfs3_mkdir_req (XDR *xdrs, gfs3_mkdir_req *objp)
return FALSE;
if (!xdr_string (xdrs, &objp->bname, ~0))
return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val,
+ (u_int *) &objp->dict.dict_len, ~0))
+ return FALSE;
return TRUE;
}
@@ -374,6 +401,9 @@ xdr_gfs3_unlink_req (XDR *xdrs, gfs3_unlink_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->pargfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->par))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -408,6 +438,9 @@ xdr_gfs3_rmdir_req (XDR *xdrs, gfs3_rmdir_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->pargfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->par))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -442,6 +475,9 @@ xdr_gfs3_symlink_req (XDR *xdrs, gfs3_symlink_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->pargfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->par))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -452,6 +488,9 @@ xdr_gfs3_symlink_req (XDR *xdrs, gfs3_symlink_req *objp)
return FALSE;
if (!xdr_string (xdrs, &objp->linkname, ~0))
return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val,
+ (u_int *) &objp->dict.dict_len, ~0))
+ return FALSE;
return TRUE;
}
@@ -480,6 +519,12 @@ xdr_gfs3_rename_req (XDR *xdrs, gfs3_rename_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->oldgfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->newgfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->oldpar))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->oldgen))
@@ -528,6 +573,12 @@ xdr_gfs3_link_req (XDR *xdrs, gfs3_link_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->oldgfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->newgfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->oldino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->oldgen))
@@ -570,6 +621,9 @@ xdr_gfs3_truncate_req (XDR *xdrs, gfs3_truncate_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -604,6 +658,9 @@ xdr_gfs3_open_req (XDR *xdrs, gfs3_open_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -638,6 +695,9 @@ xdr_gfs3_read_req (XDR *xdrs, gfs3_read_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -675,6 +735,12 @@ xdr_gfs3_lookup_req (XDR *xdrs, gfs3_lookup_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->pargfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->par))
@@ -719,6 +785,9 @@ xdr_gfs3_write_req (XDR *xdrs, gfs3_write_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -755,6 +824,9 @@ xdr_gfs3_statfs_req (XDR *xdrs, gfs3_statfs_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -785,6 +857,9 @@ xdr_gfs3_lk_req (XDR *xdrs, gfs3_lk_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -821,6 +896,9 @@ xdr_gfs3_inodelk_req (XDR *xdrs, gfs3_inodelk_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -844,6 +922,9 @@ xdr_gfs3_finodelk_req (XDR *xdrs, gfs3_finodelk_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -867,6 +948,9 @@ xdr_gfs3_flush_req (XDR *xdrs, gfs3_flush_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -882,6 +966,9 @@ xdr_gfs3_fsync_req (XDR *xdrs, gfs3_fsync_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -916,6 +1003,9 @@ xdr_gfs3_setxattr_req (XDR *xdrs, gfs3_setxattr_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -935,6 +1025,9 @@ xdr_gfs3_fsetxattr_req (XDR *xdrs, gfs3_fsetxattr_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -954,6 +1047,9 @@ xdr_gfs3_xattrop_req (XDR *xdrs, gfs3_xattrop_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -988,6 +1084,9 @@ xdr_gfs3_fxattrop_req (XDR *xdrs, gfs3_fxattrop_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1022,6 +1121,9 @@ xdr_gfs3_getxattr_req (XDR *xdrs, gfs3_getxattr_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1056,6 +1158,9 @@ xdr_gfs3_fgetxattr_req (XDR *xdrs, gfs3_fgetxattr_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1090,6 +1195,9 @@ xdr_gfs3_removexattr_req (XDR *xdrs, gfs3_removexattr_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1107,6 +1215,9 @@ xdr_gfs3_opendir_req (XDR *xdrs, gfs3_opendir_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1137,6 +1248,9 @@ xdr_gfs3_fsyncdir_req (XDR *xdrs, gfs3_fsyncdir_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1154,6 +1268,9 @@ xdr_gfs3_readdir_req (XDR *xdrs, gfs3_readdir_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1173,6 +1290,9 @@ xdr_gfs3_readdirp_req (XDR *xdrs, gfs3_readdirp_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1218,6 +1338,9 @@ xdr_gfs3_access_req (XDR *xdrs, gfs3_access_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1235,6 +1358,9 @@ xdr_gfs3_create_req (XDR *xdrs, gfs3_create_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->pargfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->par))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1247,6 +1373,9 @@ xdr_gfs3_create_req (XDR *xdrs, gfs3_create_req *objp)
return FALSE;
if (!xdr_string (xdrs, &objp->bname, ~0))
return FALSE;
+ if (!xdr_bytes (xdrs, (char **)&objp->dict.dict_val,
+ (u_int *) &objp->dict.dict_len, ~0))
+ return FALSE;
return TRUE;
}
@@ -1277,6 +1406,9 @@ xdr_gfs3_ftruncate_req (XDR *xdrs, gfs3_ftruncate_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1311,6 +1443,9 @@ xdr_gfs3_fstat_req (XDR *xdrs, gfs3_fstat_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1341,6 +1476,9 @@ xdr_gfs3_entrylk_req (XDR *xdrs, gfs3_entrylk_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1366,6 +1504,9 @@ xdr_gfs3_fentrylk_req (XDR *xdrs, gfs3_fentrylk_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1392,6 +1533,9 @@ xdr_gfs3_setattr_req (XDR *xdrs, gfs3_setattr_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1648,6 +1792,9 @@ xdr_gfs3_releasedir_req (XDR *xdrs, gfs3_releasedir_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
@@ -1663,6 +1810,9 @@ xdr_gfs3_release_req (XDR *xdrs, gfs3_release_req *objp)
if (!xdr_u_quad_t (xdrs, &objp->gfs_id))
return FALSE;
+ if (!xdr_vector (xdrs, (char *)objp->gfid, 16,
+ sizeof (u_char), (xdrproc_t) xdr_u_char))
+ return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->ino))
return FALSE;
if (!xdr_u_quad_t (xdrs, &objp->gen))
diff --git a/rpc/xdr/src/glusterfs3-xdr.h b/rpc/xdr/src/glusterfs3-xdr.h
index 62866bf45a1..bcd293da6e6 100644
--- a/rpc/xdr/src/glusterfs3-xdr.h
+++ b/rpc/xdr/src/glusterfs3-xdr.h
@@ -241,6 +241,7 @@ gf_flock_from_flock (struct gf_flock *gf_flock, struct flock *flock)
}
struct gf_iatt {
+ u_char ia_gfid[16];
u_quad_t ia_ino;
u_quad_t ia_gen;
u_quad_t ia_dev;
@@ -268,6 +269,7 @@ gf_stat_to_iatt (struct gf_iatt *gf_stat, struct iatt *iatt)
if (!iatt || !gf_stat)
return;
+ memcpy (iatt->ia_gfid, gf_stat->ia_gfid, 16);
iatt->ia_ino = gf_stat->ia_ino ;
iatt->ia_gen = gf_stat->ia_gen ;
iatt->ia_dev = gf_stat->ia_dev ;
@@ -295,6 +297,7 @@ gf_stat_from_iatt (struct gf_iatt *gf_stat, struct iatt *iatt)
if (!iatt || !gf_stat)
return;
+ memcpy (gf_stat->ia_gfid, iatt->ia_gfid, 16);
gf_stat->ia_ino = iatt->ia_ino ;
gf_stat->ia_gen = iatt->ia_gen ;
gf_stat->ia_dev = iatt->ia_dev ;
@@ -319,6 +322,7 @@ gf_stat_from_iatt (struct gf_iatt *gf_stat, struct iatt *iatt)
struct gfs3_stat_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
char *path;
@@ -335,6 +339,7 @@ typedef struct gfs3_stat_rsp gfs3_stat_rsp;
struct gfs3_readlink_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int size;
@@ -353,12 +358,18 @@ typedef struct gfs3_readlink_rsp gfs3_readlink_rsp;
struct gfs3_mknod_req {
u_quad_t gfs_id;
+ u_char pargfid[16];
u_quad_t par;
u_quad_t gen;
u_quad_t dev;
u_int mode;
char *path;
char *bname;
+ struct {
+ u_int dict_len;
+ char *dict_val;
+ } dict;
+
};
typedef struct gfs3_mknod_req gfs3_mknod_req;
@@ -374,11 +385,16 @@ typedef struct gfs3_mknod_rsp gfs3_mknod_rsp;
struct gfs3_mkdir_req {
u_quad_t gfs_id;
+ u_char pargfid[16];
u_quad_t par;
u_quad_t gen;
u_int mode;
char *path;
char *bname;
+ struct {
+ u_int dict_len;
+ char *dict_val;
+ } dict;
};
typedef struct gfs3_mkdir_req gfs3_mkdir_req;
@@ -394,6 +410,7 @@ typedef struct gfs3_mkdir_rsp gfs3_mkdir_rsp;
struct gfs3_unlink_req {
u_quad_t gfs_id;
+ u_char pargfid[16];
u_quad_t par;
u_quad_t gen;
char *path;
@@ -412,6 +429,7 @@ typedef struct gfs3_unlink_rsp gfs3_unlink_rsp;
struct gfs3_rmdir_req {
u_quad_t gfs_id;
+ u_char pargfid[16];
u_quad_t par;
u_quad_t gen;
char *path;
@@ -430,11 +448,16 @@ typedef struct gfs3_rmdir_rsp gfs3_rmdir_rsp;
struct gfs3_symlink_req {
u_quad_t gfs_id;
+ u_char pargfid[16];
u_quad_t par;
u_quad_t gen;
char *path;
char *bname;
char *linkname;
+ struct {
+ u_int dict_len;
+ char *dict_val;
+ } dict;
};
typedef struct gfs3_symlink_req gfs3_symlink_req;
@@ -450,6 +473,8 @@ typedef struct gfs3_symlink_rsp gfs3_symlink_rsp;
struct gfs3_rename_req {
u_quad_t gfs_id;
+ u_char oldgfid[16];
+ u_char newgfid[16];
u_quad_t oldpar;
u_quad_t oldgen;
u_quad_t newpar;
@@ -475,6 +500,8 @@ typedef struct gfs3_rename_rsp gfs3_rename_rsp;
struct gfs3_link_req {
u_quad_t gfs_id;
+ u_char oldgfid[16];
+ u_char newgfid[16];
u_quad_t oldino;
u_quad_t oldgen;
u_quad_t newpar;
@@ -497,6 +524,7 @@ typedef struct gfs3_link_rsp gfs3_link_rsp;
struct gfs3_truncate_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_quad_t offset;
@@ -515,6 +543,7 @@ typedef struct gfs3_truncate_rsp gfs3_truncate_rsp;
struct gfs3_open_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int flags;
@@ -533,6 +562,7 @@ typedef struct gfs3_open_rsp gfs3_open_rsp;
struct gfs3_read_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -552,6 +582,8 @@ typedef struct gfs3_read_rsp gfs3_read_rsp;
struct gfs3_lookup_req {
u_quad_t gfs_id;
+ u_char gfid[16];
+ u_char pargfid[16];
u_quad_t ino;
u_quad_t par;
u_quad_t gen;
@@ -580,6 +612,7 @@ typedef struct gfs3_lookup_rsp gfs3_lookup_rsp;
struct gfs3_write_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -599,6 +632,7 @@ typedef struct gfs3_write_rsp gfs3_write_rsp;
struct gfs3_statfs_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
char *path;
@@ -615,6 +649,7 @@ typedef struct gfs3_statfs_rsp gfs3_statfs_rsp;
struct gfs3_lk_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -634,6 +669,7 @@ typedef struct gfs3_lk_rsp gfs3_lk_rsp;
struct gfs3_inodelk_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int cmd;
@@ -646,6 +682,7 @@ typedef struct gfs3_inodelk_req gfs3_inodelk_req;
struct gfs3_finodelk_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -658,6 +695,7 @@ typedef struct gfs3_finodelk_req gfs3_finodelk_req;
struct gfs3_flush_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -666,6 +704,7 @@ typedef struct gfs3_flush_req gfs3_flush_req;
struct gfs3_fsync_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -684,6 +723,7 @@ typedef struct gfs3_fsync_rsp gfs3_fsync_rsp;
struct gfs3_setxattr_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int flags;
@@ -697,6 +737,7 @@ typedef struct gfs3_setxattr_req gfs3_setxattr_req;
struct gfs3_fsetxattr_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -710,6 +751,7 @@ typedef struct gfs3_fsetxattr_req gfs3_fsetxattr_req;
struct gfs3_xattrop_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int flags;
@@ -734,6 +776,7 @@ typedef struct gfs3_xattrop_rsp gfs3_xattrop_rsp;
struct gfs3_fxattrop_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -758,6 +801,7 @@ typedef struct gfs3_fxattrop_rsp gfs3_fxattrop_rsp;
struct gfs3_getxattr_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int namelen;
@@ -779,6 +823,7 @@ typedef struct gfs3_getxattr_rsp gfs3_getxattr_rsp;
struct gfs3_fgetxattr_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -800,6 +845,7 @@ typedef struct gfs3_fgetxattr_rsp gfs3_fgetxattr_rsp;
struct gfs3_removexattr_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
char *path;
@@ -809,6 +855,7 @@ typedef struct gfs3_removexattr_req gfs3_removexattr_req;
struct gfs3_opendir_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
char *path;
@@ -825,6 +872,7 @@ typedef struct gfs3_opendir_rsp gfs3_opendir_rsp;
struct gfs3_fsyncdir_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -834,6 +882,7 @@ typedef struct gfs3_fsyncdir_req gfs3_fsyncdir_req;
struct gfs3_readdir_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -844,6 +893,7 @@ typedef struct gfs3_readdir_req gfs3_readdir_req;
struct gfs3_readdirp_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -874,6 +924,7 @@ typedef struct gf_setvolume_rsp gf_setvolume_rsp;
struct gfs3_access_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int mask;
@@ -883,12 +934,17 @@ typedef struct gfs3_access_req gfs3_access_req;
struct gfs3_create_req {
u_quad_t gfs_id;
+ u_char pargfid[16];
u_quad_t par;
u_quad_t gen;
u_int flags;
u_int mode;
char *path;
char *bname;
+ struct {
+ u_int dict_len;
+ char *dict_val;
+ } dict;
};
typedef struct gfs3_create_req gfs3_create_req;
@@ -905,6 +961,7 @@ typedef struct gfs3_create_rsp gfs3_create_rsp;
struct gfs3_ftruncate_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -923,6 +980,7 @@ typedef struct gfs3_ftruncate_rsp gfs3_ftruncate_rsp;
struct gfs3_fstat_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -939,6 +997,7 @@ typedef struct gfs3_fstat_rsp gfs3_fstat_rsp;
struct gfs3_entrylk_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
u_int cmd;
@@ -952,6 +1011,7 @@ typedef struct gfs3_entrylk_req gfs3_entrylk_req;
struct gfs3_fentrylk_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -966,6 +1026,7 @@ typedef struct gfs3_fentrylk_req gfs3_fentrylk_req;
struct gfs3_setattr_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
struct gf_iatt stbuf;
@@ -1062,6 +1123,7 @@ typedef struct gf_notify_rsp gf_notify_rsp;
struct gfs3_releasedir_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
@@ -1070,6 +1132,7 @@ typedef struct gfs3_releasedir_req gfs3_releasedir_req;
struct gfs3_release_req {
u_quad_t gfs_id;
+ u_char gfid[16];
u_quad_t ino;
u_quad_t gen;
quad_t fd;
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index f1d99ce6c54..f500a461212 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -374,6 +374,7 @@ client_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode,
args.loc = loc;
args.mode = mode;
args.rdev = rdev;
+ args.dict = params;
proc = &conf->fops->proctable[GF_FOP_MKNOD];
if (proc->fn)
@@ -400,8 +401,9 @@ client_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc,
if (!conf->fops)
goto out;
- args.loc = loc;
+ args.loc = loc;
args.mode = mode;
+ args.dict = params;
proc = &conf->fops->proctable[GF_FOP_MKDIR];
if (proc->fn)
@@ -483,6 +485,7 @@ client_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath,
args.linkname = linkpath;
args.loc = loc;
+ args.dict = params;
proc = &conf->fops->proctable[GF_FOP_SYMLINK];
if (proc->fn)
@@ -571,6 +574,7 @@ client_create (call_frame_t *frame, xlator_t *this, loc_t *loc,
args.flags = flags;
args.mode = mode;
args.fd = fd;
+ args.dict = params;
proc = &conf->fops->proctable[GF_FOP_CREATE];
if (proc->fn)
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index dffa210baee..9bad8b4ed35 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -143,16 +143,6 @@ client3_1_symlink_cbk (struct rpc_req *req, struct iovec *iov, int count,
if (-1 != rsp.op_ret) {
gf_stat_to_iatt (&rsp.stat, &stbuf);
- ret = inode_ctx_put2 (inode, frame->this,
- stbuf.ia_ino, stbuf.ia_gen);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "SYMLINK %"PRId64"/%s (%s): failed to set "
- "remote inode number to inode ctx",
- local->loc.parent->ino, local->loc.name,
- local->loc.path);
- }
-
gf_stat_to_iatt (&rsp.preparent, &preparent);
gf_stat_to_iatt (&rsp.postparent, &postparent);
}
@@ -205,16 +195,6 @@ client3_1_mknod_cbk (struct rpc_req *req, struct iovec *iov, int count,
if (-1 != rsp.op_ret) {
gf_stat_to_iatt (&rsp.stat, &stbuf);
- ret = inode_ctx_put2 (inode, frame->this,
- stbuf.ia_ino, stbuf.ia_gen);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "MKNOD %"PRId64"/%s (%s): failed to set "
- "remote inode number to inode ctx",
- local->loc.parent->ino, local->loc.name,
- local->loc.path);
- }
-
gf_stat_to_iatt (&rsp.preparent, &preparent);
gf_stat_to_iatt (&rsp.postparent, &postparent);
}
@@ -266,16 +246,6 @@ client3_1_mkdir_cbk (struct rpc_req *req, struct iovec *iov, int count,
if (-1 != rsp.op_ret) {
gf_stat_to_iatt (&rsp.stat, &stbuf);
- ret = inode_ctx_put2 (inode, frame->this,
- stbuf.ia_ino, stbuf.ia_gen);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "MKDIR %"PRId64"/%s (%s): failed to set "
- "remote inode number to inode ctx",
- local->loc.parent->ino, local->loc.name,
- local->loc.path);
- }
-
gf_stat_to_iatt (&rsp.preparent, &preparent);
gf_stat_to_iatt (&rsp.postparent, &postparent);
}
@@ -300,8 +270,6 @@ client3_1_open_cbk (struct rpc_req *req, struct iovec *iov, int count,
clnt_fd_ctx_t *fdctx = NULL;
call_frame_t *frame = NULL;
fd_t *fd = NULL;
- ino_t ino = 0;
- uint64_t gen = 0;
int ret = 0;
gfs3_open_rsp rsp = {0,};
@@ -339,12 +307,8 @@ client3_1_open_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- inode_ctx_get2 (fd->inode, frame->this, &ino, &gen);
-
fdctx->remote_fd = rsp.fd;
fdctx->inode = inode_ref (fd->inode);
- fdctx->ino = ino;
- fdctx->gen = gen;
fdctx->flags = local->flags;
fdctx->wbflags = local->wbflags;
@@ -1462,16 +1426,6 @@ client3_1_create_cbk (struct rpc_req *req, struct iovec *iov, int count,
if (-1 != rsp.op_ret) {
gf_stat_to_iatt (&rsp.stat, &stbuf);
- ret = inode_ctx_put2 (inode, frame->this,
- stbuf.ia_ino, stbuf.ia_gen);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "CREATE %"PRId64"/%s (%s): failed to set "
- "remote inode number to inode ctx",
- local->loc.parent->ino, local->loc.name,
- local->loc.path);
- }
-
gf_stat_to_iatt (&rsp.preparent, &preparent);
gf_stat_to_iatt (&rsp.postparent, &postparent);
@@ -1485,8 +1439,6 @@ client3_1_create_cbk (struct rpc_req *req, struct iovec *iov, int count,
fdctx->remote_fd = rsp.fd;
fdctx->inode = inode_ref (inode);
- fdctx->ino = stbuf.ia_ino;
- fdctx->gen = stbuf.ia_gen;
fdctx->flags = local->flags;
INIT_LIST_HEAD (&fdctx->sfd_pos);
@@ -1780,8 +1732,6 @@ client3_1_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
clnt_local_t *local = NULL;
clnt_conf_t *conf = NULL;
clnt_fd_ctx_t *fdctx = NULL;
- ino_t ino = 0;
- uint64_t gen = 0;
call_frame_t *frame = NULL;
fd_t *fd = NULL;
int ret = 0;
@@ -1822,13 +1772,8 @@ client3_1_opendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
goto out;
}
- inode_ctx_get2 (fd->inode, frame->this, &ino, &gen);
-
fdctx->remote_fd = rsp.fd;
fdctx->inode = inode_ref (fd->inode);
- fdctx->ino = ino;
- fdctx->gen = gen;
-
fdctx->is_dir = 1;
INIT_LIST_HEAD (&fdctx->sfd_pos);
@@ -1864,8 +1809,6 @@ client3_1_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
struct iatt stbuf = {0,};
struct iatt postparent = {0,};
int op_errno = EINVAL;
- ino_t oldino = 0;
- uint64_t oldgen = 0;
dict_t *xattr = NULL;
inode_t *inode = NULL;
char *buf = NULL;
@@ -1892,63 +1835,35 @@ client3_1_lookup_cbk (struct rpc_req *req, struct iovec *iov, int count,
op_errno = gf_error_to_errno (rsp.op_errno);
gf_stat_to_iatt (&rsp.postparent, &postparent);
- if (rsp.op_ret == 0) {
- rsp.op_ret = -1;
- gf_stat_to_iatt (&rsp.stat, &stbuf);
-
- ret = inode_ctx_get2 (inode, frame->this, &oldino, &oldgen);
- if ((!ret) && ((oldino != stbuf.ia_ino) ||
- (oldgen != stbuf.ia_gen))) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "LOOKUP %"PRId64"/%s (%s): "
- "inode number changed from "
- "{%"PRId64",%"PRId64"} to {%"PRId64",%"PRId64"}",
- local->loc.parent ?
- local->loc.parent->ino : (uint64_t) 0,
- local->loc.name,
- local->loc.path,
- oldgen, oldino, stbuf.ia_gen, stbuf.ia_ino);
- op_errno = ESTALE;
- goto out;
- }
+ if (rsp.op_ret == -1)
+ goto out;
- ret = inode_ctx_put2 (inode, frame->this,
- stbuf.ia_ino, stbuf.ia_gen);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "LOOKUP %"PRId64"/%s (%s) : "
- "failed to set remote inode "
- "number to inode ctx",
- local->loc.parent ?
- local->loc.parent->ino : (uint64_t) 0,
- local->loc.name,
- local->loc.path);
- }
+ rsp.op_ret = -1;
+ gf_stat_to_iatt (&rsp.stat, &stbuf);
- if (rsp.dict.dict_len > 0) {
- xattr = dict_new();
- GF_VALIDATE_OR_GOTO (frame->this->name, xattr, out);
+ if (rsp.dict.dict_len > 0) {
+ xattr = dict_new();
+ GF_VALIDATE_OR_GOTO (frame->this->name, xattr, out);
- buf = memdup (rsp.dict.dict_val, rsp.dict.dict_len);
- GF_VALIDATE_OR_GOTO (frame->this->name, buf, out);
+ buf = memdup (rsp.dict.dict_val, rsp.dict.dict_len);
+ GF_VALIDATE_OR_GOTO (frame->this->name, buf, out);
- ret = dict_unserialize (buf, rsp.dict.dict_len, &xattr);
- if (ret < 0) {
- gf_log (frame->this->name, GF_LOG_DEBUG,
- "%s (%"PRId64"): failed to "
- "unserialize dictionary",
- local->loc.path, inode->ino);
- op_errno = EINVAL;
- goto out;
- }
-
- xattr->extra_free = buf;
- buf = NULL;
+ ret = dict_unserialize (buf, rsp.dict.dict_len, &xattr);
+ if (ret < 0) {
+ gf_log (frame->this->name, GF_LOG_DEBUG,
+ "%s (%"PRId64"): failed to "
+ "unserialize dictionary",
+ local->loc.path, inode->ino);
+ op_errno = EINVAL;
+ goto out;
}
- rsp.op_ret = 0;
+ xattr->extra_free = buf;
+ buf = NULL;
}
+ rsp.op_ret = 0;
+
out:
rsp.op_errno = op_errno;
frame->local = NULL;
@@ -2262,8 +2177,7 @@ protocol_client_reopendir (xlator_t *this, clnt_fd_ctx_t *fdctx)
goto out;
}
- req.ino = fdctx->ino;
- req.gen = fdctx->gen;
+ memcpy (req.gfid, inode->gfid, 16);
req.path = (char *)local->loc.path;
req.gfs_id = GFS3_OP_OPENDIR;
@@ -2336,8 +2250,7 @@ protocol_client_reopen (xlator_t *this, clnt_fd_ctx_t *fdctx)
path = NULL;
frame->local = local;
- req.ino = fdctx->ino;
- req.gen = fdctx->gen;
+ memcpy (req.gfid, inode->gfid, 16);
req.flags = gf_flags_from_flags (fdctx->flags);
req.wbflags = fdctx->wbflags;
req.path = (char *)local->loc.path;
@@ -2514,24 +2427,16 @@ client3_1_lookup (call_frame_t *frame, xlator_t *this,
goto unwind;
}
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
loc_copy (&local->loc, args->loc);
frame->local = local;
- if (args->loc->ino != 1 && args->loc->parent) {
- ret = inode_ctx_get2 (args->loc->parent, this,
- &req.par, &req.gen);
- if (args->loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "LOOKUP %"PRId64"/%s (%s): failed to get "
- "remote inode number for parent",
- args->loc->parent->ino, args->loc->name,
- args->loc->path);
- goto unwind;
- }
- GF_VALIDATE_OR_GOTO (this->name, args->loc->name, unwind);
- } else {
- req.ino = 1;
- }
+ if (args->loc->parent)
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
+ else
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
if (args->dict) {
content = dict_get (args->dict, GF_CONTENT_KEY);
@@ -2638,15 +2543,10 @@ client3_1_stat (call_frame_t *frame, xlator_t *this,
goto unwind;
args = data;
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.gfs_id = GFS3_OP_STAT;
conf = this->private;
@@ -2681,14 +2581,10 @@ client3_1_truncate (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.offset = args->offset;
req.gfs_id = GFS3_OP_TRUNCATE;
@@ -2786,14 +2682,10 @@ client3_1_access (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.mask = args->mask;
req.gfs_id = GFS3_OP_ACCESS;
@@ -2831,14 +2723,10 @@ client3_1_readlink (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.size = args->size;
req.gfs_id = GFS3_OP_READLINK;
@@ -2878,14 +2766,10 @@ client3_1_unlink (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->parent, this, &req.par, &req.gen);
- if (args->loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64"/%s (%s): "
- "failed to get remote inode number for parent",
- args->loc->parent->ino, args->loc->name, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.gfs_id = GFS3_OP_UNLINK;
@@ -2923,14 +2807,10 @@ client3_1_rmdir (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->parent, this, &req.par, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64"/%s (%s): "
- "failed to get remote inode number for parent",
- args->loc->parent->ino, args->loc->name, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.gfs_id = GFS3_OP_RMDIR;
@@ -2960,6 +2840,7 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this,
clnt_conf_t *conf = NULL;
clnt_args_t *args = NULL;
gfs3_symlink_req req = {0,};
+ size_t dict_len = 0;
int ret = 0;
int op_errno = ESTALE;
@@ -2973,23 +2854,30 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this,
goto unwind;
}
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
loc_copy (&local->loc, args->loc);
frame->local = local;
- ret = inode_ctx_get2 (args->loc->parent, this, &req.par, &req.gen);
- if (args->loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SYMLINK %"PRId64"/%s (%s): failed to get remote inode"
- " number parent",
- args->loc->parent->ino, args->loc->name,
- args->loc->path);
- goto unwind;
- }
-
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
req.path = (char *)args->loc->path;
req.linkname = (char *)args->linkname;
req.bname = (char *)args->loc->name;
req.gfs_id = GFS3_OP_SYMLINK;
+ if (args->dict) {
+ ret = dict_allocate_and_serialize (args->dict,
+ &req.dict.dict_val,
+ &dict_len);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict");
+ op_errno = EINVAL;
+ goto unwind;
+ }
+ }
+ req.dict.dict_len = dict_len;
+
conf = this->private;
ret = client_submit_request (this, &req, frame, conf->fops,
@@ -3000,6 +2888,9 @@ client3_1_symlink (call_frame_t *frame, xlator_t *this,
op_errno = ENOTCONN;
goto unwind;
}
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
unwind:
if (frame)
@@ -3009,6 +2900,9 @@ unwind:
if (local)
client_local_wipe (local);
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
}
@@ -3029,26 +2923,12 @@ client3_1_rename (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->oldloc->parent, this,
- &req.oldpar, &req.oldgen);
- if (args->oldloc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "RENAME %"PRId64"/%s (%s): failed to get remote inode "
- "number for source parent", args->oldloc->parent->ino,
- args->oldloc->name, args->oldloc->path);
- goto unwind;
- }
+ if (!(args->oldloc && args->newloc && args->oldloc->parent &&
+ args->newloc->parent))
+ goto unwind;
- ret = inode_ctx_get2 (args->newloc->parent, this, &req.newpar,
- &req.newgen);
- if (args->newloc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "CREATE %"PRId64"/%s (%s): failed to get remote inode "
- "number for destination parent",
- args->newloc->parent->ino, args->newloc->name,
- args->newloc->path);
- goto unwind;
- }
+ memcpy (req.oldgfid, args->oldloc->parent->gfid, 16);
+ memcpy (req.newgfid, args->newloc->parent->gfid, 16);
req.oldpath = (char *)args->oldloc->path;
req.oldbname = (char *)args->oldloc->name;
@@ -3089,6 +2969,13 @@ client3_1_link (call_frame_t *frame, xlator_t *this,
args = data;
+ if (!(args->oldloc && args->oldloc->inode && args->newloc &&
+ args->newloc->parent))
+ goto unwind;
+
+ memcpy (req.oldgfid, args->oldloc->inode->gfid, 16);
+ memcpy (req.newgfid, args->newloc->parent->gfid, 16);
+
local = GF_CALLOC (1, sizeof (*local), gf_client_mt_clnt_local_t);
if (!local) {
op_errno = ENOMEM;
@@ -3098,28 +2985,6 @@ client3_1_link (call_frame_t *frame, xlator_t *this,
loc_copy (&local->loc, args->oldloc);
frame->local = local;
- ret = inode_ctx_get2 (args->oldloc->inode, this,
- &req.oldino, &req.oldgen);
- if (args->oldloc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "RENAME %"PRId64"/%s (%s): failed to get remote inode "
- "number for source parent", args->oldloc->parent->ino,
- args->oldloc->name, args->oldloc->path);
- op_errno = ENOENT;
- goto unwind;
- }
-
- ret = inode_ctx_get2 (args->newloc->parent, this, &req.newpar,
- &req.newgen);
- if (args->newloc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "CREATE %"PRId64"/%s (%s): failed to get remote inode "
- "number for destination parent",
- args->newloc->parent->ino, args->newloc->name,
- args->newloc->path);
- goto unwind;
- }
-
req.oldpath = (char *)args->oldloc->path;
req.newpath = (char *)args->newloc->path;
req.newbname = (char *)args->newloc->name;
@@ -3149,6 +3014,7 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this,
clnt_conf_t *conf = NULL;
clnt_args_t *args = NULL;
gfs3_mknod_req req = {0,};
+ size_t dict_len = 0;
int ret = 0;
int op_errno = ESTALE;
@@ -3163,24 +3029,30 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this,
goto unwind;
}
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
loc_copy (&local->loc, args->loc);
frame->local = local;
- ret = inode_ctx_get2 (args->loc->parent, this, &req.par, &req.gen);
- if (args->loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SYMLINK %"PRId64"/%s (%s): failed to get remote inode"
- " number parent",
- args->loc->parent->ino, args->loc->name,
- args->loc->path);
- goto unwind;
- }
-
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
req.dev = args->rdev;
req.gfs_id = GFS3_OP_MKNOD;
+ if (args->dict) {
+ ret = dict_allocate_and_serialize (args->dict,
+ &req.dict.dict_val,
+ &dict_len);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict");
+ op_errno = EINVAL;
+ goto unwind;
+ }
+ }
+ req.dict.dict_len = dict_len;
conf = this->private;
@@ -3192,6 +3064,9 @@ client3_1_mknod (call_frame_t *frame, xlator_t *this,
op_errno = ENOTCONN;
goto unwind;
}
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
unwind:
if (frame)
@@ -3201,6 +3076,9 @@ unwind:
if (local)
client_local_wipe (local);
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
}
@@ -3214,6 +3092,7 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this,
clnt_conf_t *conf = NULL;
clnt_args_t *args = NULL;
gfs3_mkdir_req req = {0,};
+ size_t dict_len = 0;
int ret = 0;
int op_errno = ESTALE;
@@ -3228,23 +3107,29 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this,
goto unwind;
}
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
loc_copy (&local->loc, args->loc);
frame->local = local;
- ret = inode_ctx_get2 (args->loc->parent, this, &req.par, &req.gen);
- if (args->loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SYMLINK %"PRId64"/%s (%s): failed to get remote inode"
- " number parent",
- args->loc->parent->ino, args->loc->name,
- args->loc->path);
- goto unwind;
- }
-
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
req.gfs_id = GFS3_OP_MKDIR;
+ if (args->dict) {
+ ret = dict_allocate_and_serialize (args->dict,
+ &req.dict.dict_val,
+ &dict_len);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict");
+ op_errno = EINVAL;
+ goto unwind;
+ }
+ }
+ req.dict.dict_len = dict_len;
conf = this->private;
@@ -3256,6 +3141,9 @@ client3_1_mkdir (call_frame_t *frame, xlator_t *this,
op_errno = ENOTCONN;
goto unwind;
}
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
unwind:
if (frame)
@@ -3265,6 +3153,9 @@ unwind:
if (local)
client_local_wipe (local);
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
}
@@ -3277,6 +3168,7 @@ client3_1_create (call_frame_t *frame, xlator_t *this,
clnt_conf_t *conf = NULL;
clnt_args_t *args = NULL;
gfs3_create_req req = {0,};
+ size_t dict_len = 0;
int ret = 0;
int op_errno = ESTALE;
@@ -3290,26 +3182,33 @@ client3_1_create (call_frame_t *frame, xlator_t *this,
op_errno = ENOMEM;
goto unwind;
}
+ if (!(args->loc && args->loc->parent))
+ goto unwind;
+
local->fd = fd_ref (args->fd);
local->flags = args->flags;
+
loc_copy (&local->loc, args->loc);
frame->local = local;
- ret = inode_ctx_get2 (args->loc->parent, this, &req.par, &req.gen);
- if (args->loc->parent->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SYMLINK %"PRId64"/%s (%s): failed to get remote inode"
- " number parent",
- args->loc->parent->ino, args->loc->name,
- args->loc->path);
- goto unwind;
- }
-
+ memcpy (req.pargfid, args->loc->parent->gfid, 16);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
req.mode = args->mode;
req.flags = gf_flags_from_flags (args->flags);
req.gfs_id = GFS3_OP_CREATE;
+ if (args->dict) {
+ ret = dict_allocate_and_serialize (args->dict,
+ &req.dict.dict_val,
+ &dict_len);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get serialized length of dict");
+ op_errno = EINVAL;
+ goto unwind;
+ }
+ }
+ req.dict.dict_len = dict_len;
conf = this->private;
@@ -3321,6 +3220,9 @@ client3_1_create (call_frame_t *frame, xlator_t *this,
op_errno = ENOTCONN;
goto unwind;
}
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
unwind:
if (frame)
@@ -3330,6 +3232,9 @@ unwind:
NULL, NULL);
if (local)
client_local_wipe (local);
+ if (req.dict.dict_val) {
+ GF_FREE (req.dict.dict_val);
+ }
return 0;
}
@@ -3356,20 +3261,16 @@ client3_1_open (call_frame_t *frame, xlator_t *this,
op_errno = ENOMEM;
goto unwind;
}
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
local->fd = fd_ref (args->fd);
local->flags = args->flags;
local->wbflags = args->wbflags;
loc_copy (&local->loc, args->loc);
frame->local = local;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "OPEN %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.flags = gf_flags_from_flags (args->flags);
req.wbflags = args->wbflags;
req.path = (char *)args->loc->path;
@@ -3761,18 +3662,14 @@ client3_1_opendir (call_frame_t *frame, xlator_t *this,
op_errno = ENOMEM;
goto unwind;
}
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
local->fd = fd_ref (args->fd);
loc_copy (&local->loc, args->loc);
frame->local = local;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "OPEN %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.gfs_id = GFS3_OP_OPENDIR;
@@ -3872,22 +3769,10 @@ client3_1_statfs (call_frame_t *frame, xlator_t *this,
args = data;
- if (args->loc && args->loc->inode) {
- if (args->loc->inode->ino == 1) {
- req.ino = 1;
- req.gen = 0;
- } else {
- ret = inode_ctx_get2 (args->loc->inode, this,
- &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STATFS %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
- }
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.gfs_id = GFS3_OP_STATFS;
@@ -3925,14 +3810,10 @@ client3_1_setxattr (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SETXATTR %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
if (args->dict) {
ret = dict_allocate_and_serialize (args->dict,
&req.dict.dict_val,
@@ -4015,7 +3896,7 @@ client3_1_fsetxattr (call_frame_t *frame, xlator_t *this,
req.fd = fdctx->remote_fd;
req.flags = args->flags;
- req.ino = args->fd->inode->ino;
+ memcpy (req.gfid, args->fd->inode->gfid, 16);
req.gfs_id = GFS3_OP_FSETXATTR;
if (args->dict) {
@@ -4135,15 +4016,10 @@ client3_1_getxattr (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.namelen = 1; /* Use it as a flag */
req.path = (char *)args->loc->path;
req.name = (char *)args->name;
@@ -4189,14 +4065,10 @@ client3_1_xattrop (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "SETXATTR %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
if (args->dict) {
ret = dict_allocate_and_serialize (args->dict,
&req.dict.dict_val,
@@ -4278,9 +4150,9 @@ client3_1_fxattrop (call_frame_t *frame, xlator_t *this,
goto unwind;
}
- req.fd = fdctx->remote_fd;
- req.flags = args->flags;
- req.ino = args->fd->inode->ino;
+ req.fd = fdctx->remote_fd;
+ req.flags = args->flags;
+ memcpy (req.gfid, args->fd->inode->gfid, 16);
req.gfs_id = GFS3_OP_FXATTROP;
if (args->dict) {
@@ -4335,14 +4207,10 @@ client3_1_removexattr (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "REMOVEXATTR %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.name = (char *)args->name;
req.gfs_id = GFS3_OP_REMOVEXATTR;
@@ -4467,15 +4335,10 @@ client3_1_inodelk (call_frame_t *frame, xlator_t *this,
goto unwind;
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "INODELK %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
if (args->cmd == F_GETLK || args->cmd == F_GETLK64)
gf_cmd = GF_LK_GETLK;
else if (args->cmd == F_SETLK || args->cmd == F_SETLK64)
@@ -4631,14 +4494,10 @@ client3_1_entrylk (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.cmd = args->cmd_entrylk;
req.type = args->type;
@@ -4932,15 +4791,10 @@ client3_1_setattr (call_frame_t *frame, xlator_t *this,
args = data;
- ret = inode_ctx_get2 (args->loc->inode, this, &req.ino, &req.gen);
- if (args->loc->inode->ino && ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "STAT %"PRId64" (%s): "
- "failed to get remote inode number",
- args->loc->inode->ino, args->loc->path);
- op_errno = ENOENT;
- goto unwind;
- }
+ if (!(args->loc && args->loc->inode))
+ goto unwind;
+
+ memcpy (req.gfid, args->loc->inode->gfid, 16);
req.path = (char *)args->loc->path;
req.valid = args->valid;
gf_stat_from_iatt (&req.stbuf, args->stbuf);
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index eba34bdf768..1a489f6ef4c 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -150,9 +150,9 @@ resolve_deep_continue (call_frame_t *frame)
resolve->op_ret = 0;
resolve->op_errno = 0;
- if (resolve->par)
+ if (resolve->pargfid)
ret = resolve_entry_simple (frame);
- else if (resolve->ino)
+ else if (resolve->gfid)
ret = resolve_inode_simple (frame);
else if (resolve->path)
ret = resolve_path_simple (frame);
diff --git a/xlators/protocol/server/src/server.h b/xlators/protocol/server/src/server.h
index 453eee57e1c..a86c6b31824 100644
--- a/xlators/protocol/server/src/server.h
+++ b/xlators/protocol/server/src/server.h
@@ -126,6 +126,8 @@ typedef struct {
ino_t ino;
uint64_t gen;
ino_t par;
+ u_char gfid[16];
+ u_char pargfid[16];
char *path;
char *bname;
char *resolved;
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index 17348162824..ddcc423fd4e 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -2682,8 +2682,7 @@ server_stat (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.path = gf_strdup (args.path);
resolve_and_resume (frame, server_stat_resume);
@@ -2727,8 +2726,7 @@ server_setattr (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.path = gf_strdup (args.path);
gf_stat_to_iatt (&args.stbuf, &state->stbuf);
@@ -2818,8 +2816,7 @@ server_readlink (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.path = gf_strdup (args.path);
state->size = args.size;
@@ -2835,10 +2832,12 @@ server_create (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
call_frame_t *frame = NULL;
+ dict_t *params = NULL;
+ char *buf = NULL;
gfs3_create_req args = {0,};
char path[SERVER_PATH_MAX] = {0,};
char bname[SERVER_PATH_MAX] = {0,};
-
+ int ret = 0;
if (!req)
return 0;
@@ -2865,18 +2864,53 @@ server_create (rpcsvc_request_t *req)
req->rpc_err = GARBAGE_ARGS;
goto out;
}
+ if (args.dict.dict_len) {
+ /* Unserialize the dictionary */
+ params = dict_new ();
+
+ buf = memdup (args.dict.dict_val, args.dict.dict_len);
+ if (buf == NULL) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "out of memory");
+ goto out;
+ }
+
+ ret = dict_unserialize (buf, args.dict.dict_len,
+ &params);
+ if (ret < 0) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "%"PRId64": %s (%"PRId64"): failed to "
+ "unserialize req-buffer to dictionary",
+ frame->root->unique, state->resolve.path,
+ state->resolve.ino);
+ goto out;
+ }
+
+ state->dict = params;
+
+ params->extra_free = buf;
+
+ buf = NULL;
+ }
state->resolve.type = RESOLVE_NOT;
- state->resolve.par = args.par;
- state->resolve.gen = args.gen;
state->resolve.path = gf_strdup (args.path);
state->resolve.bname = gf_strdup (args.bname);
state->mode = args.mode;
state->flags = gf_flags_to_flags (args.flags);
+ memcpy (state->resolve.pargfid, args.pargfid, 16);
resolve_and_resume (frame, server_create_resume);
+ return 0;
out:
+ if (params)
+ dict_unref (params);
+
+ if (buf) {
+ GF_FREE (buf);
+ }
return 0;
+
}
@@ -2915,8 +2949,7 @@ server_open (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.path = gf_strdup (args.path);
state->flags = gf_flags_to_flags (args.flags);
@@ -3283,8 +3316,7 @@ server_truncate (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.path);
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->offset = args.offset;
resolve_and_resume (frame, server_truncate_resume);
@@ -3331,10 +3363,9 @@ server_unlink (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.par = args.par;
- state->resolve.gen = args.gen;
state->resolve.path = gf_strdup (args.path);
state->resolve.bname = gf_strdup (args.bname);
+ memcpy (state->resolve.pargfid, args.pargfid, 16);
resolve_and_resume (frame, server_unlink_resume);
out:
@@ -3386,9 +3417,8 @@ server_setxattr (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.path);
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
state->flags = args.flags;
+ memcpy (state->resolve.gfid, args.gfid, 16);
if (args.dict.dict_len) {
dict = dict_new ();
@@ -3547,10 +3577,8 @@ server_fxattrop (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.fd_no = args.fd;
-
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
state->flags = args.flags;
+ memcpy (state->resolve.gfid, args.gfid, 16);
if (args.dict.dict_len) {
/* Unserialize the dictionary */
@@ -3631,9 +3659,8 @@ server_xattrop (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.path);
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
state->flags = args.flags;
+ memcpy (state->resolve.gfid, args.gfid, 16);
if (args.dict.dict_len) {
/* Unserialize the dictionary */
@@ -3707,8 +3734,7 @@ server_getxattr (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.path);
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
if (args.namelen)
state->name = gf_strdup (args.name);
@@ -3802,8 +3828,7 @@ server_removexattr (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.path);
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->name = gf_strdup (args.name);
resolve_and_resume (frame, server_removexattr_resume);
@@ -3850,8 +3875,7 @@ server_opendir (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.path);
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
resolve_and_resume (frame, server_opendir_resume);
out:
@@ -4010,9 +4034,12 @@ server_mknod (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
call_frame_t *frame = NULL;
+ dict_t *params = NULL;
+ char *buf = NULL;
gfs3_mknod_req args = {0,};
char bname[SERVER_PATH_MAX] = {0,};
char path[SERVER_PATH_MAX] = {0,};
+ int ret = 0;
if (!req)
return 0;
@@ -4041,9 +4068,37 @@ server_mknod (rpcsvc_request_t *req)
goto out;
}
+ if (args.dict.dict_len) {
+ /* Unserialize the dictionary */
+ params = dict_new ();
+
+ buf = memdup (args.dict.dict_val, args.dict.dict_len);
+ if (buf == NULL) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "out of memory");
+ goto out;
+ }
+
+ ret = dict_unserialize (buf, args.dict.dict_len,
+ &params);
+ if (ret < 0) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "%"PRId64": %s (%"PRId64"): failed to "
+ "unserialize req-buffer to dictionary",
+ frame->root->unique, state->resolve.path,
+ state->resolve.ino);
+ goto out;
+ }
+
+ state->dict = params;
+
+ params->extra_free = buf;
+
+ buf = NULL;
+ }
+
state->resolve.type = RESOLVE_NOT;
- state->resolve.par = args.par;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.pargfid, args.pargfid, 16);
state->resolve.path = gf_strdup (args.path);
state->resolve.bname = gf_strdup (args.bname);
@@ -4051,8 +4106,16 @@ server_mknod (rpcsvc_request_t *req)
state->dev = args.dev;
resolve_and_resume (frame, server_mknod_resume);
+ return 0;
out:
+ if (params)
+ dict_unref (params);
+
+ if (buf) {
+ GF_FREE (buf);
+ }
return 0;
+
}
@@ -4061,9 +4124,12 @@ server_mkdir (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
call_frame_t *frame = NULL;
+ dict_t *params = NULL;
+ char *buf = NULL;
gfs3_mkdir_req args = {0,};
char bname[SERVER_PATH_MAX] = {0,};
char path[SERVER_PATH_MAX] = {0,};
+ int ret = 0;
if (!req)
return 0;
@@ -4091,18 +4157,53 @@ server_mkdir (rpcsvc_request_t *req)
req->rpc_err = GARBAGE_ARGS;
goto out;
}
+ if (args.dict.dict_len) {
+ /* Unserialize the dictionary */
+ params = dict_new ();
+
+ buf = memdup (args.dict.dict_val, args.dict.dict_len);
+ if (buf == NULL) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "out of memory");
+ goto out;
+ }
+
+ ret = dict_unserialize (buf, args.dict.dict_len,
+ &params);
+ if (ret < 0) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "%"PRId64": %s (%"PRId64"): failed to "
+ "unserialize req-buffer to dictionary",
+ frame->root->unique, state->resolve.path,
+ state->resolve.ino);
+ goto out;
+ }
+
+ state->dict = params;
+
+ params->extra_free = buf;
+
+ buf = NULL;
+ }
state->resolve.type = RESOLVE_NOT;
- state->resolve.par = args.par;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.pargfid, args.pargfid, 16);
state->resolve.path = gf_strdup (args.path);
state->resolve.bname = gf_strdup (args.bname);
state->mode = args.mode;
resolve_and_resume (frame, server_mkdir_resume);
+ return 0;
out:
+ if (params)
+ dict_unref (params);
+
+ if (buf) {
+ GF_FREE (buf);
+ }
return 0;
+
}
@@ -4143,8 +4244,7 @@ server_rmdir (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.par = args.par;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.pargfid, args.pargfid, 16);
state->resolve.path = gf_strdup (args.path);
state->resolve.bname = gf_strdup (args.bname);
@@ -4193,8 +4293,7 @@ server_inodelk (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_EXACT;
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.path = gf_strdup (args.path);
cmd = args.cmd;
@@ -4344,8 +4443,7 @@ server_entrylk (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_EXACT;
state->resolve.path = gf_strdup (args.path);
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
if (args.namelen)
state->name = gf_strdup (args.name);
@@ -4442,8 +4540,7 @@ server_access (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.ino = args.ino;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.path = gf_strdup (args.path);
state->mask = args.mask;
@@ -4459,10 +4556,13 @@ server_symlink (rpcsvc_request_t *req)
{
server_state_t *state = NULL;
call_frame_t *frame = NULL;
+ dict_t *params = NULL;
+ char *buf = NULL;
gfs3_symlink_req args = {0,};
char linkname[4096] = {0,};
char path[SERVER_PATH_MAX] = {0,};
char bname[4096] = {0,};
+ int ret = 0;
if (!req)
return 0;
@@ -4492,15 +4592,50 @@ server_symlink (rpcsvc_request_t *req)
goto out;
}
+ if (args.dict.dict_len) {
+ /* Unserialize the dictionary */
+ params = dict_new ();
+
+ buf = memdup (args.dict.dict_val, args.dict.dict_len);
+ if (buf == NULL) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "out of memory");
+ goto out;
+ }
+
+ ret = dict_unserialize (buf, args.dict.dict_len,
+ &params);
+ if (ret < 0) {
+ gf_log (state->conn->bound_xl->name, GF_LOG_ERROR,
+ "%"PRId64": %s (%"PRId64"): failed to "
+ "unserialize req-buffer to dictionary",
+ frame->root->unique, state->resolve.path,
+ state->resolve.ino);
+ goto out;
+ }
+
+ state->dict = params;
+
+ params->extra_free = buf;
+
+ buf = NULL;
+ }
+
state->resolve.type = RESOLVE_NOT;
- state->resolve.par = args.par;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.pargfid, args.pargfid, 16);
state->resolve.path = gf_strdup (args.path);
state->resolve.bname = gf_strdup (args.bname);
state->name = gf_strdup (args.linkname);
resolve_and_resume (frame, server_symlink_resume);
+ return 0;
out:
+ if (params)
+ dict_unref (params);
+
+ if (buf) {
+ GF_FREE (buf);
+ }
return 0;
}
@@ -4546,14 +4681,12 @@ server_link (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.oldpath);
- state->resolve.ino = args.oldino;
- state->resolve.gen = args.oldgen;
+ memcpy (state->resolve.gfid, args.oldgfid, 16);
state->resolve2.type = RESOLVE_NOT;
state->resolve2.path = gf_strdup (args.newpath);
state->resolve2.bname = gf_strdup (args.newbname);
- state->resolve2.par = args.newpar;
- state->resolve2.gen = args.newgen;
+ memcpy (state->resolve2.pargfid, args.newgfid, 16);
resolve_and_resume (frame, server_link_resume);
out:
@@ -4603,14 +4736,12 @@ server_rename (rpcsvc_request_t *req)
state->resolve.type = RESOLVE_MUST;
state->resolve.path = gf_strdup (args.oldpath);
state->resolve.bname = gf_strdup (args.oldbname);
- state->resolve.par = args.oldpar;
- state->resolve.gen = args.oldgen;
+ memcpy (state->resolve.pargfid, args.oldgfid, 16);
state->resolve2.type = RESOLVE_MAY;
state->resolve2.path = gf_strdup (args.newpath);
state->resolve2.bname = gf_strdup (args.newbname);
- state->resolve2.par = args.newpar;
- state->resolve2.gen = args.newgen;
+ memcpy (state->resolve2.pargfid, args.newgfid, 16);
resolve_and_resume (frame, server_rename_resume);
out:
@@ -4796,13 +4927,10 @@ server_lookup (rpcsvc_request_t *req)
req->rpc_err = GARBAGE_ARGS;
goto out;
}
- state->resolve.ino = args.ino;
- if (state->resolve.ino != 1)
- state->resolve.ino = 0;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.type = RESOLVE_DONTCARE;
- state->resolve.par = args.par;
- state->resolve.gen = args.gen;
+ memcpy (state->resolve.pargfid, args.pargfid, 16);
state->resolve.path = gf_strdup (args.path);
if (IS_NOT_ROOT (STRLEN_0 (args.path))) {
@@ -4889,9 +5017,7 @@ server_statfs (rpcsvc_request_t *req)
}
state->resolve.type = RESOLVE_MUST;
- state->resolve.ino = args.ino;
- if (!state->resolve.ino)
- state->resolve.ino = 1;
+ memcpy (state->resolve.gfid, args.gfid, 16);
state->resolve.gen = args.gen;
state->resolve.path = gf_strdup (args.path);