summaryrefslogtreecommitdiffstats
path: root/xlators/protocol/server
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/protocol/server')
-rw-r--r--xlators/protocol/server/src/Makefile.am3
-rw-r--r--xlators/protocol/server/src/authenticate.c29
-rw-r--r--xlators/protocol/server/src/server-handshake.c152
-rw-r--r--xlators/protocol/server/src/server-helpers.c107
-rw-r--r--xlators/protocol/server/src/server-messages.h796
-rw-r--r--xlators/protocol/server/src/server-resolve.c63
-rw-r--r--xlators/protocol/server/src/server-rpc-fops.c208
-rw-r--r--xlators/protocol/server/src/server.c137
8 files changed, 1202 insertions, 293 deletions
diff --git a/xlators/protocol/server/src/Makefile.am b/xlators/protocol/server/src/Makefile.am
index 6a18bf02561..c62d24fc828 100644
--- a/xlators/protocol/server/src/Makefile.am
+++ b/xlators/protocol/server/src/Makefile.am
@@ -10,7 +10,8 @@ server_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
server_la_SOURCES = server.c server-resolve.c server-helpers.c \
server-rpc-fops.c server-handshake.c authenticate.c
-noinst_HEADERS = server.h server-helpers.h server-mem-types.h authenticate.h
+noinst_HEADERS = server.h server-helpers.h server-mem-types.h authenticate.h \
+ server-messages.h
AM_CPPFLAGS = $(GF_CPPFLAGS) \
-I$(top_srcdir)/libglusterfs/src \
diff --git a/xlators/protocol/server/src/authenticate.c b/xlators/protocol/server/src/authenticate.c
index d8d138a84bc..8b45c41a59b 100644
--- a/xlators/protocol/server/src/authenticate.c
+++ b/xlators/protocol/server/src/authenticate.c
@@ -23,6 +23,7 @@
#include <dlfcn.h>
#include <errno.h>
#include "authenticate.h"
+#include "server-messages.h"
static int
init (dict_t *this, char *key, data_t *value, void *data)
@@ -38,9 +39,9 @@ init (dict_t *this, char *key, data_t *value, void *data)
error = data;
if (!strncasecmp (key, "ip", strlen ("ip"))) {
- gf_log ("authenticate", GF_LOG_ERROR,
- "AUTHENTICATION MODULE \"IP\" HAS BEEN REPLACED "
- "BY \"ADDR\"");
+ gf_msg ("authenticate", GF_LOG_ERROR, 0,
+ PS_MSG_AUTHENTICATE_ERROR, "AUTHENTICATION MODULE "
+ "\"IP\" HAS BEEN REPLACED BY \"ADDR\"");
dict_set (this, key, data_from_dynptr (NULL, 0));
/* TODO: 1.3.x backword compatibility */
// *error = -1;
@@ -57,7 +58,8 @@ init (dict_t *this, char *key, data_t *value, void *data)
handle = dlopen (auth_file, RTLD_LAZY);
if (!handle) {
- gf_log ("authenticate", GF_LOG_ERROR, "dlopen(%s): %s\n",
+ gf_msg ("authenticate", GF_LOG_ERROR, 0,
+ PS_MSG_AUTHENTICATE_ERROR, "dlopen(%s): %s\n",
auth_file, dlerror ());
dict_set (this, key, data_from_dynptr (NULL, 0));
GF_FREE (auth_file);
@@ -68,8 +70,9 @@ init (dict_t *this, char *key, data_t *value, void *data)
authenticate = dlsym (handle, "gf_auth");
if (!authenticate) {
- gf_log ("authenticate", GF_LOG_ERROR,
- "dlsym(gf_auth) on %s\n", dlerror ());
+ gf_msg ("authenticate", GF_LOG_ERROR, 0,
+ PS_MSG_AUTHENTICATE_ERROR, "dlsym(gf_auth) on %s\n",
+ dlerror ());
dict_set (this, key, data_from_dynptr (NULL, 0));
dlclose (handle);
*error = -1;
@@ -95,8 +98,8 @@ init (dict_t *this, char *key, data_t *value, void *data)
}
auth_handle->vol_opt->given_opt = dlsym (handle, "options");
if (auth_handle->vol_opt->given_opt == NULL) {
- gf_log ("authenticate", GF_LOG_DEBUG,
- "volume option validation not specified");
+ gf_msg_debug ("authenticate", 0, "volume option validation "
+ "not specified");
}
auth_handle->authenticate = authenticate;
@@ -135,8 +138,9 @@ _gf_auth_option_validate (dict_t *d, char *k, data_t *v, void *tmp)
ret = xlator_options_validate_list (xl, xl->options,
handle->vol_opt, NULL);
if (ret) {
- gf_log ("authenticate", GF_LOG_ERROR,
- "volume option validation failed");
+ gf_msg ("authenticate", GF_LOG_ERROR, 0,
+ PS_MSG_VOL_VALIDATE_FAILED, "volume option validation "
+ "failed");
return -1;
}
return 0;
@@ -155,7 +159,8 @@ gf_auth_init (xlator_t *xl, dict_t *auth_modules)
out:
if (ret) {
- gf_log (xl->name, GF_LOG_ERROR, "authentication init failed");
+ gf_msg (xl->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
+ "authentication init failed");
dict_foreach (auth_modules, fini, &ret);
ret = -1;
}
@@ -234,7 +239,7 @@ gf_authenticate (dict_t *input_params,
name = peerinfo_data->data;
}
- gf_log ("auth", GF_LOG_ERROR,
+ gf_msg ("auth", GF_LOG_ERROR, 0, PS_MSG_REMOTE_CLIENT_REFUSED,
"no authentication module is interested in "
"accepting remote-client %s", name);
result = AUTH_REJECT;
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 9396499cc3d..ecb80b9aece 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -21,6 +21,7 @@
#include "compat-errno.h"
#include "glusterfs3.h"
#include "authenticate.h"
+#include "server-messages.h"
struct __get_xl_struct {
const char *name;
@@ -94,7 +95,7 @@ _volfile_update_checksum (xlator_t *this, char *key, uint32_t checksum)
}
if (temp_volfile->checksum != checksum) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_REMOUNT_CLIENT_REQD,
"the volume file was modified between a prior access "
"and now. This may lead to inconsistency between "
"clients, you are advised to remount client");
@@ -122,7 +123,7 @@ getspec_build_volfile_path (xlator_t *this, const char *key, char *path,
ret = dict_get_str (this->options, "client-volume-filename",
&filename);
if (ret == 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_DEFAULTING_FILE,
"option 'client-volume-filename' is changed to "
"'volume-filename.<key>' which now takes 'key' as an "
"option to choose/fetch different files from server. "
@@ -137,8 +138,9 @@ getspec_build_volfile_path (xlator_t *this, const char *key, char *path,
if (ret < 0) {
/* Make sure that key doesn't contain "../" in path */
if ((gf_strstr (key, "/", "..")) == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s: invalid key", key);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ PS_MSG_INVALID_ENTRY, "%s: invalid "
+ "key", key);
goto out;
}
}
@@ -148,9 +150,9 @@ getspec_build_volfile_path (xlator_t *this, const char *key, char *path,
ret = dict_get_str (this->options,
"volume-filename.default", &filename);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "no default volume filename given, "
- "defaulting to %s", DEFAULT_VOLUME_FILE_PATH);
+ gf_msg_debug (this->name, 0, "no default volume "
+ "filename given, defaulting to %s",
+ DEFAULT_VOLUME_FILE_PATH);
}
}
@@ -203,7 +205,8 @@ _validate_volfile_checksum (xlator_t *this, char *key,
fd = open (filename, O_RDONLY);
if (-1 == fd) {
ret = 0;
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, errno,
+ PS_MSG_VOL_FILE_OPEN_FAILED,
"failed to open volume file (%s) : %s",
filename, strerror (errno));
goto out;
@@ -271,8 +274,8 @@ server_getspec (rpcsvc_request_t *req)
/* to allocate the proper buffer to hold the file data */
ret = stat (filename, &stbuf);
if (ret < 0){
- gf_log (this->name, GF_LOG_ERROR,
- "Unable to stat %s (%s)",
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ PS_MSG_STAT_ERROR, "Unable to stat %s (%s)",
filename, strerror (errno));
op_errno = errno;
goto fail;
@@ -280,9 +283,9 @@ server_getspec (rpcsvc_request_t *req)
spec_fd = open (filename, O_RDONLY);
if (spec_fd < 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "Unable to open %s (%s)",
- filename, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ PS_MSG_FILE_OP_FAILED, "Unable to open %s "
+ "(%s)", filename, strerror (errno));
op_errno = errno;
goto fail;
}
@@ -382,10 +385,9 @@ server_setvolume (rpcsvc_request_t *req)
"Internal error: failed to unserialize "
"request dictionary");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg \"%s\"",
- "Internal error: failed to unserialize "
- "request dictionary");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg \"%s\"", "Internal error: failed "
+ "to unserialize request dictionary");
op_ret = -1;
op_errno = EINVAL;
@@ -400,8 +402,8 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_set_str (reply, "ERROR",
"UUID not specified");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
op_ret = -1;
op_errno = EINVAL;
@@ -414,8 +416,8 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_set_str (reply, "ERROR",
"lock state version not supplied");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
op_ret = -1;
op_errno = EINVAL;
@@ -429,14 +431,16 @@ server_setvolume (rpcsvc_request_t *req)
goto fail;
}
- gf_log (this->name, GF_LOG_DEBUG, "Connected to %s", client->client_uid);
+ gf_msg_debug (this->name, 0, "Connected to %s", client->client_uid);
cancelled = server_cancel_grace_timer (this, client);
if (cancelled)//Do gf_client_put on behalf of grace-timer-handler.
gf_client_put (client, NULL);
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
goto fail;
}
@@ -452,8 +456,9 @@ server_setvolume (rpcsvc_request_t *req)
auth_set_username_passwd (params, config_params, client);
if (req->trans->ssl_name) {
if (dict_set_str(params,"ssl-name",req->trans->ssl_name) != 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "failed to set ssl_name %s", req->trans->ssl_name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ PS_MSG_SSL_NAME_SET_FAILED, "failed to set "
+ "ssl_name %s", req->trans->ssl_name);
/* Not fatal, auth will just fail. */
}
}
@@ -463,8 +468,8 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_set_str (reply, "ERROR",
"No FOP version number specified");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
}
ret = dict_get_int32 (params, "mgmt-version", &mgmt_version);
@@ -472,8 +477,8 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_set_str (reply, "ERROR",
"No MGMT version number specified");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
}
ret = gf_compare_client_version (req, fop_version, mgmt_version);
@@ -483,14 +488,15 @@ server_setvolume (rpcsvc_request_t *req)
fop_version, mgmt_version);
/* get_supported_version (req)); */
if (-1 == ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "asprintf failed while setting up error msg");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_ASPRINTF_FAILED, "asprintf failed while"
+ "setting up error msg");
goto fail;
}
ret = dict_set_dynstr (reply, "ERROR", msg);
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
op_ret = -1;
op_errno = EINVAL;
@@ -502,8 +508,8 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_set_str (reply, "ERROR",
"No remote-subvolume option specified");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
op_ret = -1;
op_errno = EINVAL;
@@ -515,14 +521,15 @@ server_setvolume (rpcsvc_request_t *req)
ret = gf_asprintf (&msg, "remote-subvolume \"%s\" is not found",
name);
if (-1 == ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_ASPRINTF_FAILED,
"asprintf failed while setting error msg");
goto fail;
}
ret = dict_set_dynstr (reply, "ERROR", msg);
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
op_ret = -1;
op_errno = ENOENT;
@@ -535,8 +542,8 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_get_str (params, "volfile-key",
&volfile_key);
if (ret)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set 'volfile-key'");
+ gf_msg_debug (this->name, 0, "failed to set "
+ "'volfile-key'");
ret = _validate_volfile_checksum (this, volfile_key,
checksum);
@@ -546,8 +553,8 @@ server_setvolume (rpcsvc_request_t *req)
"varies from earlier "
"access");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed "
+ "to set error msg");
op_ret = -1;
op_errno = ESTALE;
@@ -561,25 +568,26 @@ server_setvolume (rpcsvc_request_t *req)
if (peerinfo) {
ret = dict_set_static_ptr (params, "peer-info", peerinfo);
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set peer-info");
+ gf_msg_debug (this->name, 0, "failed to set "
+ "peer-info");
}
if (conf->auth_modules == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_AUTH_INIT_FAILED,
"Authentication module not initialized");
}
ret = dict_get_str (params, "client-version", &clnt_version);
if (ret)
- gf_log (this->name, GF_LOG_INFO, "client-version not set, "
- "may be of older version");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_CLIENT_VERSION_NOT_SET,
+ "client-version not set, may be of older version");
ret = gf_authenticate (params, config_params,
conf->auth_modules);
if (ret == AUTH_ACCEPT) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_CLIENT_ACCEPTED,
"accepted client from %s (version: %s)",
client->client_uid,
(clnt_version) ? clnt_version : "old");
@@ -587,20 +595,20 @@ server_setvolume (rpcsvc_request_t *req)
client->bound_xl = xl;
ret = dict_set_str (reply, "ERROR", "Success");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
} else {
- gf_log (this->name, GF_LOG_ERROR,
- "Cannot authenticate client from %s %s",
- client->client_uid,
+ gf_msg (this->name, GF_LOG_ERROR, EACCES,
+ PS_MSG_AUTHENTICATE_ERROR, "Cannot authenticate client"
+ " from %s %s", client->client_uid,
(clnt_version) ? clnt_version : "old");
op_ret = -1;
op_errno = EACCES;
ret = dict_set_str (reply, "ERROR", "Authentication failed");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
goto fail;
}
@@ -609,8 +617,8 @@ server_setvolume (rpcsvc_request_t *req)
"Check volfile and handshake "
"options in protocol/client");
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set error msg");
+ gf_msg_debug (this->name, 0, "failed to set error "
+ "msg");
op_ret = -1;
op_errno = EACCES;
@@ -623,10 +631,9 @@ server_setvolume (rpcsvc_request_t *req)
/* create inode table for this bound_xl, if one doesn't
already exist */
- gf_log (this->name, GF_LOG_TRACE,
- "creating inode table with lru_limit=%"PRId32", "
- "xlator=%s", conf->inode_lru_limit,
- client->bound_xl->name);
+ gf_msg_trace (this->name, 0, "creating inode table with "
+ "lru_limit=%"PRId32", xlator=%s",
+ conf->inode_lru_limit, client->bound_xl->name);
/* TODO: what is this ? */
client->bound_xl->itable =
@@ -637,25 +644,24 @@ server_setvolume (rpcsvc_request_t *req)
ret = dict_set_str (reply, "process-uuid",
this->ctx->process_uuid);
if (ret)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set 'process-uuid'");
+ gf_msg_debug (this->name, 0, "failed to set 'process-uuid'");
ret = dict_set_uint32 (reply, "clnt-lk-version", serv_ctx->lk_version);
if (ret)
- gf_log (this->name, GF_LOG_WARNING,
- "failed to set 'clnt-lk-version'");
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ PS_MSG_CLIENT_LK_VERSION_ERROR, "failed to set "
+ "'clnt-lk-version'");
ret = dict_set_uint64 (reply, "transport-ptr",
((uint64_t) (long) req->trans));
if (ret)
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set 'transport-ptr'");
+ gf_msg_debug (this->name, 0, "failed to set 'transport-ptr'");
fail:
rsp.dict.dict_len = dict_serialized_length (reply);
if (rsp.dict.dict_len > UINT_MAX) {
- gf_log ("server-handshake", GF_LOG_DEBUG,
- "failed to get serialized length of reply dict");
+ gf_msg_debug ("server-handshake", 0, "failed to get serialized"
+ " length of reply dict");
op_ret = -1;
op_errno = EINVAL;
rsp.dict.dict_len = 0;
@@ -667,8 +673,8 @@ fail:
if (rsp.dict.dict_val) {
ret = dict_serialize (reply, rsp.dict.dict_val);
if (ret < 0) {
- gf_log ("server-handshake", GF_LOG_DEBUG,
- "failed to serialize reply dict");
+ gf_msg_debug ("server-handshake", 0, "failed "
+ "to serialize reply dict");
op_ret = -1;
op_errno = -ret;
}
@@ -752,7 +758,9 @@ server_set_lk_version (rpcsvc_request_t *req)
client = gf_client_get (this, &req->cred, args.uid);
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
goto fail;
}
diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 545be6e9580..24d617f9291 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -16,6 +16,7 @@
#include "server.h"
#include "server-helpers.h"
#include "gidcache.h"
+#include "server-messages.h"
#include <fnmatch.h>
#include <pwd.h>
@@ -42,25 +43,27 @@ gid_resolve (server_conf_t *conf, call_stack_t *root)
ret = getpwuid_r (root->uid, &mypw, mystrs, sizeof(mystrs), &result);
if (ret != 0) {
- gf_log("gid-cache", GF_LOG_ERROR, "getpwuid_r(%u) failed",
- root->uid);
+ gf_msg ("gid-cache", GF_LOG_ERROR, errno,
+ PS_MSG_GET_UID_FAILED, "getpwuid_r(%u) failed",
+ root->uid);
return -1;
}
if (!result) {
- gf_log ("gid-cache", GF_LOG_ERROR, "getpwuid_r(%u) found "
- "nothing", root->uid);
+ gf_msg ("gid-cache", GF_LOG_ERROR, 0, PS_MSG_UID_NOT_FOUND,
+ "getpwuid_r(%u) found nothing", root->uid);
return -1;
}
- gf_log ("gid-cache", GF_LOG_TRACE, "mapped %u => %s", root->uid,
- result->pw_name);
+ gf_msg_trace ("gid-cache", 0, "mapped %u => %s", root->uid,
+ result->pw_name);
ngroups = GF_MAX_AUX_GROUPS;
ret = getgrouplist (result->pw_name, root->gid, mygroups, &ngroups);
if (ret == -1) {
- gf_log ("gid-cache", GF_LOG_ERROR, "could not map %s to group "
- "list (%d gids)", result->pw_name, root->ngrps);
+ gf_msg ("gid-cache", GF_LOG_ERROR, 0, PS_MSG_MAPPING_ERROR,
+ "could not map %s to group list (%d gids)",
+ result->pw_name, root->ngrps);
return -1;
}
root->ngrps = (uint16_t) ngroups;
@@ -286,12 +289,14 @@ do_fd_cleanup (xlator_t *this, client_t* client, fdentry_t *fdentries, int fd_co
ret = inode_path (fd->inode, NULL, &path);
if (ret > 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_FD_CLEANUP,
"fd cleanup on %s", path);
GF_FREE (path);
} else {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_FD_CLEANUP,
"fd cleanup on inode with gfid %s",
uuid_utoa (fd->inode->gfid));
}
@@ -334,7 +339,9 @@ server_connection_cleanup (xlator_t *this, client_t *client,
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
goto out;
}
@@ -356,7 +363,8 @@ server_connection_cleanup (xlator_t *this, client_t *client,
if (fdentries != NULL)
ret = do_fd_cleanup (this, client, fdentries, fd_count);
else
- gf_log (this->name, GF_LOG_INFO, "no fdentries to clean");
+ gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_FDENTRY_NULL,
+ "no fdentries to clean");
if (cd_ret || ret)
ret = -1;
@@ -521,9 +529,9 @@ server_build_config (xlator_t *this, server_conf_t *conf)
if (data) {
ret = gf_string2boolean(data->data, &conf->verify_volfile);
if (ret != 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "wrong value for 'verify-volfile-checksum', "
- "Neglecting option");
+ gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+ PS_MSG_INVALID_ENTRY, "wrong value for '"
+ "verify-volfile-checksum', Neglecting option");
}
}
@@ -531,9 +539,9 @@ server_build_config (xlator_t *this, server_conf_t *conf)
if (data) {
ret = gf_string2boolean (data->data, &conf->trace);
if (ret != 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "'trace' takes on only boolean values. "
- "Neglecting option");
+ gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+ PS_MSG_INVALID_ENTRY, "'trace' takes on only "
+ "boolean values. Neglecting option");
}
}
@@ -541,9 +549,8 @@ server_build_config (xlator_t *this, server_conf_t *conf)
ret = dict_get_int32 (this->options, "limits.transaction-size",
&conf->rpc_conf.max_block_size);
if (ret < 0) {
- gf_log (this->name, GF_LOG_TRACE,
- "defaulting limits.transaction-size to %d",
- DEFAULT_BLOCK_SIZE);
+ gf_msg_trace (this->name, 0, "defaulting limits.transaction-"
+ "size to %d", DEFAULT_BLOCK_SIZE);
conf->rpc_conf.max_block_size = DEFAULT_BLOCK_SIZE;
}
@@ -553,16 +560,17 @@ server_build_config (xlator_t *this, server_conf_t *conf)
or directory specified is non standard */
ret = stat (data->data, &buf);
if ((ret != 0) || !S_ISDIR (buf.st_mode)) {
- gf_log (this->name, GF_LOG_ERROR,
- "Directory '%s' doesn't exist, exiting.",
- data->data);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_DIR_NOT_FOUND, "Directory '%s' doesn't "
+ "exist, exiting.", data->data);
ret = -1;
goto out;
}
/* Make sure that conf-dir doesn't contain ".." in path */
if ((gf_strstr (data->data, "/", "..")) == -1) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_CONF_DIR_INVALID,
"%s: invalid conf_dir", data->data);
goto out;
}
@@ -759,9 +767,8 @@ server_print_reply (call_frame_t *frame, int op_ret, int op_errno)
if (state->fd)
snprintf (fdstr, 32, " fd=%p", state->fd);
- gf_log (this->name, GF_LOG_INFO,
- "%s%s => (%d, %d)%s",
- op, caller, op_ret, op_errno, fdstr);
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SERVER_MSG,
+ "%s%s => (%d, %d)%s", op, caller, op_ret, op_errno, fdstr);
out:
return;
}
@@ -822,9 +829,8 @@ server_print_request (call_frame_t *frame)
break;
}
- gf_log (this->name, GF_LOG_INFO,
- "%s%s%s%s%s%s%s",
- op, caller,
+ gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_SERVER_MSG,
+ "%s%s%s%s%s%s%s", op, caller,
resolve_vars, loc_vars, resolve2_vars, loc2_vars, other_vars);
out:
return;
@@ -859,9 +865,9 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
if (entry->dict) {
trav->dict.dict_len = dict_serialized_length (entry->dict);
if (trav->dict.dict_len > UINT_MAX) {
- gf_log (THIS->name, GF_LOG_ERROR,
- "failed to get serialized length "
- "of reply dict");
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ PS_MSG_INVALID_ENTRY, "failed to get "
+ "serialized length of reply dict");
errno = EINVAL;
trav->dict.dict_len = 0;
goto out;
@@ -877,7 +883,8 @@ serialize_rsp_direntp (gf_dirent_t *entries, gfs3_readdirp_rsp *rsp)
ret = dict_serialize (entry->dict, trav->dict.dict_val);
if (ret < 0) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, 0,
+ PS_MSG_DICT_SERIALIZE_FAIL,
"failed to serialize reply dict");
errno = -ret;
trav->dict.dict_len = 0;
@@ -989,7 +996,8 @@ gf_server_check_getxattr_cmd (call_frame_t *frame, const char *key)
pthread_mutex_lock (&conf->mutex);
{
list_for_each_entry (xprt, &conf->xprt_list, list) {
- gf_log ("mount-point-list", GF_LOG_INFO,
+ gf_msg ("mount-point-list", GF_LOG_INFO, 0,
+ PS_MSG_MOUNT_PT_FAIL,
"%s", xprt->peerinfo.identifier);
}
}
@@ -1021,7 +1029,7 @@ gf_server_check_setxattr_cmd (call_frame_t *frame, dict_t *dict)
total_read += xprt->total_bytes_read;
total_write += xprt->total_bytes_write;
}
- gf_log ("stats", GF_LOG_INFO,
+ gf_msg ("stats", GF_LOG_INFO, 0, PS_MSG_RW_STAT,
"total-read %"PRIu64", total-write %"PRIu64,
total_read, total_write);
}
@@ -1038,7 +1046,7 @@ server_cancel_grace_timer (xlator_t *this, client_t *client)
gf_boolean_t cancelled = _gf_false;
if (!this || !client) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL, PS_MSG_INVALID_ENTRY,
"Invalid arguments to cancel connection timer");
return cancelled;
}
@@ -1046,7 +1054,9 @@ server_cancel_grace_timer (xlator_t *this, client_t *client)
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED,
+ "server_ctx_get() failed");
goto out;
}
@@ -1124,8 +1134,8 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
ret = dict_get_str (input_params, "username", &username);
if (ret) {
- gf_log ("auth/login", GF_LOG_DEBUG,
- "username not found, returning DONT-CARE");
+ gf_msg_debug ("auth/login", 0, "username not found, returning "
+ "DONT-CARE");
/* For non trusted clients username and password
will not be there. So dont reject the client.
*/
@@ -1135,14 +1145,15 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
ret = dict_get_str (input_params, "password", &password);
if (ret) {
- gf_log ("auth/login", GF_LOG_WARNING,
+ gf_msg ("auth/login", GF_LOG_WARNING, 0,
+ PS_MSG_DICT_GET_FAILED,
"password not found, returning DONT-CARE");
goto out;
}
ret = dict_get_str (input_params, "remote-subvolume", &brick_name);
if (ret) {
- gf_log ("auth/login", GF_LOG_ERROR,
+ gf_msg ("auth/login", GF_LOG_ERROR, 0, PS_MSG_DICT_GET_FAILED,
"remote-subvolume not specified");
ret = -1;
goto out;
@@ -1177,8 +1188,9 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
GF_FREE (searchstr);
if (!passwd_data) {
- gf_log ("auth/login", GF_LOG_ERROR,
- "wrong username/password "
+ gf_msg ("auth/login", GF_LOG_ERROR, 0,
+ PS_MSG_LOGIN_ERROR, "wrong "
+ "username/password "
"combination");
ret = -1;
goto out;
@@ -1193,8 +1205,9 @@ auth_set_username_passwd (dict_t *input_params, dict_t *config_params,
gf_strdup (password);
}
if (ret == -1)
- gf_log ("auth/login", GF_LOG_ERROR,
- "wrong password for user %s",
+ gf_msg ("auth/login", GF_LOG_ERROR, 0,
+ PS_MSG_LOGIN_ERROR, "wrong "
+ "password for user %s",
username);
break;
}
diff --git a/xlators/protocol/server/src/server-messages.h b/xlators/protocol/server/src/server-messages.h
new file mode 100644
index 00000000000..f604086821f
--- /dev/null
+++ b/xlators/protocol/server/src/server-messages.h
@@ -0,0 +1,796 @@
+/*
+ Copyright (c) 2015 Red Hat, Inc. <http://www.redhat.com>
+ This file is part of GlusterFS.
+
+ This file is licensed to you under your choice of the GNU Lesser
+ General Public License, version 3 or any later version (LGPLv3 or
+ later), or the GNU General Public License, version 2 (GPLv2), in all
+ cases as published by the Free Software Foundation.
+*/
+
+#ifndef _PS_MESSAGES_H__
+#define _PS_MESSAGES_H_
+
+#ifndef _CONFIG_H
+#define _CONFIG_H
+#include "config.h"
+#endif
+
+#include "glfs-message-id.h"
+
+/*! \file server-messages.h
+ * \brief server log-message IDs and their descriptions
+ */
+
+/* NOTE: Rules for message additions
+ * 1) Each instance of a message is _better_ left with a unique message ID, even
+ * if the message format is the same. Reasoning is that, if the message
+ * format needs to change in one instance, the other instances are not
+ * impacted or the new change does not change the ID of the instance being
+ * modified.
+ * 2) Addition of a message,
+ * - Should increment the GLFS_NUM_MESSAGES
+ * - Append to the list of messages defined, towards the end
+ * - Retain macro naming as glfs_msg_X (for redability across developers)
+ * NOTE: Rules for message format modifications
+ * 3) Check acorss the code if the message ID macro in question is reused
+ * anywhere. If reused then then the modifications should ensure correctness
+ * everywhere, or needs a new message ID as (1) above was not adhered to. If
+ * not used anywhere, proceed with the required modification.
+ * NOTE: Rules for message deletion
+ * 4) Check (3) and if used anywhere else, then cannot be deleted. If not used
+ * anywhere, then can be deleted, but will leave a hole by design, as
+ * addition rules specify modification to the end of the list and not filling
+ * holes.
+ */
+
+#define GLFS_PS_BASE GLFS_MSGID_COMP_PS
+#define GLFS_NUM_MESSAGES 82
+#define GLFS_MSGID_END (GLFS_PS_BASE + GLFS_NUM_MESSAGES + 1)
+/* Messages with message IDs */
+#define glfs_msg_start_x GLFS_PS_BASE, "Invalid: Start of messages"
+/*------------*/
+
+#define PS_MSG_AUTHENTICATE_ERROR (GLFS_PS_BASE + 1)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_VOL_VALIDATE_FAILED (GLFS_PS_BASE + 2)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_AUTH_INIT_FAILED (GLFS_PS_BASE + 3)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_REMOTE_CLIENT_REFUSED (GLFS_PS_BASE + 4)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_GFID_RESOLVE_FAILED (GLFS_PS_BASE + 5)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_ANONYMOUS_FD_CREATE_FAILED (GLFS_PS_BASE + 6)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_NO_MEMORY (GLFS_PS_BASE + 7)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_FD_NOT_FOUND (GLFS_PS_BASE + 8)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_INVALID_ENTRY (GLFS_PS_BASE + 9)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_GET_UID_FAILED (GLFS_PS_BASE + 10)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_UID_NOT_FOUND (GLFS_PS_BASE + 11)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_MAPPING_ERROR (GLFS_PS_BASE + 12)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_FD_CLEANUP (GLFS_PS_BASE + 13)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SERVER_CTX_GET_FAILED (GLFS_PS_BASE + 14)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_FDENTRY_NULL (GLFS_PS_BASE + 15)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_DIR_NOT_FOUND (GLFS_PS_BASE + 16)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SERVER_MSG (GLFS_PS_BASE + 17)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_DICT_SERIALIZE_FAIL (GLFS_PS_BASE + 18)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_RW_STAT (GLFS_PS_BASE + 19)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_DICT_GET_FAILED (GLFS_PS_BASE + 20)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_LOGIN_ERROR (GLFS_PS_BASE + 21)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_REMOUNT_CLIENT_REQD (GLFS_PS_BASE + 22)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_DEFAULTING_FILE (GLFS_PS_BASE + 23)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_VOL_FILE_OPEN_FAILED (GLFS_PS_BASE + 24)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_STAT_ERROR (GLFS_PS_BASE + 25)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SSL_NAME_SET_FAILED (GLFS_PS_BASE + 26)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_ASPRINTF_FAILED (GLFS_PS_BASE + 27)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CLIENT_VERSION_NOT_SET (GLFS_PS_BASE + 28)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CLIENT_ACCEPTED (GLFS_PS_BASE + 29)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CLIENT_LK_VERSION_ERROR (GLFS_PS_BASE + 30)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_GRACE_TIMER_EXPD (GLFS_PS_BASE + 31)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SERIALIZE_REPLY_FAILED (GLFS_PS_BASE + 32)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_AUTH_IP_ERROR (GLFS_PS_BASE + 33)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SKIP_FORMAT_CHK (GLFS_PS_BASE + 34)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_INTERNET_ADDR_ERROR (GLFS_PS_BASE + 35)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CLIENT_DISCONNECTING (GLFS_PS_BASE + 36)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_GRACE_TIMER_START (GLFS_PS_BASE + 37)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_STATEDUMP_PATH_ERROR (GLFS_PS_BASE + 38)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_GRP_CACHE_ERROR (GLFS_PS_BASE + 39)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_RPC_CONF_ERROR (GLFS_PS_BASE + 40)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_TRANSPORT_ERROR (GLFS_PS_BASE + 41)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SUBVOL_NULL (GLFS_PS_BASE + 42)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_PARENT_VOL_ERROR (GLFS_PS_BASE + 43)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_RPCSVC_CREATE_FAILED (GLFS_PS_BASE + 44)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_RPCSVC_LISTENER_CREATE_FAILED (GLFS_PS_BASE + 45)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_RPCSVC_NOTIFY (GLFS_PS_BASE + 46)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_PGM_REG_FAILED (GLFS_PS_BASE + 47)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_ULIMIT_SET_FAILED (GLFS_PS_BASE + 48)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_STATFS (GLFS_PS_BASE + 49)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_LOOKUP_INFO (GLFS_PS_BASE + 50)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_LK_INFO (GLFS_PS_BASE + 51)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_LOCK_ERROR (GLFS_PS_BASE + 52)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_INODELK_INFO (GLFS_PS_BASE + 53)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_ENTRYLK_INFO (GLFS_PS_BASE + 54)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_ACCESS_INFO (GLFS_PS_BASE + 55)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_DIR_INFO (GLFS_PS_BASE + 56)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_MKNOD_INFO (GLFS_PS_BASE + 57)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_REMOVEXATTR_INFO (GLFS_PS_BASE + 58)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_GETXATTR_INFO (GLFS_PS_BASE + 59)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SETXATTR_INFO (GLFS_PS_BASE + 60)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_RENAME_INFO (GLFS_PS_BASE + 61)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_LINK_INFO (GLFS_PS_BASE + 62)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_TRUNCATE_INFO (GLFS_PS_BASE + 63)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_FSTAT_INFO (GLFS_PS_BASE + 64)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_FLUSH_INFO (GLFS_PS_BASE + 65)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SYNC_INFO (GLFS_PS_BASE + 66)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_WRITE_INFO (GLFS_PS_BASE + 67)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_READ_INFO (GLFS_PS_BASE + 68)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CHKSUM_INFO (GLFS_PS_BASE + 69)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_OPEN_INFO (GLFS_PS_BASE + 70)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CREATE_INFO (GLFS_PS_BASE + 71)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_SETATTR_INFO (GLFS_PS_BASE + 72)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_XATTROP_INFO (GLFS_PS_BASE + 73)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_ALLOC_INFO (GLFS_PS_BASE + 74)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_DISCARD_INFO (GLFS_PS_BASE + 75)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_ZEROFILL_INFO (GLFS_PS_BASE + 76)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_FD_CREATE_FAILED (GLFS_PS_BASE + 77)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_WRONG_STATE (GLFS_PS_BASE + 78)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_CONF_DIR_INVALID (GLFS_PS_BASE + 79)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_MOUNT_PT_FAIL (GLFS_PS_BASE + 80)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_STAT_INFO (GLFS_PS_BASE + 81)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+#define PS_MSG_FILE_OP_FAILED (GLFS_PS_BASE + 82)
+
+/*!
+ * @messageid
+ * @diagnosis
+ * @recommendedaction
+ *
+ */
+
+/*------------*/
+#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
+
+#endif /* !_PS_MESSAGES_H_ */
+
diff --git a/xlators/protocol/server/src/server-resolve.c b/xlators/protocol/server/src/server-resolve.c
index 3c3dcfeb3e5..6e2903133d0 100644
--- a/xlators/protocol/server/src/server-resolve.c
+++ b/xlators/protocol/server/src/server-resolve.c
@@ -15,6 +15,7 @@
#include "server.h"
#include "server-helpers.h"
+#include "server-messages.h"
int
@@ -63,11 +64,18 @@ resolve_gfid_entry_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
resolve_loc = &resolve->resolve_loc;
if (op_ret == -1) {
- gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
- GF_LOG_WARNING),
- "%s/%s: failed to resolve (%s)",
- uuid_utoa (resolve_loc->pargfid), resolve_loc->name,
- strerror (op_errno));
+ if (op_errno == ENOENT) {
+ gf_msg_debug (this->name, 0, "%s/%s: failed to resolve"
+ " (%s)",
+ uuid_utoa (resolve_loc->pargfid),
+ resolve_loc->name, strerror (op_errno));
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ PS_MSG_GFID_RESOLVE_FAILED, "%s/%s: failed to "
+ "resolve (%s)",
+ uuid_utoa (resolve_loc->pargfid),
+ resolve_loc->name, strerror (op_errno));
+ }
goto out;
}
@@ -104,10 +112,18 @@ resolve_gfid_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
resolve_loc = &resolve->resolve_loc;
if (op_ret == -1) {
- gf_log (this->name, ((op_errno == ENOENT) ? GF_LOG_DEBUG :
- GF_LOG_WARNING),
- "%s: failed to resolve (%s)",
- uuid_utoa (resolve_loc->gfid), strerror (op_errno));
+ if (op_errno == ENOENT) {
+ gf_msg_debug (this->name, GF_LOG_DEBUG,
+ "%s: failed to resolve (%s)",
+ uuid_utoa (resolve_loc->gfid),
+ strerror (op_errno));
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ PS_MSG_GFID_RESOLVE_FAILED,
+ "%s: failed to resolve (%s)",
+ uuid_utoa (resolve_loc->gfid),
+ strerror (op_errno));
+ }
loc_wipe (&resolve->resolve_loc);
goto out;
}
@@ -213,8 +229,8 @@ resolve_continue (call_frame_t *frame)
else if (!gf_uuid_is_null (resolve->gfid))
ret = resolve_inode_simple (frame);
if (ret)
- gf_log (this->name, GF_LOG_DEBUG,
- "return value of resolve_*_simple %d", ret);
+ gf_msg_debug (this->name, 0, "return value of resolve_*_"
+ "simple %d", ret);
resolve_loc_touchup (frame);
out:
@@ -281,9 +297,9 @@ resolve_entry_simple (call_frame_t *frame)
}
if (resolve->type == RESOLVE_NOT) {
- gf_log (this->name, GF_LOG_DEBUG, "inode (pointer: %p gfid:%s"
- " found for path (%s) while type is RESOLVE_NOT",
- inode, uuid_utoa (inode->gfid), resolve->path);
+ gf_msg_debug (this->name, 0, "inode (pointer: %p gfid:%s found"
+ " for path (%s) while type is RESOLVE_NOT",
+ inode, uuid_utoa (inode->gfid), resolve->path);
resolve->op_ret = -1;
resolve->op_errno = EEXIST;
ret = -1;
@@ -420,8 +436,9 @@ out:
inode_unref (inode);
if (ret != 0)
- gf_log ("server", GF_LOG_WARNING, "inode for the gfid (%s) is "
- "not found. anonymous fd creation failed",
+ gf_msg ("server", GF_LOG_WARNING, 0,
+ PS_MSG_ANONYMOUS_FD_CREATE_FAILED, "inode for the gfid"
+ "(%s) is not found. anonymous fd creation failed",
uuid_utoa (resolve->gfid));
return ret;
}
@@ -476,7 +493,8 @@ server_resolve_fd (call_frame_t *frame)
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log ("", GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg ("", GF_LOG_INFO, ENOMEM, PS_MSG_NO_MEMORY,
+ "server_ctx_get() failed");
resolve->op_ret = -1;
resolve->op_errno = ENOMEM;
return 0;
@@ -485,7 +503,8 @@ server_resolve_fd (call_frame_t *frame)
state->fd = gf_fd_fdptr_get (serv_ctx->fdtable, fd_no);
if (!state->fd) {
- gf_log ("", GF_LOG_INFO, "fd not found in context");
+ gf_msg ("", GF_LOG_INFO, EBADF, PS_MSG_FD_NOT_FOUND, "fd not "
+ "found in context");
resolve->op_ret = -1;
resolve->op_errno = EBADF;
}
@@ -519,7 +538,8 @@ server_resolve (call_frame_t *frame)
} else {
if (resolve == &state->resolve)
- gf_log (frame->this->name, GF_LOG_WARNING,
+ gf_msg (frame->this->name, GF_LOG_WARNING, 0,
+ PS_MSG_INVALID_ENTRY,
"no resolution type for %s (%s)",
resolve->path, gf_fop_list[frame->root->op]);
@@ -580,8 +600,9 @@ server_resolve_all (call_frame_t *frame)
server_resolve_done (frame);
} else {
- gf_log (this->name, GF_LOG_ERROR,
- "Invalid pointer for state->resolve_now");
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ PS_MSG_INVALID_ENTRY, "Invalid pointer for "
+ "state->resolve_now");
}
return 0;
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c
index c69b17fd255..ff3d2998aa7 100644
--- a/xlators/protocol/server/src/server-rpc-fops.c
+++ b/xlators/protocol/server/src/server-rpc-fops.c
@@ -22,6 +22,7 @@
#include "glusterfs3-xdr.h"
#include "glusterfs3.h"
#include "compat-errno.h"
+#include "server-messages.h"
#include "xdr-nfs3.h"
@@ -44,7 +45,8 @@ server_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_WARNING, "%"PRId64": STATFS (%s)",
+ gf_msg (this->name, GF_LOG_WARNING, errno, PS_MSG_STATFS,
+ "%"PRId64": STATFS (%s)",
frame->root->unique, strerror (op_errno));
goto out;
}
@@ -138,8 +140,9 @@ out:
if (op_ret) {
if (state->resolve.bname) {
- gf_log (this->name,
+ gf_msg (this->name,
fop_log_level (GF_FOP_LOOKUP, op_errno),
+ op_errno, PS_MSG_LOOKUP_INFO,
"%"PRId64": LOOKUP %s (%s/%s) ==> "
"(%s)", frame->root->unique,
state->loc.path,
@@ -147,8 +150,9 @@ out:
state->resolve.bname,
strerror (op_errno));
} else {
- gf_log (this->name,
+ gf_msg (this->name,
fop_log_level (GF_FOP_LOOKUP, op_errno),
+ op_errno, PS_MSG_LOOKUP_INFO,
"%"PRId64": LOOKUP %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -180,7 +184,8 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, fop_log_level (GF_FOP_LK, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_LK, op_errno),
+ op_errno, PS_MSG_LK_INFO,
"%"PRId64": LK %"PRId64" (%s) ==> "
"(%s)", frame->root->unique,
state->resolve.fd_no,
@@ -200,7 +205,7 @@ server_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
lock->l_type = GF_LK_F_UNLCK;
break;
default:
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_LOCK_ERROR,
"Unknown lock type: %"PRId32"!", lock->l_type);
break;
}
@@ -235,7 +240,8 @@ server_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, fop_log_level (GF_FOP_INODELK, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_INODELK, op_errno),
+ errno, PS_MSG_INODELK_INFO,
"%"PRId64": INODELK %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -271,7 +277,8 @@ server_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, fop_log_level (GF_FOP_FINODELK, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_FINODELK, op_errno),
+ op_errno, PS_MSG_INODELK_INFO,
"%"PRId64": FINODELK %"PRId64" (%s) "
"==> (%s)", frame->root->unique,
state->resolve.fd_no,
@@ -307,7 +314,8 @@ server_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, fop_log_level (GF_FOP_ENTRYLK, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_ENTRYLK, op_errno),
+ op_errno, PS_MSG_ENTRYLK_INFO,
"%"PRId64": ENTRYLK %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -343,7 +351,8 @@ server_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, fop_log_level (GF_FOP_FENTRYLK, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_FENTRYLK, op_errno),
+ op_errno, PS_MSG_ENTRYLK_INFO,
"%"PRId64": FENTRYLK %"PRId64" (%s) ==>(%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -378,7 +387,8 @@ server_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ op_errno, PS_MSG_ACCESS_INFO,
"%"PRId64": ACCESS %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -415,7 +425,8 @@ server_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ op_errno, PS_MSG_DIR_INFO,
"%"PRId64": RMDIR %s (%s/%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.pargfid),
@@ -468,7 +479,8 @@ server_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ op_errno, PS_MSG_DIR_INFO,
"%"PRId64": MKDIR %s (%s/%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.pargfid),
@@ -515,7 +527,8 @@ server_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ op_errno, PS_MSG_MKNOD_INFO,
"%"PRId64": MKNOD %s (%s/%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.pargfid),
@@ -558,7 +571,8 @@ server_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ op_errno, PS_MSG_DIR_INFO,
"%"PRId64": FSYNCDIR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -594,7 +608,8 @@ server_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO,
+ op_errno, PS_MSG_DIR_INFO,
"%"PRId64": READDIR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -642,7 +657,8 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, fop_log_level (GF_FOP_OPENDIR, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_OPENDIR, op_errno),
+ op_errno, PS_MSG_DIR_INFO,
"%"PRId64": OPENDIR %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -651,7 +667,9 @@ server_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
serv_ctx = server_ctx_get (frame->root->client, this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
goto out;
}
@@ -692,7 +710,8 @@ server_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
else
loglevel = GF_LOG_INFO;
- gf_log (this->name, loglevel,
+ gf_msg (this->name, loglevel, op_errno,
+ PS_MSG_REMOVEXATTR_INFO,
"%"PRId64": REMOVEXATTR %s (%s) of key %s ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -726,7 +745,8 @@ server_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ PS_MSG_REMOVEXATTR_INFO,
"%"PRId64": FREMOVEXATTR %"PRId64" (%s) (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), state->name,
@@ -761,7 +781,8 @@ server_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
state = CALL_STATE (frame);
- gf_log (this->name, fop_log_level (GF_FOP_GETXATTR, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_GETXATTR, op_errno),
+ op_errno, PS_MSG_GETXATTR_INFO,
"%"PRId64": GETXATTR %s (%s) (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -802,7 +823,8 @@ server_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
state = CALL_STATE (frame);
- gf_log (this->name, fop_log_level (GF_FOP_FGETXATTR, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_FGETXATTR, op_errno),
+ op_errno, PS_MSG_GETXATTR_INFO,
"%"PRId64": FGETXATTR %"PRId64" (%s) (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -840,7 +862,7 @@ _gf_server_log_setxattr_failure (dict_t *d, char *k, data_t *v,
frame = tmp;
state = CALL_STATE (frame);
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
"%"PRId64": SETXATTR %s (%s) ==> %s",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid), k);
@@ -865,9 +887,14 @@ server_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
_gf_server_log_setxattr_failure,
frame);
- gf_log (THIS->name, ((op_errno == ENOTSUP) ?
- GF_LOG_DEBUG : GF_LOG_INFO),
- "%s", strerror (op_errno));
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug (THIS->name, 0, "%s",
+ strerror (op_errno));
+ } else {
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ PS_MSG_SETXATTR_INFO, "%s",
+ strerror (op_errno));
+ }
goto out;
}
@@ -895,7 +922,7 @@ _gf_server_log_fsetxattr_failure (dict_t *d, char *k, data_t *v,
frame = tmp;
state = CALL_STATE (frame);
- gf_log (THIS->name, GF_LOG_INFO,
+ gf_msg (THIS->name, GF_LOG_INFO, 0, PS_MSG_SETXATTR_INFO,
"%"PRId64": FSETXATTR %"PRId64" (%s) ==> %s",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), k);
@@ -921,9 +948,14 @@ server_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
_gf_server_log_fsetxattr_failure,
frame);
}
- gf_log (THIS->name, ((op_errno == ENOTSUP) ?
- GF_LOG_DEBUG : GF_LOG_INFO),
- "%s", strerror (op_errno));
+ if (op_errno == ENOTSUP) {
+ gf_msg_debug (THIS->name, 0, "%s",
+ strerror (op_errno));
+ } else {
+ gf_msg (THIS->name, GF_LOG_INFO, 0,
+ PS_MSG_SETXATTR_INFO, "%s",
+ strerror (op_errno));
+ }
goto out;
}
@@ -963,7 +995,7 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret == -1) {
uuid_utoa_r (state->resolve.gfid, oldpar_str);
uuid_utoa_r (state->resolve2.gfid, newpar_str);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_RENAME_INFO,
"%"PRId64": RENAME %s (%s/%s) -> %s (%s/%s) ==> (%s)",
frame->root->unique, state->loc.path,
oldpar_str, state->resolve.bname, state->loc2.path,
@@ -974,9 +1006,9 @@ server_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
stbuf->ia_type = state->loc.inode->ia_type;
/* TODO: log gfid of the inodes */
- gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
- "%"PRId64": RENAME_CBK %s ==> %s",
- frame->root->unique, state->loc.name, state->loc2.name);
+ gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
+ "RENAME_CBK %s ==> %s", frame->root->unique,
+ state->loc.name, state->loc2.name);
/* Before renaming the inode, we have to get the inode for the
* destination entry (i.e. inode with state->loc2.parent as
@@ -1041,7 +1073,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret) {
- gf_log (this->name, fop_log_level (GF_FOP_UNLINK, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_UNLINK, op_errno),
+ op_errno, PS_MSG_LINK_INFO,
"%"PRId64": UNLINK %s (%s/%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.pargfid),
@@ -1050,9 +1083,8 @@ server_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
/* TODO: log gfid of the inodes */
- gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
- "%"PRId64": UNLINK_CBK %s",
- frame->root->unique, state->loc.name);
+ gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
+ "UNLINK_CBK %s", frame->root->unique, state->loc.name);
inode_unlink (state->loc.inode, state->loc.parent,
state->loc.name);
@@ -1096,7 +1128,7 @@ server_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
"%"PRId64": SYMLINK %s (%s/%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.pargfid),
@@ -1149,7 +1181,7 @@ server_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uuid_utoa_r (state->resolve.gfid, gfid_str);
uuid_utoa_r (state->resolve2.pargfid, newpar_str);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
"%"PRId64": LINK %s (%s) -> %s/%s ==> (%s)",
frame->root->unique, state->loc.path,
gfid_str, newpar_str, state->resolve2.bname,
@@ -1192,7 +1224,8 @@ server_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ PS_MSG_TRUNCATE_INFO,
"%"PRId64": TRUNCATE %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1229,7 +1262,7 @@ server_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_STAT_INFO,
"%"PRId64": FSTAT %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1265,7 +1298,8 @@ server_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ PS_MSG_TRUNCATE_INFO,
"%"PRId64": FTRUNCATE %"PRId64" (%s)==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1301,7 +1335,8 @@ server_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, fop_log_level (GF_FOP_FLUSH, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_FLUSH, op_errno),
+ op_errno, PS_MSG_FLUSH_INFO,
"%"PRId64": FLUSH %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1335,7 +1370,7 @@ server_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SYNC_INFO,
"%"PRId64": FSYNC %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1372,7 +1407,7 @@ server_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_WRITE_INFO,
"%"PRId64": WRITEV %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1421,7 +1456,7 @@ server_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_READ_INFO,
"%"PRId64": READV %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1459,7 +1494,7 @@ server_rchecksum_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_CHKSUM_INFO,
"%"PRId64": RCHECKSUM %"PRId64" (%s)==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid), strerror (op_errno));
@@ -1500,7 +1535,8 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_OPEN, op_errno),
+ op_errno, PS_MSG_OPEN_INFO,
"%"PRId64": OPEN %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -1510,7 +1546,9 @@ server_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
serv_ctx = server_ctx_get (frame->root->client, this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
goto out;
}
@@ -1551,7 +1589,7 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
state = CALL_STATE (frame);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_CREATE_INFO,
"%"PRId64": CREATE %s (%s/%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.pargfid),
@@ -1560,10 +1598,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
/* TODO: log gfid too */
- gf_log (frame->root->client->bound_xl->name, GF_LOG_TRACE,
- "%"PRId64": CREATE %s (%s)",
- frame->root->unique, state->loc.name,
- uuid_utoa (stbuf->ia_gfid));
+ gf_msg_trace (frame->root->client->bound_xl->name, 0, "%"PRId64": "
+ "CREATE %s (%s)", frame->root->unique, state->loc.name,
+ uuid_utoa (stbuf->ia_gfid));
link_inode = inode_link (inode, state->loc.parent,
state->loc.name, stbuf);
@@ -1590,7 +1627,9 @@ server_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
serv_ctx = server_ctx_get (frame->root->client, this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
goto out;
}
@@ -1635,7 +1674,7 @@ server_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_LINK_INFO,
"%"PRId64": READLINK %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -1676,7 +1715,8 @@ server_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, fop_log_level (GF_FOP_STAT, op_errno),
+ gf_msg (this->name, fop_log_level (GF_FOP_STAT, op_errno),
+ op_errno, PS_MSG_STAT_INFO,
"%"PRId64": STAT %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -1714,7 +1754,7 @@ server_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
"%"PRId64": SETATTR %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -1752,7 +1792,7 @@ server_fsetattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_SETATTR_INFO,
"%"PRId64": FSETATTR %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -1791,7 +1831,8 @@ server_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ PS_MSG_XATTROP_INFO,
"%"PRId64": XATTROP %s (%s) ==> (%s)",
frame->root->unique, state->loc.path,
uuid_utoa (state->resolve.gfid),
@@ -1832,7 +1873,8 @@ server_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ PS_MSG_XATTROP_INFO,
"%"PRId64": FXATTROP %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -1876,7 +1918,7 @@ server_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_DIR_INFO,
"%"PRId64": READDIRP %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -1925,7 +1967,7 @@ server_fallocate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_ALLOC_INFO,
"%"PRId64": FALLOCATE %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -1963,7 +2005,7 @@ server_discard_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret) {
state = CALL_STATE (frame);
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno, PS_MSG_DISCARD_INFO,
"%"PRId64": DISCARD %"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -2003,7 +2045,8 @@ server_zerofill_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
rsp.xdata.xdata_len, op_errno, out);
if (op_ret) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, op_errno,
+ PS_MSG_ZEROFILL_INFO,
"%"PRId64": ZEROFILL%"PRId64" (%s) ==> (%s)",
frame->root->unique, state->resolve.fd_no,
uuid_utoa (state->resolve.gfid),
@@ -2290,8 +2333,8 @@ server_finodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
GF_UNUSED int ret = -1;
server_state_t *state = NULL;
- gf_log (bound_xl->name, GF_LOG_DEBUG, "frame %p, xlator %p",
- frame, bound_xl);
+ gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
+ bound_xl);
state = CALL_STATE (frame);
@@ -2323,8 +2366,8 @@ server_inodelk_resume (call_frame_t *frame, xlator_t *bound_xl)
GF_UNUSED int ret = -1;
server_state_t *state = NULL;
- gf_log (bound_xl->name, GF_LOG_DEBUG, "frame %p, xlator %p",
- frame, bound_xl);
+ gf_msg_debug (bound_xl->name, 0, "frame %p, xlator %p", frame,
+ bound_xl);
state = CALL_STATE (frame);
@@ -2499,7 +2542,8 @@ server_opendir_resume (call_frame_t *frame, xlator_t *bound_xl)
state->fd = fd_create (state->loc.inode, frame->root->pid);
if (!state->fd) {
- gf_log ("server", GF_LOG_ERROR, "could not create the fd");
+ gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "could not create the fd");
goto err;
}
@@ -2887,8 +2931,9 @@ server_create_resume (call_frame_t *frame, xlator_t *bound_xl)
state->fd = fd_create (state->loc.inode, frame->root->pid);
if (!state->fd) {
- gf_log ("server", GF_LOG_ERROR, "fd creation for the inode %s "
- "failed", state->loc.inode?
+ gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_FD_CREATE_FAILED,
+ "fd creation for the inode %s failed",
+ state->loc.inode ?
uuid_utoa (state->loc.inode->gfid):NULL);
state->resolve.op_ret = -1;
state->resolve.op_errno = ENOMEM;
@@ -3911,7 +3956,8 @@ server3_3_writev_vecsizer (int state, ssize_t *readsize, char *base_addr,
nextstate = SERVER3_3_VECWRITE_START;
break;
default:
- gf_log ("server", GF_LOG_ERROR, "wrong state: %d", state);
+ gf_msg ("server", GF_LOG_ERROR, 0, PS_MSG_WRONG_STATE,
+ "wrong state: %d", state);
}
return nextstate;
@@ -3944,8 +3990,9 @@ server3_3_release (rpcsvc_request_t *req)
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log (req->trans->name, GF_LOG_INFO,
- "server_ctx_get() failed");
+ gf_msg (req->trans->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
req->rpc_err = SYSTEM_ERR;
goto out;
}
@@ -3985,8 +4032,9 @@ server3_3_releasedir (rpcsvc_request_t *req)
serv_ctx = server_ctx_get (client, client->this);
if (serv_ctx == NULL) {
- gf_log (req->trans->name, GF_LOG_INFO,
- "server_ctx_get() failed");
+ gf_msg (req->trans->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
req->rpc_err = SYSTEM_ERR;
goto out;
}
@@ -5987,9 +6035,9 @@ server3_3_lk (rpcsvc_request_t *req)
state->flock.l_type = F_UNLCK;
break;
default:
- gf_log (frame->root->client->bound_xl->name, GF_LOG_ERROR,
- "fd - %"PRId64" (%s): Unknown lock type: %"PRId32"!",
- state->resolve.fd_no,
+ gf_msg (frame->root->client->bound_xl->name, GF_LOG_ERROR,
+ 0, PS_MSG_LOCK_ERROR, "fd - %"PRId64" (%s): Unknown "
+ "lock type: %"PRId32"!", state->resolve.fd_no,
uuid_utoa (state->fd->inode->gfid), state->type);
break;
}
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index aea88b623cc..470c57dac41 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -26,6 +26,7 @@
#include "defaults.h"
#include "authenticate.h"
#include "event.h"
+#include "server-messages.h"
rpcsvc_cbk_program_t server_cbk_prog = {
.progname = "Gluster Callback",
@@ -48,13 +49,15 @@ grace_time_handler (void *data)
GF_VALIDATE_OR_GOTO (THIS->name, this, out);
- gf_log (this->name, GF_LOG_INFO, "grace timer expired for %s",
- client->client_uid);
+ gf_msg (this->name, GF_LOG_INFO, 0, PS_MSG_GRACE_TIMER_EXPD, "grace "
+ "timer expired for %s", client->client_uid);
serv_ctx = server_ctx_get (client, this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO, "server_ctx_get() failed");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED, "server_ctx_get() "
+ "failed");
goto out;
}
@@ -173,7 +176,8 @@ server_submit_reply (call_frame_t *frame, rpcsvc_request_t *req, void *arg,
iob = gfs_serialize_reply (req, arg, &rsp, xdrproc);
if (!iob) {
- gf_log ("", GF_LOG_ERROR, "Failed to serialize reply");
+ gf_msg ("", GF_LOG_ERROR, 0, PS_MSG_SERIALIZE_REPLY_FAILED,
+ "Failed to serialize reply");
goto ret;
}
@@ -355,13 +359,14 @@ get_auth_types (dict_t *this, char *key, data_t *value, void *data)
/* TODO: backward compatibility, remove when
newer versions are available */
tmp = "addr";
- gf_log ("server", GF_LOG_WARNING,
+ gf_msg ("server", GF_LOG_WARNING, 0,
+ PS_MSG_AUTH_IP_ERROR,
"assuming 'auth.ip' to be 'auth.addr'");
}
ret = dict_set_dynptr (auth_dict, tmp, NULL, 0);
if (ret < 0) {
- gf_log ("server", GF_LOG_DEBUG,
- "failed to dict_set_dynptr");
+ gf_msg_debug ("server", 0, "failed to "
+ "dict_set_dynptr");
}
}
@@ -388,7 +393,7 @@ _check_for_auth_option (dict_t *d, char *k, data_t *v,
goto out;
if (strncmp(tail, "addr.", 5) != 0) {
- gf_log (xl->name, GF_LOG_INFO,
+ gf_msg (xl->name, GF_LOG_INFO, 0, PS_MSG_SKIP_FORMAT_CHK,
"skip format check for non-addr auth option %s", k);
goto out;
}
@@ -423,7 +428,8 @@ _check_for_auth_option (dict_t *d, char *k, data_t *v,
ret = 0;
} else {
ret = -1;
- gf_log (xl->name, GF_LOG_ERROR,
+ gf_msg (xl->name, GF_LOG_ERROR, 0,
+ PS_MSG_INTERNET_ADDR_ERROR,
"internet address '%s'"
" does not conform to"
" standards.", addr);
@@ -456,10 +462,10 @@ validate_auth_options (xlator_t *this, dict_t *dict)
trav->xlator);
if (-1 == error) {
- gf_log (this->name, GF_LOG_ERROR,
- "volume '%s' defined as subvolume, but no "
- "authentication defined for the same",
- trav->xlator->name);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_AUTHENTICATE_ERROR, "volume '%s' "
+ "defined as subvolume, but no authentication "
+ "defined for the same", trav->xlator->name);
break;
}
trav = trav->next;
@@ -526,8 +532,9 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
if (!client)
break;
- gf_log (this->name, GF_LOG_INFO, "disconnecting connection "
- "from %s", client->client_uid);
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_CLIENT_DISCONNECTING, "disconnecting connection"
+ " from %s", client->client_uid);
/* If lock self heal is off, then destroy the
conn object, else register a grace timer event */
@@ -546,7 +553,8 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
serv_ctx = server_ctx_get (client, this);
if (serv_ctx == NULL) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_SERVER_CTX_GET_FAILED,
"server_ctx_get() failed");
goto out;
}
@@ -555,7 +563,8 @@ server_rpc_notify (rpcsvc_t *rpc, void *xl, rpcsvc_event_t event,
{
if (!serv_ctx->grace_timer) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ PS_MSG_GRACE_TIMER_START,
"starting a grace timer for %s",
client->client_uid);
@@ -593,8 +602,8 @@ mem_acct_init (xlator_t *this)
ret = xlator_mem_acct_init (this, gf_server_mt_end + 1);
if (ret != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Memory accounting init"
- "failed");
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM, PS_MSG_NO_MEMORY,
+ "Memory accounting init failed");
return ret;
}
out:
@@ -659,8 +668,8 @@ server_init_grace_timer (xlator_t *this, dict_t *options,
if (!ret)
gf_string2boolean (lk_heal, &conf->lk_heal);
- gf_log (this->name, GF_LOG_DEBUG, "lk-heal = %s",
- (conf->lk_heal) ? "on" : "off");
+ gf_msg_debug (this->name, 0, "lk-heal = %s",
+ (conf->lk_heal) ? "on" : "off");
ret = dict_get_int32 (options, "grace-timeout", &grace_timeout);
if (!ret)
@@ -670,8 +679,8 @@ server_init_grace_timer (xlator_t *this, dict_t *options,
gf_time_fmt (timestr, sizeof timestr, conf->grace_ts.tv_sec,
gf_timefmt_s);
- gf_log (this->name, GF_LOG_DEBUG, "Server grace timeout value = %s",
- timestr);
+ gf_msg_debug (this->name, 0, "Server grace timeout value = %s",
+ timestr);
conf->grace_ts.tv_nsec = 0;
@@ -716,8 +725,8 @@ reconfigure (xlator_t *this, dict_t *options)
if (dict_get_int32 ( options, "inode-lru-limit", &inode_lru_limit) == 0){
conf->inode_lru_limit = inode_lru_limit;
- gf_log (this->name, GF_LOG_TRACE, "Reconfigured inode-lru-limit"
- " to %d", conf->inode_lru_limit);
+ gf_msg_trace (this->name, 0, "Reconfigured inode-lru-limit to "
+ "%d", conf->inode_lru_limit);
/* traverse through the xlator graph. For each xlator in the
graph check whether it is a bound_xl or not (bound_xl means
@@ -732,22 +741,23 @@ reconfigure (xlator_t *this, dict_t *options)
if (data) {
ret = gf_string2boolean (data->data, &trace);
if (ret != 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "'trace' takes on only boolean values. "
- "Neglecting option");
+ gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+ PS_MSG_INVALID_ENTRY, "'trace' takes on only "
+ "boolean values. Neglecting option");
ret = -1;
goto out;
}
conf->trace = trace;
- gf_log (this->name, GF_LOG_TRACE, "Reconfigured trace"
- " to %d", conf->trace);
+ gf_msg_trace (this->name, 0, "Reconfigured trace to %d",
+ conf->trace);
}
GF_OPTION_RECONF ("statedump-path", statedump_path,
options, path, out);
if (!statedump_path) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_STATEDUMP_PATH_ERROR,
"Error while reconfiguring statedump path");
ret = -1;
goto out;
@@ -780,14 +790,15 @@ reconfigure (xlator_t *this, dict_t *options)
GF_OPTION_RECONF ("gid-timeout", conf->gid_cache_timeout, options,
int32, out);
if (gid_cache_reconf (&conf->gid_cache, conf->gid_cache_timeout) < 0) {
- gf_log(this->name, GF_LOG_ERROR, "Failed to reconfigure group "
- "cache.");
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
+ "Failed to reconfigure group cache.");
goto out;
}
rpc_conf = conf->rpc;
if (!rpc_conf) {
- gf_log (this->name, GF_LOG_ERROR, "No rpc_conf !!!!");
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
+ "No rpc_conf !!!!");
goto out;
}
@@ -797,7 +808,7 @@ reconfigure (xlator_t *this, dict_t *options)
ret = rpcsvc_set_outstanding_rpc_limit (rpc_conf, options,
RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
"Failed to reconfigure outstanding-rpc-limit");
goto out;
}
@@ -807,8 +818,9 @@ reconfigure (xlator_t *this, dict_t *options)
if (listeners->trans->reconfigure )
listeners->trans->reconfigure (listeners->trans, options);
else
- gf_log (this->name, GF_LOG_ERROR,
- "Reconfigure not found for transport" );
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_TRANSPORT_ERROR, "Reconfigure "
+ "not found for transport");
}
}
@@ -821,7 +833,7 @@ reconfigure (xlator_t *this, dict_t *options)
ret = server_init_grace_timer (this, options, conf);
out:
- gf_log ("", GF_LOG_DEBUG, "returning %d", ret);
+ gf_msg_debug ("", 0, "returning %d", ret);
return ret;
}
@@ -858,13 +870,13 @@ init (xlator_t *this)
GF_VALIDATE_OR_GOTO ("init", this, out);
if (this->children == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_SUBVOL_NULL,
"protocol/server should have subvolume");
goto out;
}
if (this->parents != NULL) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_PARENT_VOL_ERROR,
"protocol/server should not have parent volumes");
goto out;
}
@@ -906,7 +918,8 @@ init (xlator_t *this)
gf_path_strip_trailing_slashes (statedump_path);
this->ctx->statedump_path = gf_strdup (statedump_path);
} else {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_STATEDUMP_PATH_ERROR,
"Error setting statedump path");
ret = -1;
goto out;
@@ -937,16 +950,17 @@ init (xlator_t *this)
GF_OPTION_INIT("gid-timeout", conf->gid_cache_timeout, int32, out);
if (gid_cache_init (&conf->gid_cache, conf->gid_cache_timeout) < 0) {
- gf_log(this->name, GF_LOG_ERROR, "Failed to initialize "
- "group cache.");
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_GRP_CACHE_ERROR,
+ "Failed to initialize group cache.");
goto out;
}
/* RPC related */
conf->rpc = rpcsvc_init (this, this->ctx, this->options, 0);
if (conf->rpc == NULL) {
- gf_log (this->name, GF_LOG_ERROR,
- "creation of rpcsvc failed");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_RPCSVC_CREATE_FAILED, "creation of rpcsvc "
+ "failed");
ret = -1;
goto out;
}
@@ -954,7 +968,7 @@ init (xlator_t *this)
ret = rpcsvc_set_outstanding_rpc_limit (conf->rpc, this->options,
RPCSVC_DEFAULT_OUTSTANDING_RPC_LIMIT);
if (ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_RPC_CONF_ERROR,
"Failed to configure outstanding-rpc-limit");
goto out;
}
@@ -967,14 +981,14 @@ init (xlator_t *this)
ret = dict_get_str (this->options, "transport-type", &transport_type);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
"option transport-type not set");
ret = -1;
goto out;
}
total_transport = rpc_transport_count (transport_type);
if (total_transport <= 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, PS_MSG_TRANSPORT_ERROR,
"failed to get total number of available tranpsorts");
ret = -1;
goto out;
@@ -982,19 +996,21 @@ init (xlator_t *this)
ret = rpcsvc_create_listeners (conf->rpc, this->options,
this->name);
if (ret < 1) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
"creation of listener failed");
ret = -1;
goto out;
} else if (ret < total_transport) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
"creation of %d listeners failed, continuing with "
"succeeded transport", (total_transport - ret));
}
ret = rpcsvc_register_notify (conf->rpc, server_rpc_notify, this);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_RPCSVC_NOTIFY,
"registration of notify with rpcsvc failed");
goto out;
}
@@ -1002,7 +1018,7 @@ init (xlator_t *this)
glusterfs3_3_fop_prog.options = this->options;
ret = rpcsvc_program_register (conf->rpc, &glusterfs3_3_fop_prog);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
"registration of program (name:%s, prognum:%d, "
"progver:%d) failed", glusterfs3_3_fop_prog.progname,
glusterfs3_3_fop_prog.prognum,
@@ -1013,7 +1029,7 @@ init (xlator_t *this)
gluster_handshake_prog.options = this->options;
ret = rpcsvc_program_register (conf->rpc, &gluster_handshake_prog);
if (ret) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, PS_MSG_PGM_REG_FAILED,
"registration of program (name:%s, prognum:%d, "
"progver:%d) failed", gluster_handshake_prog.progname,
gluster_handshake_prog.prognum,
@@ -1030,19 +1046,20 @@ init (xlator_t *this)
lim.rlim_max = 1048576;
if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "WARNING: Failed to set 'ulimit -n 1M': %s",
- strerror(errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ PS_MSG_ULIMIT_SET_FAILED, "WARNING: Failed to "
+ "set 'ulimit -n 1M': %s", strerror(errno));
lim.rlim_cur = 65536;
lim.rlim_max = 65536;
if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
- gf_log (this->name, GF_LOG_WARNING,
- "Failed to set max open fd to 64k: %s",
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ PS_MSG_FD_NOT_FOUND, "Failed to set "
+ "max open fd to 64k: %s",
strerror(errno));
} else {
- gf_log (this->name, GF_LOG_TRACE,
- "max open fd set to 64k");
+ gf_msg_trace (this->name, 0, "max open fd set "
+ "to 64k");
}
}
}