summaryrefslogtreecommitdiffstats
path: root/xlators/features/snapview-server
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2018-10-16 15:34:20 -0400
committerAmar Tumballi <amarts@redhat.com>2018-11-05 07:05:23 +0000
commit643c9d049de970d27b2bfa806c4d47ea6eabefe6 (patch)
treeba33429b2e998672254276f94d2ae924f3838e29 /xlators/features/snapview-server
parent029a7e5c1908f53cc4411a8d6cbf6a4e2b207879 (diff)
features/snapview-server: change gf_log instances to gf_msg
Change-Id: Ib8bdf210a896423abcd7413dd4896d424ac0f561 fixes: bz#1626610 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'xlators/features/snapview-server')
-rw-r--r--xlators/features/snapview-server/src/Makefile.am2
-rw-r--r--xlators/features/snapview-server/src/snapview-server-helpers.c42
-rw-r--r--xlators/features/snapview-server/src/snapview-server-messages.h54
-rw-r--r--xlators/features/snapview-server/src/snapview-server-mgmt.c80
-rw-r--r--xlators/features/snapview-server/src/snapview-server.c527
-rw-r--r--xlators/features/snapview-server/src/snapview-server.h1
6 files changed, 417 insertions, 289 deletions
diff --git a/xlators/features/snapview-server/src/Makefile.am b/xlators/features/snapview-server/src/Makefile.am
index 2d39759ff80..2935f138a4c 100644
--- a/xlators/features/snapview-server/src/Makefile.am
+++ b/xlators/features/snapview-server/src/Makefile.am
@@ -13,7 +13,7 @@ snapview_server_la_LIBADD = $(top_builddir)/libglusterfs/src/libglusterfs.la \
$(RLLIBS) $(top_builddir)/rpc/xdr/src/libgfxdr.la \
$(top_builddir)/rpc/rpc-lib/src/libgfrpc.la
-noinst_HEADERS = snapview-server.h snapview-server-mem-types.h
+noinst_HEADERS = snapview-server.h snapview-server-mem-types.h snapview-server-messages.h
AM_CPPFLAGS = $(GF_CPPFLAGS) -I$(top_srcdir)/libglusterfs/src \
-I$(top_srcdir)/api/src -I$(top_srcdir)/rpc/rpc-lib/src \
diff --git a/xlators/features/snapview-server/src/snapview-server-helpers.c b/xlators/features/snapview-server/src/snapview-server-helpers.c
index 2559c4e089b..6530901c5b8 100644
--- a/xlators/features/snapview-server/src/snapview-server-helpers.c
+++ b/xlators/features/snapview-server/src/snapview-server-helpers.c
@@ -238,7 +238,7 @@ __svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
svs_fd = svs_fd_new();
if (!svs_fd) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_NEW_FD_CTX_FAILED,
"failed to allocate new fd "
"context for gfid %s",
uuid_utoa(inode->gfid));
@@ -248,7 +248,8 @@ __svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
if (fd_is_anonymous(fd)) {
inode_ctx = svs_inode_ctx_get(this, inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"failed to get inode "
"context for %s",
uuid_utoa(inode->gfid));
@@ -261,7 +262,7 @@ __svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
if (inode->ia_type == IA_IFDIR) {
glfd = glfs_h_opendir(fs, object);
if (!glfd) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_OPENDIR_FAILED,
"failed to "
"open the directory %s",
uuid_utoa(inode->gfid));
@@ -272,7 +273,7 @@ __svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
if (inode->ia_type == IA_IFREG) {
glfd = glfs_h_open(fs, object, O_RDONLY | O_LARGEFILE);
if (!glfd) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_OPEN_FAILED,
"failed to "
"open the file %s",
uuid_utoa(inode->gfid));
@@ -285,7 +286,7 @@ __svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
ret = __svs_fd_ctx_set(this, fd, svs_fd);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_SET_FD_CONTEXT_FAILED,
"failed to set fd context "
"for gfid %s",
uuid_utoa(inode->gfid));
@@ -293,14 +294,15 @@ __svs_fd_ctx_get_or_new(xlator_t *this, fd_t *fd)
if (inode->ia_type == IA_IFDIR) {
ret = glfs_closedir(svs_fd->fd);
if (ret)
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, errno,
+ SVS_MSG_CLOSEDIR_FAILED,
"failed to close the fd for %s",
uuid_utoa(inode->gfid));
}
if (inode->ia_type == IA_IFREG) {
ret = glfs_close(svs_fd->fd);
if (ret)
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_CLOSE_FAILED,
"failed to close the fd for %s",
uuid_utoa(inode->gfid));
}
@@ -352,7 +354,7 @@ svs_uuid_generate(xlator_t *this, uuid_t gfid, char *snapname,
uuid_utoa(origin_gfid));
if (gf_gfid_generate_from_xxh64(tmp, ino_string)) {
- gf_log(this->name, GF_LOG_WARNING,
+ gf_msg(this->name, GF_LOG_WARNING, 0, SVS_MSG_GFID_GEN_FAILED,
"failed to generate "
"gfid for object with actual gfid of %s "
"(snapname: %s, key: %s)",
@@ -364,7 +366,7 @@ svs_uuid_generate(xlator_t *this, uuid_t gfid, char *snapname,
ret = 0;
- gf_log(this->name, GF_LOG_DEBUG, "gfid generated is %s ", uuid_utoa(gfid));
+ gf_msg_debug(this->name, 0, "gfid generated is %s ", uuid_utoa(gfid));
out:
return ret;
@@ -483,10 +485,10 @@ __svs_initialise_snapshot_volume(xlator_t *this, const char *name,
dirent = __svs_get_snap_dirent(this, name);
if (!dirent) {
- gf_log(this->name, GF_LOG_DEBUG,
- "snap entry for "
- "name %s not found",
- name);
+ gf_msg_debug(this->name, 0,
+ "snap entry for "
+ "name %s not found",
+ name);
local_errno = ENOENT;
goto out;
}
@@ -502,17 +504,18 @@ __svs_initialise_snapshot_volume(xlator_t *this, const char *name,
fs = glfs_new(volname);
if (!fs) {
- gf_log(this->name, GF_LOG_ERROR,
+ local_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, local_errno, SVS_MSG_GLFS_NEW_FAILED,
"glfs instance for snap volume %s "
"failed",
dirent->name);
- local_errno = ENOMEM;
goto out;
}
ret = glfs_set_volfile_server(fs, "tcp", "localhost", 24007);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, local_errno,
+ SVS_MSG_SET_VOLFILE_SERVR_FAILED,
"setting the "
"volfile server for snap volume %s "
"failed",
@@ -526,7 +529,8 @@ __svs_initialise_snapshot_volume(xlator_t *this, const char *name,
ret = glfs_set_logging(fs, logfile, loglevel);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, local_errno,
+ SVS_MSG_SET_LOGGING_FAILED,
"failed to set the "
"log file path");
goto out;
@@ -534,7 +538,7 @@ __svs_initialise_snapshot_volume(xlator_t *this, const char *name,
ret = glfs_init(fs);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, local_errno, SVS_MSG_GLFS_INIT_FAILED,
"initing the "
"fs for %s failed",
dirent->name);
@@ -659,7 +663,7 @@ svs_inode_glfs_mapping(xlator_t *this, inode_t *inode)
inode_ctx = svs_inode_ctx_get(this, inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_GET_INODE_CONTEXT_FAILED,
"inode context not found for"
" the inode %s",
uuid_utoa(inode->gfid));
diff --git a/xlators/features/snapview-server/src/snapview-server-messages.h b/xlators/features/snapview-server/src/snapview-server-messages.h
new file mode 100644
index 00000000000..44cc1575405
--- /dev/null
+++ b/xlators/features/snapview-server/src/snapview-server-messages.h
@@ -0,0 +1,54 @@
+/*
+ Copyright (c) 2018 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 _SNAPVIEW_SERVER_MESSAGES_H_
+#define _SNAPVIEW_SERVER_MESSAGES_H_
+
+#include "glfs-message-id.h"
+
+/* To add new message IDs, append new identifiers at the end of the list.
+ *
+ * Never remove a message ID. If it's not used anymore, you can rename it or
+ * leave it as it is, but not delete it. This is to prevent reutilization of
+ * IDs by other messages.
+ *
+ * The component name must match one of the entries defined in
+ * glfs-message-id.h.
+ */
+
+GLFS_MSGID(SNAPVIEW_SERVER, SVS_MSG_NO_MEMORY, SVS_MSG_MEM_ACNT_FAILED,
+ SVS_MSG_NULL_GFID, SVS_MSG_GET_LATEST_SNAP_FAILED,
+ SVS_MSG_INVALID_GLFS_CTX, SVS_MSG_LOCK_DESTROY_FAILED,
+ SVS_MSG_SNAPSHOT_LIST_CHANGED, SVS_MSG_MGMT_INIT_FAILED,
+ SVS_MSG_GET_SNAPSHOT_LIST_FAILED, SVS_MSG_GET_GLFS_H_OBJECT_FAILED,
+ SVS_MSG_PARENT_CTX_OR_NAME_NULL, SVS_MSG_SET_INODE_CONTEXT_FAILED,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED, SVS_MSG_NEW_INODE_CTX_FAILED,
+ SVS_MSG_DELETE_INODE_CONTEXT_FAILED, SVS_MSG_SET_FD_CONTEXT_FAILED,
+ SVS_MSG_NEW_FD_CTX_FAILED, SVS_MSG_DELETE_FD_CTX_FAILED,
+ SVS_MSG_GETXATTR_FAILED, SVS_MSG_LISTXATTR_FAILED,
+ SVS_MSG_RELEASEDIR_FAILED, SVS_MSG_RELEASE_FAILED,
+ SVS_MSG_TELLDIR_FAILED, SVS_MSG_STAT_FAILED, SVS_MSG_STATFS_FAILED,
+ SVS_MSG_OPEN_FAILED, SVS_MSG_READ_FAILED, SVS_MSG_READLINK_FAILED,
+ SVS_MSG_ACCESS_FAILED, SVS_MSG_GET_FD_CONTEXT_FAILED,
+ SVS_MSG_DICT_SET_FAILED, SVS_MSG_OPENDIR_FAILED,
+ SVS_MSG_FS_INSTANCE_INVALID, SVS_MSG_SETFSUID_FAIL,
+ SVS_MSG_SETFSGID_FAIL, SVS_MSG_SETFSGRPS_FAIL,
+ SVS_MSG_BUILD_TRNSPRT_OPT_FAILED, SVS_MSG_RPC_INIT_FAILED,
+ SVS_MSG_REG_NOTIFY_FAILED, SVS_MSG_REG_CBK_PRGM_FAILED,
+ SVS_MSG_RPC_CLNT_START_FAILED, SVS_MSG_XDR_PAYLOAD_FAILED,
+ SVS_MSG_NULL_CTX, SVS_MSG_RPC_CALL_FAILED, SVS_MSG_XDR_DECODE_FAILED,
+ SVS_MSG_RSP_DICT_EMPTY, SVS_MSG_DICT_GET_FAILED,
+ SVS_MSG_SNAP_LIST_REFRESH_FAILED, SVS_MSG_RPC_REQ_FAILED,
+ SVS_MSG_CLOSEDIR_FAILED, SVS_MSG_CLOSE_FAILED,
+ SVS_MSG_GFID_GEN_FAILED, SVS_MSG_GLFS_NEW_FAILED,
+ SVS_MSG_SET_VOLFILE_SERVR_FAILED, SVS_MSG_SET_LOGGING_FAILED,
+ SVS_MSG_GLFS_INIT_FAILED);
+
+#endif /* !_SNAPVIEW_CLIENT_MESSAGES_H_ */
diff --git a/xlators/features/snapview-server/src/snapview-server-mgmt.c b/xlators/features/snapview-server/src/snapview-server-mgmt.c
index aff00221032..8e23b9adb2e 100644
--- a/xlators/features/snapview-server/src/snapview-server-mgmt.c
+++ b/xlators/features/snapview-server/src/snapview-server-mgmt.c
@@ -19,7 +19,8 @@ mgmt_cbk_snap(struct rpc_clnt *rpc, void *mydata, void *data)
this = mydata;
GF_ASSERT(this);
- gf_log("mgmt", GF_LOG_INFO, "list of snapshots changed");
+ gf_msg("mgmt", GF_LOG_INFO, 0, SVS_MSG_SNAPSHOT_LIST_CHANGED,
+ "list of snapshots changed");
svs_get_snapshot_list(this);
return 0;
@@ -62,7 +63,8 @@ svs_rpc_notify(struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
case RPC_CLNT_CONNECT:
ret = svs_get_snapshot_list(this);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL,
+ SVS_MSG_GET_SNAPSHOT_LIST_FAILED,
"Error in refreshing the snaplist "
"infrastructure");
ret = -1;
@@ -100,7 +102,7 @@ svs_mgmt_init(xlator_t *this)
ret = rpc_transport_inet_options_build(&options, host, port);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_BUILD_TRNSPRT_OPT_FAILED,
"failed to build the "
"transport options");
goto out;
@@ -108,26 +110,28 @@ svs_mgmt_init(xlator_t *this)
priv->rpc = rpc_clnt_new(options, this, this->name, 8);
if (!priv->rpc) {
- gf_log(this->name, GF_LOG_ERROR, "failed to initialize RPC");
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_RPC_INIT_FAILED,
+ "failed to initialize RPC");
goto out;
}
ret = rpc_clnt_register_notify(priv->rpc, svs_rpc_notify, this);
if (ret) {
- gf_log(this->name, GF_LOG_WARNING,
+ gf_msg(this->name, GF_LOG_WARNING, 0, SVS_MSG_REG_NOTIFY_FAILED,
"failed to register notify function");
goto out;
}
ret = rpcclnt_cbk_program_register(priv->rpc, &svs_cbk_prog, this);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "failed to register callback program");
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_REG_CBK_PRGM_FAILED,
+ "failed to register callback program");
goto out;
}
ret = rpc_clnt_start(priv->rpc);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_RPC_CLNT_START_FAILED,
"failed to start the rpc "
"client");
goto out;
@@ -135,7 +139,7 @@ svs_mgmt_init(xlator_t *this)
ret = 0;
- gf_log(this->name, GF_LOG_DEBUG, "svs mgmt init successful");
+ gf_msg_debug(this->name, 0, "svs mgmt init successful");
out:
if (ret)
@@ -171,6 +175,9 @@ svs_mgmt_submit_request(void *req, call_frame_t *frame, glusterfs_ctx_t *ctx,
iobref = iobref_new();
if (!iobref) {
+ gf_msg(frame->this->name, GF_LOG_WARNING, ENOMEM, SVS_MSG_NO_MEMORY,
+ "failed to allocate "
+ "new iobref");
goto out;
}
@@ -190,8 +197,8 @@ svs_mgmt_submit_request(void *req, call_frame_t *frame, glusterfs_ctx_t *ctx,
/* Create the xdr payload */
ret = xdr_serialize_generic(iov, req, xdrproc);
if (ret == -1) {
- gf_log(frame->this->name, GF_LOG_WARNING,
- "Failed to create XDR payload");
+ gf_msg(frame->this->name, GF_LOG_WARNING, 0,
+ SVS_MSG_XDR_PAYLOAD_FAILED, "Failed to create XDR payload");
goto out;
}
iov.iov_len = ret;
@@ -243,20 +250,22 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
old_dirents = priv->dirents;
if (!ctx) {
- gf_log(frame->this->name, GF_LOG_ERROR, "NULL context");
errno = EINVAL;
+ gf_msg(frame->this->name, GF_LOG_ERROR, errno, SVS_MSG_NULL_CTX,
+ "NULL context");
goto out;
}
if (-1 == req->rpc_status) {
- gf_log(frame->this->name, GF_LOG_ERROR, "RPC call is not successful");
errno = EINVAL;
+ gf_msg(frame->this->name, GF_LOG_ERROR, errno, SVS_MSG_RPC_CALL_FAILED,
+ "RPC call is not successful");
goto out;
}
ret = xdr_to_generic(*iov, &rsp, (xdrproc_t)xdr_gf_getsnap_name_uuid_rsp);
if (ret < 0) {
- gf_log(frame->this->name, GF_LOG_ERROR,
+ gf_msg(frame->this->name, GF_LOG_ERROR, 0, SVS_MSG_XDR_DECODE_FAILED,
"Failed to decode xdr response, rsp.op_ret = %d", rsp.op_ret);
goto out;
}
@@ -268,10 +277,10 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
}
if (!rsp.dict.dict_len) {
- gf_log(frame->this->name, GF_LOG_ERROR,
- "Response dict is not populated");
ret = -1;
errno = EINVAL;
+ gf_msg(frame->this->name, GF_LOG_ERROR, errno, SVS_MSG_RSP_DICT_EMPTY,
+ "Response dict is not populated");
goto out;
}
@@ -284,17 +293,18 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
ret = dict_unserialize(rsp.dict.dict_val, rsp.dict.dict_len, &dict);
if (ret) {
- gf_log(frame->this->name, GF_LOG_ERROR,
- "Failed to unserialize dictionary");
errno = EINVAL;
+ gf_msg(frame->this->name, GF_LOG_ERROR, errno,
+ LG_MSG_DICT_UNSERIAL_FAILED, "Failed to unserialize dictionary");
goto out;
}
ret = dict_get_int32(dict, "snap-count", (int32_t *)&snapcount);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Error retrieving snapcount");
errno = EINVAL;
ret = -1;
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_DICT_GET_FAILED,
+ "Error retrieving snapcount");
goto out;
}
@@ -303,10 +313,10 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
dirents = GF_CALLOC(snapcount, sizeof(snap_dirent_t),
gf_svs_mt_dirents_t);
if (!dirents) {
- gf_log(frame->this->name, GF_LOG_ERROR,
- "Unable to allocate memory");
errno = ENOMEM;
ret = -1;
+ gf_msg(frame->this->name, GF_LOG_ERROR, errno, SVS_MSG_NO_MEMORY,
+ "Unable to allocate memory");
goto out;
}
}
@@ -315,10 +325,10 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
snprintf(key, sizeof(key), "snap-volname.%d", i + 1);
ret = dict_get_str(dict, key, &value);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Error retrieving snap volname %d",
- i + 1);
errno = EINVAL;
ret = -1;
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_DICT_GET_FAILED,
+ "Error retrieving snap volname %d", i + 1);
goto out;
}
@@ -328,10 +338,10 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
snprintf(key, sizeof(key), "snap-id.%d", i + 1);
ret = dict_get_str(dict, key, &value);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Error retrieving snap uuid %d",
- i + 1);
errno = EINVAL;
ret = -1;
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_DICT_GET_FAILED,
+ "Error retrieving snap uuid %d", i + 1);
goto out;
}
strncpy(dirents[i].uuid, value, sizeof(dirents[i].uuid));
@@ -339,10 +349,10 @@ mgmt_get_snapinfo_cbk(struct rpc_req *req, struct iovec *iov, int count,
snprintf(key, sizeof(key), "snapname.%d", i + 1);
ret = dict_get_str(dict, key, &value);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Error retrieving snap name %d",
- i + 1);
errno = EINVAL;
ret = -1;
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_DICT_GET_FAILED,
+ "Error retrieving snap name %d", i + 1);
goto out;
}
strncpy(dirents[i].name, value, sizeof(dirents[i].name));
@@ -404,7 +414,7 @@ out:
free(rsp.op_errstr);
if (ret && dirents) {
- gf_log(this->name, GF_LOG_WARNING,
+ gf_msg(this->name, GF_LOG_WARNING, 0, SVS_MSG_SNAP_LIST_REFRESH_FAILED,
"Could not update dirents with refreshed snap list");
GF_FREE(dirents);
}
@@ -433,13 +443,14 @@ svs_get_snapshot_list(xlator_t *this)
ctx = this->ctx;
if (!ctx) {
- gf_log(this->name, GF_LOG_ERROR, "ctx is NULL");
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_NULL_CTX, "ctx is NULL");
goto out;
}
frame = create_frame(this, ctx->pool);
if (!frame) {
- gf_log(this->name, GF_LOG_ERROR, "Error allocating frame");
+ gf_msg(this->name, GF_LOG_ERROR, 0, LG_MSG_FRAME_ERROR,
+ "Error allocating frame");
goto out;
}
@@ -447,20 +458,23 @@ svs_get_snapshot_list(xlator_t *this)
dict = dict_new();
if (!dict) {
- gf_log(this->name, GF_LOG_ERROR, "Error allocating dictionary");
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, SVS_MSG_NO_MEMORY,
+ "Error allocating dictionary");
goto out;
}
ret = dict_set_str(dict, "volname", priv->volname);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Error setting volname in dict");
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_DICT_SET_FAILED,
+ "Error setting volname in dict");
goto out;
}
ret = dict_allocate_and_serialize(dict, &req.dict.dict_val,
&req.dict.dict_len);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR, "Failed to serialize dictionary");
+ gf_msg(this->name, GF_LOG_ERROR, 0, LG_MSG_DICT_UNSERIAL_FAILED,
+ "Failed to serialize dictionary");
ret = -1;
goto out;
}
@@ -470,7 +484,7 @@ svs_get_snapshot_list(xlator_t *this)
mgmt_get_snapinfo_cbk, (xdrproc_t)xdr_gf_getsnap_name_uuid_req);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_RPC_REQ_FAILED,
"Error sending snapshot names RPC request");
}
diff --git a/xlators/features/snapview-server/src/snapview-server.c b/xlators/features/snapview-server/src/snapview-server.c
index 6019be62075..270d40a4ed5 100644
--- a/xlators/features/snapview-server/src/snapview-server.c
+++ b/xlators/features/snapview-server/src/snapview-server.c
@@ -26,7 +26,7 @@ gf_setcredentials(uid_t *uid, gid_t *gid, uint16_t ngrps, uint32_t *groups)
if (uid) {
ret = glfs_setfsuid(*uid);
if (ret != 0) {
- gf_log("snapview-server", GF_LOG_ERROR,
+ gf_msg("snapview-server", GF_LOG_ERROR, 0, SVS_MSG_SETFSUID_FAIL,
"failed to set uid "
"%u in thread context",
*uid);
@@ -36,7 +36,7 @@ gf_setcredentials(uid_t *uid, gid_t *gid, uint16_t ngrps, uint32_t *groups)
if (gid) {
ret = glfs_setfsgid(*gid);
if (ret != 0) {
- gf_log("snapview-server", GF_LOG_ERROR,
+ gf_msg("snapview-server", GF_LOG_ERROR, 0, SVS_MSG_SETFSGID_FAIL,
"failed to set gid "
"%u in thread context",
*gid);
@@ -47,7 +47,7 @@ gf_setcredentials(uid_t *uid, gid_t *gid, uint16_t ngrps, uint32_t *groups)
if (ngrps != 0 && groups) {
ret = glfs_setfsgroups(ngrps, groups);
if (ret != 0) {
- gf_log("snapview-server", GF_LOG_ERROR,
+ gf_msg("snapview-server", GF_LOG_ERROR, 0, SVS_MSG_SETFSGRPS_FAIL,
"failed to set "
"groups in thread context");
return ret;
@@ -88,12 +88,13 @@ svs_lookup_entry_point(xlator_t *this, loc_t *loc, inode_t *parent,
inode_ctx = svs_inode_ctx_get_or_new(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ *op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_NEW_INODE_CTX_FAILED,
"failed to "
"allocate inode context for entry point "
"directory");
- op_ret = -1;
- *op_errno = ENOMEM;
goto out;
}
@@ -162,7 +163,7 @@ svs_lookup_gfid(xlator_t *this, loc_t *loc, struct iatt *buf,
GF_VALIDATE_OR_GOTO(this->name, postparent, out);
if (gf_uuid_is_null(loc->gfid) && gf_uuid_is_null(loc->inode->gfid)) {
- gf_log(this->name, GF_LOG_ERROR, "gfid is NULL");
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_NULL_GFID, "gfid is NULL");
goto out;
}
@@ -173,33 +174,36 @@ svs_lookup_gfid(xlator_t *this, loc_t *loc, struct iatt *buf,
fs = svs_get_latest_snapshot(this);
if (!fs) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to get the latest "
- "snapshot");
op_ret = -1;
*op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_GET_LATEST_SNAP_FAILED,
+ "failed to get the latest "
+ "snapshot");
goto out;
}
object = glfs_h_create_from_handle(fs, handle_obj, GFAPI_HANDLE_LENGTH,
&statbuf);
if (!object) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ *op_errno = ESTALE;
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_GET_GLFS_H_OBJECT_FAILED,
"failed to do lookup and get "
"the handle on the snapshot %s (path: %s, gfid: %s)",
loc->name, loc->path, uuid_utoa(loc->gfid));
- op_ret = -1;
- *op_errno = ESTALE;
goto out;
}
inode_ctx = svs_inode_ctx_get_or_new(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to allocate inode "
- "context");
op_ret = -1;
*op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_NEW_INODE_CTX_FAILED,
+ "failed to allocate inode "
+ "context");
goto out;
}
@@ -255,10 +259,10 @@ svs_lookup_snapshot(xlator_t *this, loc_t *loc, struct iatt *buf,
fs = svs_initialise_snapshot_volume(this, loc->name, op_errno);
if (!fs) {
- gf_log(this->name, GF_LOG_DEBUG,
- "failed to "
- "create the fs instance for snap %s",
- loc->name);
+ gf_msg_debug(this->name, 0,
+ "failed to create "
+ "the fs instance for snap %s",
+ loc->name);
*op_errno = ENOENT;
op_ret = -1;
goto out;
@@ -268,22 +272,24 @@ svs_lookup_snapshot(xlator_t *this, loc_t *loc, struct iatt *buf,
object = glfs_h_create_from_handle(fs, handle_obj, GFAPI_HANDLE_LENGTH,
&statbuf);
if (!object) {
- gf_log(this->name, GF_LOG_DEBUG,
- "failed to do lookup and "
- "get the handle on the snapshot %s",
- loc->name);
op_ret = -1;
*op_errno = errno;
+ /* Should this be in warning or error mode? */
+ gf_msg_debug(this->name, 0,
+ "failed to do lookup and "
+ "get the handle on the snapshot %s",
+ loc->name);
goto out;
}
inode_ctx = svs_inode_ctx_get_or_new(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "allocate inode context");
op_ret = -1;
*op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_NEW_INODE_CTX_FAILED,
+ "failed to allocate "
+ "inode context");
goto out;
}
@@ -355,20 +361,22 @@ svs_lookup_entry(xlator_t *this, loc_t *loc, struct iatt *buf,
object = glfs_h_lookupat(fs, parent_object, loc->name, &statbuf, 0);
if (!object) {
- gf_log(this->name, GF_LOG_DEBUG,
- "failed to do lookup and "
- "get the handle for entry %s (path: %s)",
- loc->name, loc->path);
+ /* should this be in WARNING or ERROR mode? */
+ gf_msg_debug(this->name, 0,
+ "failed to do lookup and "
+ "get the handle for entry %s (path: %s)",
+ loc->name, loc->path);
op_ret = -1;
*op_errno = errno;
goto out;
}
if (gf_uuid_is_null(object->gfid)) {
- gf_log(this->name, GF_LOG_DEBUG,
- "gfid from glfs handle is "
- "NULL for entry %s (path: %s)",
- loc->name, loc->path);
+ /* should this be in WARNING or ERROR mode? */
+ gf_msg_debug(this->name, 0,
+ "gfid from glfs handle is "
+ "NULL for entry %s (path: %s)",
+ loc->name, loc->path);
op_ret = -1;
*op_errno = errno;
goto out;
@@ -376,11 +384,12 @@ svs_lookup_entry(xlator_t *this, loc_t *loc, struct iatt *buf,
inode_ctx = svs_inode_ctx_get_or_new(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "allocate inode context");
op_ret = -1;
*op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_NEW_INODE_CTX_FAILED,
+ "failed to allocate "
+ "inode context");
goto out;
}
@@ -521,7 +530,8 @@ svs_revalidate(xlator_t *this, loc_t *loc, inode_t *parent,
inode_ctx->object = NULL;
ret = svs_get_handle(this, loc, inode_ctx, op_errno);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_GET_GLFS_H_OBJECT_FAILED,
"failed to get the handle for "
"%s (gfid %s)",
loc->path, uuid_utoa_r(loc->inode->gfid, tmp_uuid));
@@ -536,7 +546,8 @@ svs_revalidate(xlator_t *this, loc_t *loc, inode_t *parent,
*/
if (!loc->name || !parent_ctx) {
*op_errno = ESTALE;
- gf_log(this->name, GF_LOG_ERROR, "%s is NULL",
+ gf_msg(this->name, GF_LOG_ERROR, *op_errno,
+ SVS_MSG_PARENT_CTX_OR_NAME_NULL, "%s is NULL",
loc->name ? "parent context" : "loc->name");
goto out;
}
@@ -621,9 +632,9 @@ svs_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
if (xdata && !inode_ctx) {
ret = dict_get_str_boolean(xdata, "entry-point", _gf_false);
if (ret == -1) {
- gf_log(this->name, GF_LOG_DEBUG,
- "failed to get the "
- "entry point info");
+ gf_msg_debug(this->name, 0,
+ "failed to get the "
+ "entry point info");
entry_point_key = _gf_false;
} else {
entry_point_key = ret;
@@ -668,12 +679,12 @@ svs_lookup(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
*/
if (!inode_ctx && !parent_ctx) {
if (gf_uuid_is_null(loc->gfid) && gf_uuid_is_null(loc->inode->gfid)) {
- gf_log(this->name, GF_LOG_DEBUG,
- "gfid is NULL, "
- "either the lookup came on missing entry or "
- "the entry is stale");
op_ret = -1;
op_errno = ESTALE;
+ gf_msg_debug(this->name, 0,
+ "gfid is NULL. Either the lookup "
+ "came on missing entry or the "
+ "entry is stale");
goto out;
}
@@ -752,12 +763,13 @@ svs_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
inode_ctx = svs_inode_ctx_get(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = ESTALE;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"inode context not found "
"for the inode %s",
uuid_utoa(loc->inode->gfid));
- op_ret = -1;
- op_errno = ESTALE;
goto out;
}
@@ -776,20 +788,21 @@ svs_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
if (!glfd) {
op_ret = -1;
op_errno = errno;
- gf_log(this->name, GF_LOG_ERROR,
- "opendir on %s "
- "failed (gfid: %s)",
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_OPENDIR_FAILED,
+ "opendir on %s failed "
+ "(gfid: %s)",
loc->name, uuid_utoa(loc->inode->gfid));
goto out;
}
svs_fd = svs_fd_ctx_get_or_new(this, fd);
if (!svs_fd) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to allocate "
- "fd context %s (gfid: %s)",
- loc->name, uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_NEW_FD_CTX_FAILED,
+ "failed to allocate fd context "
+ "for %s (gfid: %s)",
+ loc->name, uuid_utoa(fd->inode->gfid));
glfs_closedir(glfd);
goto out;
}
@@ -847,7 +860,7 @@ svs_add_xattrs_to_dict(xlator_t *this, dict_t *dict, char *list, ssize_t size)
#endif
ret = dict_set_str(dict, keybuffer, "");
if (ret < 0) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_DICT_SET_FAILED,
"dict set operation "
"for the key %s failed.",
keybuffer);
@@ -893,12 +906,13 @@ svs_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name,
inode_ctx = svs_inode_ctx_get(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = ESTALE;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"inode context not found "
"for the inode %s",
uuid_utoa(loc->inode->gfid));
- op_ret = -1;
- op_errno = ESTALE;
goto out;
}
@@ -918,43 +932,49 @@ svs_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name,
dict = dict_new();
if (!dict) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "allocate dict");
op_ret = -1;
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
+ "failed to allocate dict");
goto out;
}
size = glfs_h_getxattrs(fs, object, name, NULL, 0);
if (size == -1) {
- gf_log(this->name, errno == ENODATA ? GF_LOG_DEBUG : GF_LOG_ERROR,
- "getxattr on %s failed (key: %s) with %s", loc->path, name,
- strerror(errno));
op_ret = -1;
op_errno = errno;
+ if (errno == ENODATA) {
+ gf_msg_debug(this->name, 0,
+ "getxattr on "
+ "%s failed (ket: %s) with %s",
+ loc->path, name, strerror(errno));
+ } else {
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GETXATTR_FAILED,
+ "getxattr on %s failed (key: %s) with %s", loc->path,
+ name, strerror(errno));
+ }
goto out;
}
value = GF_CALLOC(size + 1, sizeof(char), gf_common_mt_char);
if (!value) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "allocate memory for getxattr on %s "
- "(key: %s)",
- loc->name, name);
op_ret = -1;
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
+ "failed to allocate memory for getxattr "
+ "on %s (key: %s)",
+ loc->name, name);
goto out;
}
size = glfs_h_getxattrs(fs, object, name, value, size);
if (size == -1) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "get the xattr %s for entry %s",
- name, loc->name);
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_GETXATTR_FAILED,
+ "failed to get the xattr %s for "
+ "entry %s",
+ name, loc->name);
goto out;
}
value[size] = '\0';
@@ -963,10 +983,10 @@ svs_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name,
op_ret = dict_set_dynptr(dict, (char *)name, value, size);
if (op_ret < 0) {
op_errno = -op_ret;
- gf_log(this->name, GF_LOG_ERROR,
- "dict set "
- "operation for %s for the key %s "
- "failed.",
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_DICT_SET_FAILED,
+ "dict set operation for %s for "
+ "the key %s failed.",
loc->path, name);
GF_FREE(value);
value = NULL;
@@ -975,10 +995,11 @@ svs_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name,
} else {
op_ret = svs_add_xattrs_to_dict(this, dict, value, size);
if (op_ret == -1) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "add the xattrs from the list to dict");
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
+ "failed to add xattrs from the list to "
+ "dict for %s (gfid: %s, key: %s)",
+ loc->path, uuid_utoa(loc->inode->gfid), name);
goto out;
}
GF_FREE(value);
@@ -1018,35 +1039,37 @@ svs_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
inode_ctx = svs_inode_ctx_get(this, fd->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = ESTALE;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"inode context not found "
"for the inode %s",
uuid_utoa(fd->inode->gfid));
- op_ret = -1;
- op_errno = ESTALE;
goto out;
}
if (!(svs_inode_ctx_glfs_mapping(this, inode_ctx))) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs instance "
- "instance %p to which the inode %s belongs"
- "to does not exist. That snapshot might have"
- "been deleted or deactivated",
- inode_ctx->fs, uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = EBADF;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_FS_INSTANCE_INVALID,
+ "glfs instance %p to which the inode %s "
+ "belongs to does not exist. The snapshot "
+ "corresponding to the instance might have"
+ "been deleted or deactivated",
+ inode_ctx->fs, uuid_utoa(fd->inode->gfid));
goto out;
}
sfd = svs_fd_ctx_get_or_new(this, fd);
if (!sfd) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = EBADFD;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_FD_CONTEXT_FAILED,
"failed to get the fd "
"context for %s",
uuid_utoa(fd->inode->gfid));
- op_ret = -1;
- op_errno = EBADFD;
goto out;
}
@@ -1064,45 +1087,48 @@ svs_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
} else {
dict = dict_new();
if (!dict) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "allocate dict");
op_ret = -1;
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
+ "failed to allocate dict "
+ "(gfid: %s, key: %s)",
+ uuid_utoa(fd->inode->gfid), name);
goto out;
}
if (name) {
size = glfs_fgetxattr(glfd, name, NULL, 0);
if (size == -1) {
- gf_log(this->name, GF_LOG_ERROR,
- "getxattr on "
- "%s failed (key: %s)",
- uuid_utoa(fd->inode->gfid), name);
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GETXATTR_FAILED,
+ "getxattr on %s failed "
+ "(key: %s)",
+ uuid_utoa(fd->inode->gfid), name);
goto out;
}
value = GF_CALLOC(size + 1, sizeof(char), gf_common_mt_char);
if (!value) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
"failed to "
"allocate memory for getxattr on %s "
"(key: %s)",
uuid_utoa(fd->inode->gfid), name);
- op_ret = -1;
- op_errno = ENOMEM;
goto out;
}
size = glfs_fgetxattr(glfd, name, value, size);
if (size == -1) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "get the xattr %s for inode %s",
- name, uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GETXATTR_FAILED,
+ "failed to get the xattr %s "
+ "for inode %s",
+ name, uuid_utoa(fd->inode->gfid));
goto out;
}
value[size] = '\0';
@@ -1110,19 +1136,19 @@ svs_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
op_ret = dict_set_dynptr(dict, (char *)name, value, size);
if (op_ret < 0) {
op_errno = -op_ret;
- gf_log(this->name, GF_LOG_ERROR,
- "dict set "
- "operation for gfid %s for the key %s "
- "failed.",
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_DICT_SET_FAILED,
+ "dict set operation for gfid %s "
+ "for the key %s failed.",
uuid_utoa(fd->inode->gfid), name);
goto out;
}
} else {
size = glfs_flistxattr(glfd, NULL, 0);
if (size == -1) {
- gf_log(this->name, GF_LOG_ERROR,
- "listxattr "
- "on %s failed",
+ op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_LISTXATTR_FAILED, "listxattr on %s failed",
uuid_utoa(fd->inode->gfid));
goto out;
}
@@ -1131,9 +1157,10 @@ svs_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
if (!value) {
op_ret = -1;
op_errno = ENOMEM;
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
"failed to "
- "allocate buffer for xattr list (%s)",
+ "allocate buffer for xattr "
+ "list (%s)",
uuid_utoa(fd->inode->gfid));
goto out;
}
@@ -1142,19 +1169,19 @@ svs_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name,
if (size == -1) {
op_ret = -1;
op_errno = errno;
- gf_log(this->name, GF_LOG_ERROR,
- "listxattr "
- "on %s failed",
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_LISTXATTR_FAILED, "listxattr on %s failed",
uuid_utoa(fd->inode->gfid));
goto out;
}
op_ret = svs_add_xattrs_to_dict(this, dict, value, size);
if (op_ret == -1) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "add the xattrs from the list to dict");
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
+ "failed to add xattrs from the list "
+ "to dict (gfid: %s, key: %s)",
+ uuid_utoa(fd->inode->gfid), name);
goto out;
}
GF_FREE(value);
@@ -1191,7 +1218,7 @@ svs_releasedir(xlator_t *this, fd_t *fd)
ret = fd_ctx_del(fd, this, &tmp_pfd);
if (ret < 0) {
- gf_log(this->name, GF_LOG_DEBUG, "pfd from fd=%p is NULL", fd);
+ gf_msg_debug(this->name, 0, "pfd from fd=%p is NULL", fd);
goto out;
}
@@ -1206,9 +1233,10 @@ svs_releasedir(xlator_t *this, fd_t *fd)
if (sfd->fd) {
ret = glfs_closedir(sfd->fd);
if (ret)
- gf_log(this->name, GF_LOG_WARNING,
- "failed to close the glfd"
- "for directory %s",
+ gf_msg(this->name, GF_LOG_WARNING, errno,
+ SVS_MSG_RELEASEDIR_FAILED,
+ "failed to close the glfd for "
+ "directory %s",
uuid_utoa(fd->inode->gfid));
}
}
@@ -1244,19 +1272,21 @@ svs_flush(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
inode_ctx = svs_inode_ctx_get(this, fd->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"inode context not found for"
" the inode %s",
uuid_utoa(fd->inode->gfid));
- op_ret = -1;
- op_errno = EINVAL;
goto out;
}
ret = fd_ctx_get(fd, this, &value);
if (ret < 0 && inode_ctx->type != SNAP_VIEW_ENTRY_POINT_INODE) {
op_errno = EINVAL;
- gf_log(this->name, GF_LOG_WARNING, "pfd is NULL on fd=%p", fd);
+ gf_msg(this->name, GF_LOG_WARNING, op_errno,
+ SVS_MSG_GET_FD_CONTEXT_FAILED, "pfd is NULL on fd=%p", fd);
goto out;
}
@@ -1283,7 +1313,7 @@ svs_release(xlator_t *this, fd_t *fd)
ret = fd_ctx_del(fd, this, &tmp_pfd);
if (ret < 0) {
- gf_log(this->name, GF_LOG_DEBUG, "pfd from fd=%p is NULL", fd);
+ gf_msg_debug(this->name, 0, "pfd from fd=%p is NULL", fd);
goto out;
}
@@ -1298,7 +1328,8 @@ svs_release(xlator_t *this, fd_t *fd)
if (sfd->fd) {
ret = glfs_close(sfd->fd);
if (ret)
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, errno,
+ SVS_MSG_RELEASE_FAILED,
"failed to close "
"the glfd for %s",
uuid_utoa(fd->inode->gfid));
@@ -1323,7 +1354,7 @@ svs_forget(xlator_t *this, inode_t *inode)
ret = inode_ctx_del(inode, this, &value);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_DELETE_INODE_CONTEXT_FAILED,
"failed to delete the inode "
"context of %s",
uuid_utoa(inode->gfid));
@@ -1372,7 +1403,7 @@ svs_fill_readdir(xlator_t *this, gf_dirent_t *entries, size_t size, off_t off)
entry = gf_dirent_for_name(dirents[i].name);
if (!entry) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, SVS_MSG_NO_MEMORY,
"failed to allocate dentry for %s", dirents[i].name);
goto unlock;
}
@@ -1427,7 +1458,8 @@ svs_glfs_readdir(xlator_t *this, glfs_fd_t *glfd, gf_dirent_t *entries,
while (filled_size < size) {
in_case = glfs_telldir(glfd);
if (in_case == -1) {
- gf_log(this->name, GF_LOG_ERROR, "telldir failed");
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_TELLDIR_FAILED,
+ "telldir failed");
break;
}
@@ -1450,7 +1482,14 @@ svs_glfs_readdir(xlator_t *this, glfs_fd_t *glfd, gf_dirent_t *entries,
entry = gf_dirent_for_name(de.d_name);
if (!entry) {
- gf_log(this->name, GF_LOG_ERROR,
+ /*
+ * Since gf_dirent_for_name can return
+ * NULL only when it fails to allocate
+ * memory for the directory entry,
+ * SVS_MSG_NO_MEMORY is used as the
+ * message-id.
+ */
+ gf_msg(this->name, GF_LOG_ERROR, errno, SVS_MSG_NO_MEMORY,
"could not create gf_dirent "
"for entry %s: (%s)",
entry->d_name, strerror(errno));
@@ -1546,9 +1585,9 @@ svs_readdirp_fill(xlator_t *this, inode_t *parent, svs_inode_t *parent_ctx,
*/
inode_ctx = svs_inode_ctx_get_or_new(this, inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to "
- "allocate inode context for %s",
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, SVS_MSG_NO_MEMORY,
+ "failed to allocate inode "
+ "context for %s",
entry->d_name);
inode_unref(entry->inode);
entry->inode = NULL;
@@ -1627,12 +1666,13 @@ svs_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
parent_ctx = svs_inode_ctx_get(this, fd->inode);
if (!parent_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"failed to get the inode "
"context for %s",
uuid_utoa(fd->inode->gfid));
- op_ret = -1;
- op_errno = EINVAL;
goto unwind;
}
@@ -1654,12 +1694,13 @@ svs_readdirp(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
} else {
svs_fd = svs_fd_ctx_get_or_new(this, fd);
if (!svs_fd) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to get the "
- "fd context %s",
- uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = EBADFD;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_FD_CONTEXT_FAILED,
+ "failed to get the fd context "
+ "for the inode %s",
+ uuid_utoa(fd->inode->gfid));
goto unwind;
}
@@ -1717,12 +1758,13 @@ svs_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
inode_ctx = svs_inode_ctx_get(this, fd->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"inode context not found in "
"the inode %s",
uuid_utoa(fd->inode->gfid));
- op_ret = -1;
- op_errno = EINVAL;
goto unwind;
}
@@ -1735,12 +1777,13 @@ svs_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
} else {
svs_fd = svs_fd_ctx_get_or_new(this, fd);
if (!svs_fd) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to get the "
- "fd context %s",
- uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = EBADFD;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_FD_CONTEXT_FAILED,
+ "failed to get the fd "
+ "context for %s",
+ uuid_utoa(fd->inode->gfid));
goto unwind;
}
@@ -1855,11 +1898,12 @@ svs_get_handle(xlator_t *this, loc_t *loc, svs_inode_t *inode_ctx,
parent_ctx = svs_inode_ctx_get(this, parent);
if (!parent_ctx) {
- gf_log(this->name, GF_LOG_WARNING,
+ *op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_WARNING, *op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"failed to get the parent "
"context for %s (%s)",
loc->path, uuid_utoa_r(loc->inode->gfid, uuid1));
- *op_errno = EINVAL;
goto out;
}
@@ -1916,12 +1960,11 @@ svs_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
inode_ctx = svs_inode_ctx_get(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "inode context not found for"
- " %s",
- uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
+ "inode context not found for %s", uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -1934,12 +1977,12 @@ svs_stat(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
ret = glfs_h_stat(fs, object, &stat);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs_h_stat on %s "
- "(gfid: %s) failed",
- loc->name, uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_STAT_FAILED,
+ "glfs_h_stat on %s (gfid: %s) "
+ "failed",
+ loc->name, uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -1991,12 +2034,13 @@ svs_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
inode_ctx = svs_inode_ctx_get(this, fd->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"inode context not found for"
" the inode %s",
uuid_utoa(fd->inode->gfid));
- op_ret = -1;
- op_errno = EINVAL;
goto out;
}
@@ -2005,37 +2049,37 @@ svs_fstat(call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata)
op_ret = 0;
} else {
if (!(svs_inode_ctx_glfs_mapping(this, inode_ctx))) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs instance "
- "instance %p to which the inode %s belongs "
- "to does not exist. That snapshot might have "
- "been deleted or deactivated",
- inode_ctx->fs, uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = EBADF;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_FS_INSTANCE_INVALID,
+ "glfs instance %p to which the inode %s "
+ "belongs to does not exist. That snapshot "
+ "corresponding to the fs instance "
+ "might have been deleted or deactivated.",
+ inode_ctx->fs, uuid_utoa(fd->inode->gfid));
goto out;
}
sfd = svs_fd_ctx_get_or_new(this, fd);
if (!sfd) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to get the "
- "fd context for %s",
- uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = EBADFD;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_FD_CONTEXT_FAILED,
+ "failed to get the fd context "
+ "for %s",
+ uuid_utoa(fd->inode->gfid));
goto out;
}
glfd = sfd->fd;
ret = glfs_fstat(glfd, &stat);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs_fstat on "
- "gfid: %s failed",
- uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_STAT_FAILED,
+ "glfs_fstat on gfid: %s failed", uuid_utoa(fd->inode->gfid));
goto out;
}
@@ -2083,12 +2127,11 @@ svs_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
*/
inode_ctx = svs_inode_ctx_get(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "inode context not found for"
- " %s",
- uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
+ "inode context not found for %s", uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -2097,12 +2140,12 @@ svs_statfs(call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
ret = glfs_h_statfs(fs, object, &buf);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs_h_statvfs on %s "
- "(gfid: %s) failed",
- loc->name, uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_STATFS_FAILED,
+ "glfs_h_statvfs on %s (gfid: %s) "
+ "failed",
+ loc->name, uuid_utoa(loc->inode->gfid));
goto out;
}
op_ret = ret;
@@ -2136,9 +2179,10 @@ svs_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
inode_ctx = svs_inode_ctx_get(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "inode context for %s "
- "(gfid: %s) not found",
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
+ "inode context for %s (gfid: %s) "
+ "not found",
loc->name, uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -2157,23 +2201,22 @@ svs_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags,
glfd = glfs_h_open(fs, object, flags);
if (!glfd) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs_h_open on %s failed "
- "(gfid: %s)",
- loc->name, uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_OPEN_FAILED,
+ "glfs_h_open on %s failed (gfid: %s)", loc->name,
+ uuid_utoa(loc->inode->gfid));
goto out;
}
sfd = svs_fd_ctx_get_or_new(this, fd);
if (!sfd) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to allocate fd "
- "context for %s (gfid: %s)",
- loc->name, uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
+ "failed to allocate fd context "
+ "for %s (gfid: %s)",
+ loc->name, uuid_utoa(loc->inode->gfid));
glfs_close(glfd);
goto out;
}
@@ -2226,24 +2269,25 @@ svs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
}
if (!svs_inode_glfs_mapping(this, fd->inode)) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs instance to "
- "which the inode %s receiving read request belongs, "
- "does not exist anymore",
- uuid_utoa(fd->inode->gfid));
op_ret = -1;
op_errno = EBADF; /* should this be some other error? */
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_FS_INSTANCE_INVALID,
+ "glfs instance to which the inode "
+ "%s receiving read request belongs, "
+ "does not exist anymore",
+ uuid_utoa(fd->inode->gfid));
goto out;
}
sfd = svs_fd_ctx_get_or_new(this, fd);
if (!sfd) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = EBADFD;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"failed to get the fd "
"context for %s",
uuid_utoa(fd->inode->gfid));
- op_ret = -1;
- op_errno = EBADFD;
goto out;
}
@@ -2253,6 +2297,11 @@ svs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (!iobuf) {
op_ret = -1;
op_errno = ENOMEM;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_NO_MEMORY,
+ "failed to "
+ "allocate iobuf while reading the "
+ "file with gfid %s",
+ uuid_utoa(fd->inode->gfid));
goto out;
}
@@ -2260,7 +2309,8 @@ svs_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
if (ret < 0) {
op_ret = -1;
op_errno = errno;
- gf_log(this->name, GF_LOG_ERROR, "glfs_read failed (%s)",
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_READ_FAILED,
+ "glfs_read failed on %s (%s)", uuid_utoa(fd->inode->gfid),
strerror(op_errno));
goto out;
}
@@ -2328,12 +2378,13 @@ svs_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
inode_ctx = svs_inode_ctx_get(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
+ op_ret = -1;
+ op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
"failed to get inode context "
"for %s (gfid: %s)",
loc->name, uuid_utoa(loc->inode->gfid));
- op_ret = -1;
- op_errno = EINVAL;
goto out;
}
@@ -2342,12 +2393,12 @@ svs_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
ret = glfs_h_stat(fs, object, &stat);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
- "glfs_h_stat on %s "
- "(gfid: %s) failed",
- loc->name, uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_STAT_FAILED,
+ "glfs_h_stat on %s (gfid: %s) "
+ "failed",
+ loc->name, uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -2358,11 +2409,10 @@ svs_readlink(call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size,
buf = alloca(size + 1);
op_ret = glfs_h_readlink(fs, object, buf, size);
if (op_ret == -1) {
- gf_log(this->name, GF_LOG_ERROR,
- "readlink on %s failed "
- "(gfid: %s)",
- loc->name, uuid_utoa(loc->inode->gfid));
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_READLINK_FAILED,
+ "readlink on %s failed (gfid: %s)", loc->name,
+ uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -2404,12 +2454,11 @@ svs_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int mask,
inode_ctx = svs_inode_ctx_get(this, loc->inode);
if (!inode_ctx) {
- gf_log(this->name, GF_LOG_ERROR,
- "inode context not found for"
- " %s",
- uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = EINVAL;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno,
+ SVS_MSG_GET_INODE_CONTEXT_FAILED,
+ "inode context not found for %s", uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -2448,12 +2497,11 @@ svs_access(call_frame_t *frame, xlator_t *this, loc_t *loc, int mask,
ret = glfs_h_access(fs, object, mask);
if (ret < 0) {
- gf_log(this->name, GF_LOG_ERROR,
- "failed to access %s "
- "(gfid: %s)",
- loc->path, uuid_utoa(loc->inode->gfid));
op_ret = -1;
op_errno = errno;
+ gf_msg(this->name, GF_LOG_ERROR, op_errno, SVS_MSG_ACCESS_FAILED,
+ "failed to access %s (gfid: %s)", loc->path,
+ uuid_utoa(loc->inode->gfid));
goto out;
}
@@ -2491,7 +2539,7 @@ mem_acct_init(xlator_t *this)
ret = xlator_mem_acct_init(this, gf_svs_mt_end + 1);
if (ret != 0) {
- gf_log(this->name, GF_LOG_WARNING,
+ gf_msg(this->name, GF_LOG_WARNING, 0, SVS_MSG_MEM_ACNT_FAILED,
"Memory accounting"
" init failed");
return ret;
@@ -2508,12 +2556,16 @@ init(xlator_t *this)
/* This can be the top of graph in certain cases */
if (!this->parents) {
- gf_log(this->name, GF_LOG_DEBUG, "dangling volume. check volfile ");
+ gf_msg_debug(this->name, 0, "dangling volume. check volfile ");
}
priv = GF_CALLOC(1, sizeof(*priv), gf_svs_mt_priv_t);
- if (!priv)
+ if (!priv) {
+ gf_msg(this->name, GF_LOG_ERROR, ENOMEM, SVS_MSG_NO_MEMORY,
+ "failed to "
+ "allocate memory for this->private ");
goto out;
+ }
this->private = priv;
@@ -2531,7 +2583,7 @@ init(xlator_t *this)
/* happen.*/
ret = svs_mgmt_init(this);
if (ret) {
- gf_log(this->name, GF_LOG_WARNING,
+ gf_msg(this->name, GF_LOG_WARNING, EINVAL, SVS_MSG_MGMT_INIT_FAILED,
"failed to initiate the "
"mgmt rpc callback for svs. Dymamic management of the"
"snapshots will not happen");
@@ -2541,7 +2593,8 @@ init(xlator_t *this)
/* get the list of snaps first to return to client xlator */
ret = svs_get_snapshot_list(this);
if (ret) {
- gf_log(this->name, GF_LOG_ERROR,
+ gf_msg(this->name, GF_LOG_ERROR, EINVAL,
+ SVS_MSG_GET_SNAPSHOT_LIST_FAILED,
"Error initializing snaplist infrastructure");
ret = -1;
goto out;
@@ -2571,12 +2624,14 @@ fini(xlator_t *this)
this->private = NULL;
ctx = this->ctx;
if (!ctx)
- gf_log(this->name, GF_LOG_ERROR, "Invalid ctx found");
+ gf_msg(this->name, GF_LOG_ERROR, 0, SVS_MSG_INVALID_GLFS_CTX,
+ "Invalid ctx found");
if (priv) {
ret = LOCK_DESTROY(&priv->snaplist_lock);
if (ret != 0) {
- gf_log(this->name, GF_LOG_WARNING,
+ gf_msg(this->name, GF_LOG_WARNING, errno,
+ SVS_MSG_LOCK_DESTROY_FAILED,
"Could not destroy mutex snaplist_lock");
}
diff --git a/xlators/features/snapview-server/src/snapview-server.h b/xlators/features/snapview-server/src/snapview-server.h
index e07d3bcad0c..6951d31449f 100644
--- a/xlators/features/snapview-server/src/snapview-server.h
+++ b/xlators/features/snapview-server/src/snapview-server.h
@@ -33,6 +33,7 @@
#include "rpc-clnt.h"
#include "protocol-common.h"
#include "xdr-generic.h"
+#include "snapview-server-messages.h"
#define DEFAULT_SVD_LOG_FILE_DIRECTORY DATADIR "/log/glusterfs"