summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs3.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/nfs/server/src/nfs3.c')
-rw-r--r--xlators/nfs/server/src/nfs3.c593
1 files changed, 367 insertions, 226 deletions
diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c
index 4e03277b496..d66ac5d00b5 100644
--- a/xlators/nfs/server/src/nfs3.c
+++ b/xlators/nfs/server/src/nfs3.c
@@ -32,6 +32,7 @@
#include "nfs.h"
#include "xdr-rpc.h"
#include "xdr-generic.h"
+#include "nfs-messages.h"
#include <sys/socket.h>
#include <sys/uio.h>
@@ -42,8 +43,10 @@
do { \
if ((str)) { \
if (strlen ((str)) > (len)) { \
- gf_log (GF_NFS3, GF_LOG_ERROR, "strlen "\
- "too long"); \
+ gf_msg (GF_NFS3, GF_LOG_ERROR, \
+ ENAMETOOLONG, \
+ NFS_MSG_STR_TOO_LONG, \
+ "strlen too long"); \
status = NFS3ERR_NAMETOOLONG; \
retval = -ENAMETOOLONG; \
goto label; \
@@ -54,8 +57,9 @@
#define nfs3_validate_nfs3_state(request, state, status, label, retval) \
do { \
state = rpcsvc_request_program_private (request); \
- if (!state) { \
- gf_log (GF_NFS3, GF_LOG_ERROR, "NFSv3 state " \
+ if (!state) { \
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EFAULT, \
+ NFS_MSG_STATE_MISSING, "NFSv3 state " \
"missing from RPC request"); \
status = NFS3ERR_SERVERFAULT; \
ret = -EFAULT; \
@@ -80,7 +84,8 @@ __nfs3_get_export_by_index (struct nfs3_state *nfs3, uuid_t exportid)
}
exp = NULL;
- gf_log (GF_NFS, GF_LOG_ERROR, "searchindex=%d not found", searchindex);
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_INDEX_NOT_FOUND,
+ "searchindex=%d not found", searchindex);
found:
return exp;
}
@@ -130,7 +135,8 @@ nfs3_export_access (struct nfs3_state *nfs3, uuid_t exportid)
exp = __nfs3_get_export_by_exportid (nfs3, exportid);
if (!exp) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to get export by ID");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_EXPORT_ID_FAIL,
+ "Failed to get export by ID");
goto err;
}
@@ -143,7 +149,9 @@ err:
#define nfs3_check_rw_volaccess(nfs3state, exid, status, label) \
do { \
if (nfs3_export_access (nfs3state,exid)!=GF_NFS3_VOLACCESS_RW){\
- gf_log (GF_NFS3, GF_LOG_ERROR, "No read-write access");\
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EACCES, \
+ NFS_MSG_NO_RW_ACCESS, \
+ "No read-write access"); \
status = NFS3ERR_ROFS; \
goto label; \
} \
@@ -214,8 +222,8 @@ out:
rpc_transport_t *trans = NULL; \
volume = nfs3_fh_to_xlator ((nfs3state), handle); \
if (!volume) { \
- gf_uuid_unparse (handle->exportid, exportid); \
- gf_uuid_unparse (handle->gfid, gfid); \
+ gf_uuid_unparse (handle->exportid, exportid); \
+ gf_uuid_unparse (handle->gfid, gfid); \
trans = rpcsvc_request_transport (req); \
GF_LOG_OCCASIONALLY (nfs3state->occ_logger, \
GF_NFS3, GF_LOG_ERROR, "Failed to map " \
@@ -230,7 +238,7 @@ out:
status = NFS3ERR_STALE; \
goto label; \
} else { \
- gf_log (GF_NFS3, GF_LOG_TRACE, "FH to Volume:" \
+ gf_msg_trace (GF_NFS3, 0, "FH to Volume:" \
"%s", volume->name); \
rpcsvc_request_set_private (req, volume); \
} \
@@ -240,7 +248,9 @@ out:
#define nfs3_validate_gluster_fh(handle, status, errlabel) \
do { \
if (!nfs3_fh_validate (handle)) { \
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad Handle"); \
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, \
+ NFS_MSG_BAD_HANDLE, \
+ "Bad Handle"); \
status = NFS3ERR_BADHANDLE; \
goto errlabel; \
} \
@@ -261,13 +271,14 @@ out:
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
sprintf (buf, "(%s) %s : %s", \
trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", gfid); \
- gf_log (GF_NFS3, GF_LOG_ERROR, "Unable to resolve FH"\
- ": %s", buf); \
- nfstat = nfs3_errno_to_nfsstat3 (-auth_errno);\
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, \
+ NFS_MSG_RESOLVE_FH_FAIL, "Unable to " \
+ "resolve FH: %s", buf); \
+ nfstat = nfs3_errno_to_nfsstat3 (-auth_errno); \
goto erlabl; \
} \
} while (0) \
@@ -281,13 +292,15 @@ out:
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
- snprintf (buf, sizeof (buf), "(%s) %s : %s", \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
+ snprintf (buf, sizeof (buf), "(%s) %s : %s", \
trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", \
- gfid ); \
- gf_log (GF_NFS3, GF_LOG_ERROR, "%s: %s", \
- strerror(cst->resolve_errno), buf); \
+ gfid); \
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, \
+ NFS_MSG_RESOLVE_STAT, \
+ "%s: %s", strerror(cst->resolve_errno), \
+ buf); \
nfstat = nfs3_errno_to_nfsstat3 (cst->resolve_errno);\
goto erlabl; \
} \
@@ -303,12 +316,13 @@ out:
trans = rpcsvc_request_transport (cst->req); \
xlatorp = nfs3_fh_to_xlator (cst->nfs3state, \
&cst->resolvefh); \
- gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
- snprintf (buf, sizeof (buf), "(%s) %s : %s", \
- trans->peerinfo.identifier, \
+ gf_uuid_unparse (cst->resolvefh.gfid, gfid); \
+ snprintf (buf, sizeof (buf), "(%s) %s : %s", \
+ trans->peerinfo.identifier, \
xlatorp ? xlatorp->name : "ERR", \
- gfid); \
- gf_log (GF_NFS3, GF_LOG_ERROR, "%s: %s", \
+ gfid); \
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, \
+ NFS_MSG_RESOLVE_STAT, "%s: %s", \
strerror(cst->resolve_errno), buf); \
nfstat = nfs3_errno_to_nfsstat3 (cs->resolve_errno);\
goto erlabl; \
@@ -349,7 +363,7 @@ out:
goto erl; \
} \
\
- gf_uuid_copy ((fhd)->gfid, zero); \
+ gf_uuid_copy ((fhd)->gfid, zero); \
(fhd)->gfid[15] = 1; \
(enam) = NULL; \
if ((gf_nfs_dvm_off (nfs_state (nfs3st->nfsx)))) \
@@ -366,8 +380,10 @@ out:
#define nfs3_volume_started_check(nf3stt, vlm, rtval, erlbl) \
do { \
if ((!nfs_subvolume_started (nfs_state (nf3stt->nfsx), vlm))){\
- gf_log (GF_NFS3, GF_LOG_ERROR, "Volume is disabled: %s",\
- vlm->name); \
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, \
+ NFS_MSG_VOL_DISABLE, \
+ "Volume is disabled: %s", \
+ vlm->name); \
rtval = RPCSVC_ACTOR_IGNORE; \
goto erlbl; \
} \
@@ -442,7 +458,8 @@ nfs3_call_state_init (struct nfs3_state *s, rpcsvc_request_t *req, xlator_t *v)
cs = (nfs3_call_state_t *) mem_get (s->localpool);
if (!cs) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "out of memory");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY,
+ "out of memory");
return NULL;
}
@@ -465,7 +482,7 @@ nfs3_call_state_wipe (nfs3_call_state_t *cs)
return;
if (cs->fd) {
- gf_log (GF_NFS3, GF_LOG_TRACE, "fd 0x%lx ref: %d",
+ gf_msg_trace (GF_NFS3, 0, "fd 0x%lx ref: %d",
(long)cs->fd, cs->fd->refcount);
fd_unref (cs->fd);
}
@@ -495,8 +512,9 @@ nfs3_call_state_wipe (nfs3_call_state_t *cs)
do { \
calls = nfs3_call_state_init ((nfs3state), (rq), (vl)); \
if (!calls) { \
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to " \
- "init call state"); \
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, \
+ NFS_MSG_INIT_CALL_STAT_FAIL, "Failed to"\
+ " init call state"); \
opstat = NFS3ERR_SERVERFAULT; \
goto errlabel; \
} \
@@ -514,8 +532,8 @@ nfs3_serialize_reply (rpcsvc_request_t *req, void *arg, nfs3_serializer sfunc,
nfs3 = (struct nfs3_state *)rpcsvc_request_program_private (req);
if (!nfs3) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "NFSv3 state not found in RPC"
- " request");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_STATE_MISSING,
+ "NFSv3 state not found in RPC request");
goto ret;
}
@@ -526,7 +544,8 @@ nfs3_serialize_reply (rpcsvc_request_t *req, void *arg, nfs3_serializer sfunc,
can have 'xdr_sizeof' */
iob = iobuf_get (nfs3->iobpool);
if (!iob) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to get iobuf");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY,
+ "Failed to get iobuf");
goto ret;
}
@@ -539,7 +558,8 @@ nfs3_serialize_reply (rpcsvc_request_t *req, void *arg, nfs3_serializer sfunc,
*/
retlen = sfunc (*outmsg, arg);
if (retlen == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to encode message");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ENCODE_FAIL,
+ "Failed to encode message");
goto ret;
}
@@ -569,26 +589,30 @@ nfs3svc_submit_reply (rpcsvc_request_t *req, void *arg, nfs3_serializer sfunc)
iob = nfs3_serialize_reply (req, arg, sfunc, &outmsg);
if (!iob) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to serialize reply");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SERIALIZE_REPLY_FAIL,
+ "Failed to serialize reply");
goto ret;
}
iobref = iobref_new ();
if (!iobref) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "failed on iobref_new()");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY,
+ "failed on iobref_new()");
goto ret;
}
ret = iobref_add (iobref, iob);
if (ret) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to add iob to iobref");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY,
+ "Failed to add iob to iobref");
goto ret;
}
/* Then, submit the message for transmission. */
ret = rpcsvc_submit_message (req, &outmsg, 1, NULL, 0, iobref);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Reply submission failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SUBMIT_REPLY_FAIL,
+ "Reply submission failed");
goto ret;
}
@@ -621,13 +645,15 @@ nfs3svc_submit_vector_reply (rpcsvc_request_t *req, void *arg,
iob = nfs3_serialize_reply (req, arg, sfunc, &outmsg);
if (!iob) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to serialize reply");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SERIALIZE_REPLY_FAIL,
+ "Failed to serialize reply");
goto ret;
}
if (iobref == NULL) {
iobref = iobref_new ();
if (!iobref) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "failed on iobref_new");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM,
+ NFS_MSG_NO_MEMORY, "failed on iobref_new");
goto ret;
}
new_iobref = 1;
@@ -635,14 +661,16 @@ nfs3svc_submit_vector_reply (rpcsvc_request_t *req, void *arg,
ret = iobref_add (iobref, iob);
if (ret) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to add iob to iobref");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY,
+ "Failed to add iob to iobref");
goto ret;
}
/* Then, submit the message for transmission. */
ret = rpcsvc_submit_message (req, &outmsg, 1, payload, vcount, iobref);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Reply submission failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SUBMIT_REPLY_FAIL,
+ "Reply submission failed");
goto ret;
}
@@ -727,9 +755,10 @@ nfs3svc_getattr_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
*/
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_GETATTR_LOOKUP_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
status = nfs3_cbk_errno_status (op_ret, op_errno);
}
else {
@@ -757,9 +786,10 @@ nfs3svc_getattr_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_GETATTR_STAT_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
status = nfs3_cbk_errno_status (op_ret, op_errno);
}
@@ -833,8 +863,9 @@ nfs3_getattr_resume (void *carg)
check_err:
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Stat fop failed: %s: %s",
- cs->oploc.path, strerror (-ret));
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret, NFS_MSG_STAT_FOP_FAIL,
+ "Stat fop failed: %s: %s", cs->oploc.path,
+ strerror (-ret));
stat = nfs3_errno_to_nfsstat3 (-ret);
}
@@ -899,14 +930,16 @@ nfs3svc_getattr (rpcsvc_request_t *req)
nfs3_prep_getattr3args (&args, &fh);
if (xdr_to_getattr3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_getattr (req, &fh);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "GETATTR procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret, NFS_MSG_GETATTR_FAIL,
+ "GETATTR procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -942,7 +975,7 @@ nfs3svc_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_TRUNCATE_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -982,7 +1015,7 @@ nfs3svc_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_SETATTR_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -1038,15 +1071,17 @@ nfs3svc_setattr_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_SETATTR_STAT_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
goto nfs3err;
}
if (buf->ia_ctime != cs->timestamp.seconds) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Timestamps not in sync");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_TIMESTAMP_NO_SYNC,
+ "Timestamps not in sync");
stat = NFS3ERR_NOT_SYNC;
goto nfs3err;
}
@@ -1130,18 +1165,19 @@ nfs3_setattr (rpcsvc_request_t *req, struct nfs3_fh *fh, sattr3 *sattr,
cs->setattr_valid = nfs3_sattr3_to_setattr_valid (sattr, &cs->stbuf,
NULL);
if (guard->check) {
- gf_log (GF_NFS3, GF_LOG_TRACE, "Guard check required");
+ gf_msg_trace (GF_NFS3, 0, "Guard check required");
cs->timestamp = guard->sattrguard3_u.obj_ctime;
cs->sattrguardcheck = 1;
} else {
- gf_log (GF_NFS3, GF_LOG_TRACE, "Guard check not required");
+ gf_msg_trace (GF_NFS3, 0, "Guard check not required");
cs->sattrguardcheck = 0;
}
if (!cs->setattr_valid) {
ret = -EINVAL; /* Force a reply */
stat = NFS3_OK;
- gf_log (GF_NFS3, GF_LOG_ERROR, "cs->setattr_valid is invalid");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_SETATTR_INVALID,
+ "cs->setattr_valid is invalid");
goto nfs3err;
}
@@ -1177,14 +1213,17 @@ nfs3svc_setattr (rpcsvc_request_t *req)
nfs3_prep_setattr3args (&args, &fh);
if (xdr_to_setattr3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0,
+ NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_setattr (req, &fh, &args.new_attributes, &args.guard);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "SETATTR procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret, NFS_MSG_SETATTR_FAIL,
+ "SETATTR procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -1219,7 +1258,7 @@ nfs3_fresh_lookup (nfs3_call_state_t *cs)
char *oldresolventry = NULL;
GF_VALIDATE_OR_GOTO (GF_NFS3, cs, err);
- gf_log (GF_NFS3, GF_LOG_DEBUG, "inode needs fresh lookup");
+ gf_msg_debug (GF_NFS3, 0, "inode needs fresh lookup");
inode_unlink (cs->resolvedloc.inode, cs->resolvedloc.parent,
cs->resolventry);
nfs_loc_wipe (&cs->resolvedloc);
@@ -1251,10 +1290,16 @@ nfs3svc_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS,
- (op_errno == ENOENT ? GF_LOG_TRACE : GF_LOG_WARNING),
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ if (op_errno == ENOENT) {
+ gf_msg_trace (GF_NFS, 0, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req),
+ cs->resolvedloc.path, strerror (op_errno));
+ } else {
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_SVC_LOOKUP, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req),
+ cs->resolvedloc.path, strerror (op_errno));
+ }
status = nfs3_cbk_errno_status (op_ret, op_errno);
goto xmit_res;
}
@@ -1297,9 +1342,10 @@ nfs3svc_lookup_parentdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_SVC_PAR_LOOKUP, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
status = nfs3_cbk_errno_status (op_ret, op_errno);
goto xmit_res;
}
@@ -1343,8 +1389,8 @@ nfs3_lookup_parentdir_resume (void *carg)
inode_t *parent = NULL;
if (!carg) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Invalid argument,"
- " carg value NULL");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Invalid argument, carg value NULL");
return EINVAL;
}
@@ -1382,7 +1428,9 @@ nfs3_lookup_parentdir_resume (void *carg)
NFS_RESOLVE_CREATE);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "nfs_inode_loc_fill"
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_INODE_LOC_FILL_ERROR,
+ "nfs_inode_loc_fill"
" error");
goto errtostat;
}
@@ -1419,8 +1467,8 @@ nfs3_lookup_resume (void *carg)
struct nfs3_fh newfh = {{0},};
if (!carg) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Invalid argument,"
- " carg value NULL");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Invalid argument, carg value NULL");
return EINVAL;
}
@@ -1484,7 +1532,9 @@ nfs3_lookup (rpcsvc_request_t *req, struct nfs3_fh *fh, int fhlen, char *name)
nfs3_lookup_resume);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "failed to start hard reslove");
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret,
+ NFS_MSG_HARD_RESOLVE_FAIL,
+ "failed to start hard reslove");
stat = nfs3_errno_to_nfsstat3 (-ret);
}
@@ -1517,14 +1567,17 @@ nfs3svc_lookup (rpcsvc_request_t *req)
nfs3_prep_lookup3args (&args, &fh, name);
if (xdr_to_lookup3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_lookup (req, &fh, args.what.dir.data.data_len, name);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "LOOKUP procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_LOOKUP_PROC_FAIL,
+ "LOOKUP procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -1557,7 +1610,7 @@ nfs3svc_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_ACCESS_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
status = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -1580,8 +1633,8 @@ nfs3_access_resume (void *carg)
nfs3_call_state_t *cs = NULL;
if (!carg) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Invalid argument,"
- " carg value NULL");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Invalid argument, carg value NULL");
return EINVAL;
}
@@ -1667,14 +1720,17 @@ nfs3svc_access (rpcsvc_request_t *req)
nfs3_prep_access3args (&args, &fh);
if (xdr_to_access3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_access (req, &fh, args.access);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "ACCESS procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_ACCESS_PROC_FAIL,
+ "ACCESS procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -1710,7 +1766,7 @@ nfs3svc_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_READLINK_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -1771,7 +1827,8 @@ nfs3_readlink (rpcsvc_request_t *req, struct nfs3_fh *fh)
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -1814,14 +1871,17 @@ nfs3svc_readlink (rpcsvc_request_t *req)
nfs3_prep_readlink3args (&args, &fh);
if (xdr_to_readlink3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_readlink (req, &fh);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "READLINK procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_READLINK_PROC_FAIL,
+ "READLINK procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -1878,7 +1938,7 @@ nfs3svc_read_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_READ_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -1946,7 +2006,8 @@ nfs3_read_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
fd = fd_anonymous (cs->resolvedloc.inode);
if (!fd) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to create anonymous fd");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ANONYMOUS_FD_FAIL,
+ "Failed to create anonymous fd");
goto nfs3err;
}
@@ -1975,7 +2036,8 @@ nfs3_read (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -2018,14 +2080,17 @@ nfs3svc_read (rpcsvc_request_t *req)
nfs3_prep_read3args (&args, &fh);
if (xdr_to_read3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_read (req, &fh, args.offset, args.count);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "READ procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_READ_FAIL,
+ "READ procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -2065,7 +2130,7 @@ nfs3svc_write_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
nfs3 = rpcsvc_request_program_private (cs->req);
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_FSYNC_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -2125,7 +2190,7 @@ nfs3svc_write_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
nfs3 = rpcsvc_request_program_private (cs->req);
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_WRITE_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -2194,7 +2259,8 @@ nfs3_write_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
fd = fd_anonymous (cs->resolvedloc.inode);
if (!fd) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to create anonymous fd");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ANONYMOUS_FD_FAIL,
+ "Failed to create anonymous fd");
goto nfs3err;
}
@@ -2245,7 +2311,8 @@ nfs3_write (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh) || (!payload.iov_base)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -2309,7 +2376,8 @@ nfs3svc_write_vecsizer (int state, ssize_t *readsize, char *base_addr,
ret = 0;
*readsize = 0;
} else
- gf_log ("nfs", GF_LOG_ERROR, "state wrong");
+ gf_msg ("nfs", GF_LOG_ERROR, 0, NFS_MSG_STATE_WRONG,
+ "state wrong");
return ret;
}
@@ -2326,7 +2394,8 @@ nfs3svc_write (rpcsvc_request_t *req)
return ret;
nfs3_prep_write3args (&args, &fh);
if (xdr_to_write3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
@@ -2340,7 +2409,9 @@ nfs3svc_write (rpcsvc_request_t *req)
ret = nfs3_write (req, &fh, args.offset, args.count, args.stable,
req->msg[1], rpcsvc_request_iobref_ref (req));
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "WRITE procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_WRITE_FAIL,
+ "WRITE procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -2377,9 +2448,10 @@ nfs3svc_create_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_CREATE_SETATTR_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
goto nfs3err;
}
@@ -2410,7 +2482,7 @@ nfs3svc_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_CREATE_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -2514,9 +2586,10 @@ nfs3svc_create_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
nfs_request_user_init (&nfu, cs->req);
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_CREATE_STAT_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
ret = -op_errno;
stat = nfs3_cbk_errno_status (op_ret, op_errno);
goto nfs3err;
@@ -2524,13 +2597,13 @@ nfs3svc_create_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if ((cs->stbuf.ia_mtime == buf->ia_mtime) &&
(cs->stbuf.ia_atime == buf->ia_atime)) {
- gf_log (GF_NFS3, GF_LOG_DEBUG,
+ gf_msg_debug (GF_NFS3, 0,
"Create req retransmitted verf %x %x",
cs->stbuf.ia_mtime, cs->stbuf.ia_atime);
stat = NFS3_OK;
nfs3_fh_build_child_fh (&cs->parent, buf, &cs->fh);
} else {
- gf_log (GF_NFS3, GF_LOG_DEBUG,
+ gf_msg_debug (GF_NFS3, 0,
"File already exist new_verf %x %x"
"old_verf %x %x", cs->stbuf.ia_mtime,
cs->stbuf.ia_atime,
@@ -2684,7 +2757,8 @@ nfs3svc_create (rpcsvc_request_t *req)
nfs3_prep_create3args (&args, &dirfh, name);
if (xdr_to_create3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
@@ -2695,7 +2769,8 @@ nfs3svc_create (rpcsvc_request_t *req)
ret = nfs3_create (req, &dirfh, name, args.how.mode,
&args.how.createhow3_u.obj_attributes, cverf);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "CREATE procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret, NFS_MSG_CREATE_FAIL,
+ "CREATE procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -2731,9 +2806,10 @@ nfs3svc_mkdir_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_MKDIR_SETATTR_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
goto nfs3err;
}
@@ -2763,7 +2839,7 @@ nfs3svc_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_MKDIR_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -2849,7 +2925,8 @@ nfs3_mkdir (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!dirfh) || (!name) || (!sattr)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -2895,14 +2972,16 @@ nfs3svc_mkdir (rpcsvc_request_t *req)
return ret;
nfs3_prep_mkdir3args (&args, &dirfh, name);
if (xdr_to_mkdir3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_mkdir (req, &dirfh, name, &args.attributes);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "MKDIR procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret, NFS_MSG_DIR_OP_FAIL,
+ "MKDIR procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -2941,7 +3020,7 @@ nfs3svc_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_SYMLINK_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -3003,7 +3082,8 @@ nfs3_symlink (rpcsvc_request_t *req, struct nfs3_fh *dirfh, char *name,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!dirfh) || (!name) || (!target) || (!sattr)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -3058,7 +3138,8 @@ nfs3svc_symlink (rpcsvc_request_t *req)
return ret;
nfs3_prep_symlink3args (&args, &dirfh, name, target);
if (xdr_to_symlink3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
@@ -3066,7 +3147,8 @@ nfs3svc_symlink (rpcsvc_request_t *req)
ret = nfs3_symlink (req, &dirfh, name, target,
&args.symlink.symlink_attributes);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "SYMLINK procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EXDEV, NFS_MSG_SYMLINK_FAIL,
+ "SYMLINK procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -3103,7 +3185,7 @@ nfs3svc_mknod_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_MKNOD_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -3135,7 +3217,7 @@ nfs3svc_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_MKNOD_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -3282,7 +3364,8 @@ nfs3_mknod (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name,
sattr3 *sattr = NULL;
if ((!req) || (!fh) || (!name) || (!nodedata)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -3351,14 +3434,16 @@ nfs3svc_mknod (rpcsvc_request_t *req)
return ret;
nfs3_prep_mknod3args (&args, &fh, name);
if (xdr_to_mknod3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_mknod (req, &fh, name, &args.what);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "MKNOD procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret, NFS_MSG_MKNOD_FAIL,
+ "MKNOD procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -3393,7 +3478,7 @@ nfs3svc_remove_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_REMOVE_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -3471,7 +3556,8 @@ nfs3_remove (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name)
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh) || (!name)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -3517,14 +3603,16 @@ nfs3svc_remove (rpcsvc_request_t *req)
return ret;
nfs3_prep_remove3args (&args, &fh, name);
if (xdr_to_remove3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_remove (req, &fh, name);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "REMOVE procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_REMOVE_FAIL,
+ "REMOVE procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -3559,7 +3647,7 @@ nfs3svc_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_RMDIR_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -3617,7 +3705,8 @@ nfs3_rmdir (rpcsvc_request_t *req, struct nfs3_fh *fh, char *name)
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh) || (!name)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -3663,14 +3752,16 @@ nfs3svc_rmdir (rpcsvc_request_t *req)
return ret;
nfs3_prep_rmdir3args (&args, &fh, name);
if (xdr_to_rmdir3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_rmdir (req, &fh, name);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "RMDIR procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret, NFS_MSG_DIR_OP_FAIL,
+ "RMDIR procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -3713,7 +3804,7 @@ nfs3svc_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_RENAME_CBK,
"%x: rename %s -> %s => -1 (%s)",
rpcsvc_request_xid (cs->req), cs->oploc.path,
cs->resolvedloc.path, strerror (op_errno));
@@ -3812,7 +3903,8 @@ nfs3_rename (rpcsvc_request_t *req, struct nfs3_fh *olddirfh, char *oldname,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!olddirfh) || (!oldname) || (!newdirfh) || (!newname)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -3874,14 +3966,16 @@ nfs3svc_rename (rpcsvc_request_t *req)
return ret;
nfs3_prep_rename3args (&args, &olddirfh, oldname, &newdirfh, newname);
if (xdr_to_rename3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_rename (req, &olddirfh, oldname, &newdirfh, newname);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "RENAME procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_RENAME_FAIL,
+ "RENAME procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -3918,7 +4012,7 @@ nfs3svc_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_LINK_CBK,
"%x: link %s <- %s => -1 (%s)",
rpcsvc_request_xid (cs->req), cs->oploc.path,
cs->resolvedloc.path, strerror (op_errno));
@@ -4009,7 +4103,8 @@ nfs3_link (rpcsvc_request_t *req, struct nfs3_fh *targetfh,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!targetfh) || (!dirfh) || (!newname)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -4063,14 +4158,16 @@ nfs3svc_link (rpcsvc_request_t *req)
return ret;
nfs3_prep_link3args (&args, &targetfh, &dirfh, newpath);
if (xdr_to_link3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_link (req, &targetfh, &dirfh, newpath);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "LINK procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EXDEV, NFS_MSG_LINK_FAIL,
+ "LINK procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -4129,7 +4226,8 @@ nfs3svc_readdir_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_READDIR_FSTAT_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -4140,7 +4238,7 @@ nfs3svc_readdir_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
* readdir'ing.
*/
if (cs->operrno == ENOENT) {
- gf_log (GF_NFS3, GF_LOG_TRACE, "Reached end-of-directory");
+ gf_msg_trace (GF_NFS3, 0, "Reached end-of-directory");
is_eof = 1;
}
@@ -4188,7 +4286,7 @@ nfs3svc_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_READDIR_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -4320,7 +4418,8 @@ nfs3_readdir_open_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
cs->fd = fd_anonymous (cs->resolvedloc.inode);
if (!cs->fd) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Faile to create anonymous fd");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ANONYMOUS_FD_FAIL,
+ "Fail to create anonymous fd");
goto nfs3err;
}
@@ -4336,7 +4435,9 @@ nfs3_readdir_open_resume (void *carg)
ret = nfs_opendir (cs->nfsx, cs->vol, &nfu, &cs->resolvedloc,
nfs3svc_readdir_opendir_cbk, cs);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "auto-opendir failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_DIR_OP_FAIL,
+ "auto-opendir failed");
}
}
@@ -4376,7 +4477,8 @@ nfs3_readdir (rpcsvc_request_t *req, struct nfs3_fh *fh, cookie3 cookie,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -4435,7 +4537,8 @@ nfs3svc_readdir (rpcsvc_request_t *req)
return ret;
nfs3_prep_readdir3args (&ra, &fh);
if (xdr_to_readdir3args (req->msg[0], &ra) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
@@ -4444,7 +4547,9 @@ nfs3svc_readdir (rpcsvc_request_t *req)
ret = nfs3_readdir (req, &fh, ra.cookie, verf, ra.count, 0);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "READDIR procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_READDIR_FAIL,
+ "READDIR procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -4467,7 +4572,8 @@ nfs3svc_readdirp (rpcsvc_request_t *req)
return ret;
nfs3_prep_readdirp3args (&ra, &fh);
if (xdr_to_readdirp3args (req->msg[0], &ra) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
@@ -4477,7 +4583,9 @@ nfs3svc_readdirp (rpcsvc_request_t *req)
ret = nfs3_readdir (req, &fh, ra.cookie, cverf, ra.dircount,
ra.maxcount);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "READDIRP procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_READDIRP_FAIL,
+ "READDIRP procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -4512,9 +4620,10 @@ nfs3_fsstat_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_FSSTAT_STAT_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
} else
stat = NFS3_OK;
@@ -4539,9 +4648,10 @@ nfs3_fsstat_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
- "%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
- cs->resolvedloc.path, strerror (op_errno));
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno,
+ NFS_MSG_FSSTAT_STATFS_CBK, "%x: %s => -1 (%s)",
+ rpcsvc_request_xid (cs->req), cs->resolvedloc.path,
+ strerror (op_errno));
ret = -op_errno;
stat = nfs3_cbk_errno_status (op_ret, op_errno);
goto err;
@@ -4612,7 +4722,8 @@ nfs3_fsstat (rpcsvc_request_t *req, struct nfs3_fh *fh)
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -4654,14 +4765,16 @@ nfs3svc_fsstat (rpcsvc_request_t *req)
return ret;
nfs3_prep_fsstat3args (&args, &fh);
if (xdr_to_fsstat3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_fsstat (req, &fh);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "FSTAT procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_FSTAT_FAIL,
+ "FSTAT procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -4699,7 +4812,7 @@ nfs3svc_fsinfo_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_FSINFO_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
status = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -4759,7 +4872,8 @@ nfs3_fsinfo (rpcsvc_request_t *req, struct nfs3_fh *fh)
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -4799,14 +4913,16 @@ nfs3svc_fsinfo (rpcsvc_request_t *req)
nfs3_prep_fsinfo3args (&args, &root);
if (xdr_to_fsinfo3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding arguments");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_fsinfo (req, &root);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "FSINFO procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_FSINFO_FAIL,
+ "FSINFO procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -4841,7 +4957,7 @@ nfs3svc_pathconf_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_PATHCONF_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -4901,7 +5017,8 @@ nfs3_pathconf (rpcsvc_request_t *req, struct nfs3_fh *fh)
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -4943,14 +5060,17 @@ nfs3svc_pathconf (rpcsvc_request_t *req)
return ret;
nfs3_prep_pathconf3args (&args, &fh);
if (xdr_to_pathconf3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_pathconf (req, &fh);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "PATHCONF procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, -ret,
+ NFS_MSG_PATHCONF_FAIL,
+ "PATHCONF procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -4985,7 +5105,7 @@ nfs3svc_commit_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
cs = frame->local;
if (op_ret == -1) {
- gf_log (GF_NFS, GF_LOG_WARNING,
+ gf_msg (GF_NFS, GF_LOG_WARNING, op_errno, NFS_MSG_COMMIT_CBK,
"%x: %s => -1 (%s)", rpcsvc_request_xid (cs->req),
cs->resolvedloc.path, strerror (op_errno));
stat = nfs3_cbk_errno_status (op_ret, op_errno);
@@ -5055,7 +5175,8 @@ nfs3_commit_open_resume (void *carg)
nfs3_check_fh_resolve_status (cs, stat, nfs3err);
cs->fd = fd_anonymous (cs->resolvedloc.inode);
if (!cs->fd) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to create anonymous fd.");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ANONYMOUS_FD_FAIL,
+ "Failed to create anonymous fd.");
goto nfs3err;
}
@@ -5086,7 +5207,8 @@ nfs3_commit (rpcsvc_request_t *req, struct nfs3_fh *fh, offset3 offset,
nfs3_call_state_t *cs = NULL;
if ((!req) || (!fh)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Bad arguments");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, EINVAL, NFS_MSG_INVALID_ENTRY,
+ "Bad arguments");
return -1;
}
@@ -5131,14 +5253,16 @@ nfs3svc_commit (rpcsvc_request_t *req)
return ret;
nfs3_prep_commit3args (&args, &fh);
if (xdr_to_commit3args (req->msg[0], &args) <= 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Error decoding args");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_ARGS_DECODE_ERROR,
+ "Error decoding args");
rpcsvc_request_seterr (req, GARBAGE_ARGS);
goto rpcerr;
}
ret = nfs3_commit (req, &fh, args.offset, args.count);
if ((ret < 0) && (ret != RPCSVC_ACTOR_IGNORE)) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "COMMIT procedure failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_COMMIT_FAIL,
+ "COMMIT procedure failed");
rpcsvc_request_seterr (req, SYSTEM_ERR);
ret = RPCSVC_ACTOR_ERROR;
}
@@ -5230,16 +5354,16 @@ nfs3_init_options (struct nfs3_state *nfs3, dict_t *options)
if (dict_get (options, "nfs3.read-size")) {
ret = dict_get_str (options, "nfs3.read-size", &optstr);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to read "
- " option: nfs3.read-size");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: nfs3.read-size");
ret = -1;
goto err;
}
ret = gf_string2uint64 (optstr, &size64);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format"
- " option: nfs3.read-size");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_FORMAT_FAIL,
+ "Failed to format option: nfs3.read-size");
ret = -1;
goto err;
}
@@ -5253,16 +5377,16 @@ nfs3_init_options (struct nfs3_state *nfs3, dict_t *options)
if (dict_get (options, "nfs3.write-size")) {
ret = dict_get_str (options, "nfs3.write-size", &optstr);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to read "
- " option: nfs3.write-size");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: nfs3.write-size");
ret = -1;
goto err;
}
ret = gf_string2uint64 (optstr, &size64);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format"
- " option: nfs3.write-size");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_FORMAT_FAIL,
+ "Failed to format option: nfs3.write-size");
ret = -1;
goto err;
}
@@ -5276,16 +5400,16 @@ nfs3_init_options (struct nfs3_state *nfs3, dict_t *options)
if (dict_get (options, "nfs3.readdir-size")) {
ret = dict_get_str (options,"nfs3.readdir-size", &optstr);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to read"
- " option: nfs3.readdir-size");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: nfs3.readdir-size");
ret = -1;
goto err;
}
ret = gf_string2uint64 (optstr, &size64);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format"
- " option: nfs3.readdir-size");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_FORMAT_FAIL,
+ "Failed to format option: nfs3.readdir-size");
ret = -1;
goto err;
}
@@ -5340,7 +5464,8 @@ nfs3_init_subvolume_options (xlator_t *nfsx,
ret = snprintf (searchkey, 1024, "nfs3.%s.volume-id",exp->subvol->name);
if (ret < 0) {
- gf_log (GF_MNT, GF_LOG_ERROR, "snprintf failed");
+ gf_msg (GF_MNT, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
+ "snprintf failed");
ret = -1;
goto err;
}
@@ -5348,14 +5473,15 @@ nfs3_init_subvolume_options (xlator_t *nfsx,
if (dict_get (options, searchkey)) {
ret = dict_get_str (options, searchkey, &optstr);
if (ret < 0) {
- gf_log (GF_MNT, GF_LOG_ERROR, "Failed to read option"
- ": %s", searchkey);
+ gf_msg (GF_MNT, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: %s", searchkey);
ret = -1;
goto err;
}
} else {
- gf_log (GF_MNT, GF_LOG_ERROR, "DVM is on but volume-id not "
- "given for volume: %s", exp->subvol->name);
+ gf_msg (GF_MNT, GF_LOG_ERROR, 0, NFS_MSG_VOLID_MISSING, "DVM is"
+ " on but volume-id not given for volume: %s",
+ exp->subvol->name);
ret = -1;
goto err;
}
@@ -5363,8 +5489,9 @@ nfs3_init_subvolume_options (xlator_t *nfsx,
if (optstr) {
ret = gf_uuid_parse (optstr, volumeid);
if (ret < 0) {
- gf_log (GF_MNT, GF_LOG_ERROR, "Failed to parse volume "
- "UUID");
+ gf_msg (GF_MNT, GF_LOG_ERROR, 0,
+ NFS_MSG_PARSE_VOL_UUID_FAIL,
+ "Failed to parse volume UUID");
ret = -1;
goto err;
}
@@ -5376,7 +5503,8 @@ no_dvm:
name = exp->subvol->name;
ret = snprintf (searchkey, 1024, "nfs3.%s.volume-access", name);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "snprintf failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
+ "snprintf failed");
ret = -1;
goto err;
}
@@ -5385,8 +5513,8 @@ no_dvm:
if (dict_get (options, searchkey)) {
ret = dict_get_str (options, searchkey, &optstr);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to read "
- " option: %s", searchkey);
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: %s", searchkey);
ret = -1;
goto err;
}
@@ -5397,7 +5525,8 @@ no_dvm:
ret = snprintf (searchkey, 1024, "rpc-auth.%s.unix", name);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "snprintf failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
+ "snprintf failed");
ret = -1;
goto err;
}
@@ -5405,8 +5534,8 @@ no_dvm:
if (dict_get (options, searchkey)) {
ret = dict_get_str (options, searchkey, &optstr);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to read "
- " option: %s", searchkey);
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: %s", searchkey);
ret = -1;
goto err;
}
@@ -5415,7 +5544,8 @@ no_dvm:
exp->trusted_sync = 0;
ret = snprintf (searchkey, 1024, "nfs3.%s.trusted-sync", name);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "snprintf failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
+ "snprintf failed");
ret = -1;
goto err;
}
@@ -5423,15 +5553,16 @@ no_dvm:
if (dict_get (options, searchkey)) {
ret = dict_get_str (options, searchkey, &optstr);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to read "
- " option: %s", searchkey);
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: %s", searchkey);
ret = -1;
goto err;
}
ret = gf_string2boolean (optstr, &boolt);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to convert str "
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0,
+ NFS_MSG_STR2BOOL_FAIL, "Failed to convert str "
"to gf_boolean_t");
ret = -1;
goto err;
@@ -5444,7 +5575,8 @@ no_dvm:
exp->trusted_write = 0;
ret = snprintf (searchkey, 1024, "nfs3.%s.trusted-write", name);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "snprintf failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SNPRINTF_FAIL,
+ "snprintf failed");
ret = -1;
goto err;
}
@@ -5452,16 +5584,17 @@ no_dvm:
if (dict_get (options, searchkey)) {
ret = dict_get_str (options, searchkey, &optstr);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to read "
- " option: %s", searchkey);
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_READ_FAIL,
+ "Failed to read option: %s", searchkey);
ret = -1;
goto err;
}
ret = gf_string2boolean (optstr, &boolt);
if (ret < 0) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to convert str "
- "to gf_boolean_t");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0,
+ NFS_MSG_STR2BOOL_FAIL, "Failed to convert str"
+ " to gf_boolean_t");
ret = -1;
goto err;
}
@@ -5477,7 +5610,7 @@ no_dvm:
if (exp->trusted_sync)
exp->trusted_write = 1;
- gf_log (GF_NFS3, GF_LOG_TRACE, "%s: %s, %s, %s", exp->subvol->name,
+ gf_msg_trace (GF_NFS3, 0, "%s: %s, %s, %s", exp->subvol->name,
(exp->access == GF_NFS3_VOLACCESS_RO)?"read-only":"read-write",
(exp->trusted_sync == 0)?"no trusted_sync":"trusted_sync",
(exp->trusted_write == 0)?"no trusted_write":"trusted_write");
@@ -5499,11 +5632,12 @@ nfs3_init_subvolume (struct nfs3_state *nfs3, xlator_t *subvol)
exp = GF_CALLOC (1, sizeof (*exp), gf_nfs_mt_nfs3_export);
exp->subvol = subvol;
INIT_LIST_HEAD (&exp->explist);
- gf_log (GF_NFS3, GF_LOG_TRACE, "Initing state: %s", exp->subvol->name);
+ gf_msg_trace (GF_NFS3, 0, "Initing state: %s", exp->subvol->name);
ret = nfs3_init_subvolume_options (nfs3->nfsx, exp, NULL);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to init subvol");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SUBVOL_INIT_FAIL,
+ "Failed to init subvol");
goto exp_free;
}
@@ -5533,8 +5667,9 @@ nfs3_init_subvolumes (struct nfs3_state *nfs3)
while (xl_list) {
exp = nfs3_init_subvolume (nfs3, xl_list->xlator);
if (!exp) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to init subvol: "
- "%s", xl_list->xlator->name);
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0,
+ NFS_MSG_SUBVOL_INIT_FAIL, "Failed to init "
+ "subvol: %s", xl_list->xlator->name);
goto err;
}
list_add_tail (&exp->explist, &nfs3->exports);
@@ -5561,24 +5696,27 @@ nfs3_init_state (xlator_t *nfsx)
nfs3 = (struct nfs3_state *)GF_CALLOC (1, sizeof (*nfs3),
gf_nfs_mt_nfs3_state);
if (!nfs3) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Memory allocation failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY,
+ "Memory allocation failed");
return NULL;
}
nfs = nfsx->private;
ret = nfs3_init_options (nfs3, nfsx->options);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to init options");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_OPT_INIT_FAIL,
+ "Failed to init options");
goto ret;
}
nfs3->iobpool = nfsx->ctx->iobuf_pool;
localpool = nfs->memfactor * GF_NFS_CONCURRENT_OPS_MULT;
- gf_log (GF_NFS3, GF_LOG_TRACE, "local pool: %d", localpool);
+ gf_msg_trace (GF_NFS3, 0, "local pool: %d", localpool);
nfs3->localpool = mem_pool_new (nfs3_call_state_t, localpool);
if (!nfs3->localpool) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "local mempool creation failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, ENOMEM, NFS_MSG_NO_MEMORY,
+ "local mempool creation failed");
ret = -1;
goto ret;
}
@@ -5588,8 +5726,8 @@ nfs3_init_state (xlator_t *nfsx)
INIT_LIST_HEAD (&nfs3->exports);
ret = nfs3_init_subvolumes (nfs3);
if (ret == -1) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to init per-subvolume "
- "state");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_SUBVOL_INIT_FAIL,
+ "Failed to init per-subvolume state");
goto free_localpool;
}
@@ -5600,7 +5738,8 @@ nfs3_init_state (xlator_t *nfsx)
ret = rpcsvc_create_listeners (nfs->rpcsvc, nfsx->options, nfsx->name);
if (ret == -1) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Unable to create listeners");
+ gf_msg (GF_NFS, GF_LOG_ERROR, 0, NFS_MSG_LISTENERS_CREATE_FAIL,
+ "Unable to create listeners");
goto free_localpool;
}
@@ -5631,7 +5770,8 @@ nfs3svc_init (xlator_t *nfsx)
nfs3 = nfs3_init_state (nfsx);
if (!nfs3) {
- gf_log (GF_NFS3, GF_LOG_ERROR, "NFSv3 state init failed");
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_STATE_INIT_FAIL,
+ "NFSv3 state init failed");
return NULL;
}
@@ -5658,7 +5798,7 @@ nfs3_reconfigure_state (xlator_t *nfsx, dict_t *options)
ret = nfs3_init_options (nfs3, options);
if (ret) {
- gf_log (GF_NFS3, GF_LOG_ERROR,
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0, NFS_MSG_RECONF_FAIL,
"Failed to reconfigure options");
goto out;
}
@@ -5666,7 +5806,8 @@ nfs3_reconfigure_state (xlator_t *nfsx, dict_t *options)
list_for_each_entry (exp, &nfs3->exports, explist) {
ret = nfs3_init_subvolume_options (nfsx, exp, options);
if (ret) {
- gf_log (GF_NFS3, GF_LOG_ERROR,
+ gf_msg (GF_NFS3, GF_LOG_ERROR, 0,
+ NFS_MSG_RECONF_SUBVOL_FAIL,
"Failed to reconfigure subvol options");
goto out;
}