summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c1228
1 files changed, 619 insertions, 609 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 6d3be0cdc69..73295eb72af 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -48,6 +48,7 @@
#include "hashfn.h"
#include "posix-aio.h"
#include "glusterfs-acl.h"
+#include "posix-messages.h"
extern char *marker_xattrs[];
#define ALIGN_SIZE 4096
@@ -113,9 +114,9 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
should not get any gfid on it */
if (__is_root_gfid (loc->pargfid) && loc->name
&& (strcmp (loc->name, GF_HIDDEN_PATH) == 0)) {
- gf_log (this->name, GF_LOG_WARNING,
- "Lookup issued on %s, which is not permitted",
- GF_HIDDEN_PATH);
+ gf_msg (this->name, GF_LOG_WARNING, EPERM,
+ P_MSG_LOOKUP_NOT_PERMITTED, "Lookup issued on %s,"
+ " which is not permitted", GF_HIDDEN_PATH);
op_errno = EPERM;
op_ret = -1;
goto out;
@@ -140,10 +141,10 @@ posix_lookup (call_frame_t *frame, xlator_t *this,
if (op_ret == -1) {
if (op_errno != ENOENT) {
- gf_log (this->name, GF_LOG_ERROR,
- "lstat on %s failed: %s",
- real_path ? real_path : "null",
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_LSTAT_FAILED,
+ "lstat on %s failed",
+ real_path ? real_path : "null");
}
entry_ret = -1;
@@ -179,9 +180,9 @@ parent:
op_ret = posix_pstat (this, loc->pargfid, par_path, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_LSTAT_FAILED, "post-operation lstat on"
+ " parent %s failed", par_path);
if (op_errno == ENOENT)
/* If parent directory is missing in a lookup,
errno should be ESTALE (bad handle) and not
@@ -195,7 +196,8 @@ parent:
op_ret = entry_ret;
out:
if (!op_ret && !gfidless && gf_uuid_is_null (buf.ia_gfid)) {
- gf_log (this->name, GF_LOG_ERROR, "buf->ia_gfid is null for "
+ gf_msg (this->name, GF_LOG_ERROR, ENODATA, P_MSG_NULL_GFID,
+ "buf->ia_gfid is null for "
"%s", (real_path) ? real_path: "");
op_ret = -1;
op_errno = ENODATA;
@@ -235,11 +237,15 @@ posix_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata)
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, (op_errno == ENOENT)?
- GF_LOG_DEBUG:GF_LOG_ERROR,
- "lstat on %s failed: %s",
- real_path ? real_path : "<null>",
- strerror (op_errno));
+ if (op_errno == ENOENT) {
+ gf_msg_debug(this->name, 0, "lstat on %s failed: %s",
+ real_path ? real_path : "<null>",
+ strerror (op_errno));
+ } else {
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_LSTAT_FAILED, "lstat on %s failed",
+ real_path ? real_path : "<null>");
+ }
goto out;
}
if (xdata)
@@ -267,8 +273,8 @@ posix_do_chmod (xlator_t *this, const char *path, struct iatt *stbuf)
ret = sys_lstat (path, &stat);
if (ret != 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "lstat failed: %s (%s)", path, strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_LSTAT_FAILED,
+ "lstat failed: %s", path);
goto out;
}
@@ -281,8 +287,7 @@ posix_do_chmod (xlator_t *this, const char *path, struct iatt *stbuf)
/* in Linux symlinks are always in mode 0777 and no
such call as lchmod exists.
*/
- gf_log (this->name, GF_LOG_DEBUG,
- "%s (%s)", path, strerror (errno));
+ gf_msg_debug (this->name, 0, "%s (%s)", path, strerror (errno));
if (is_symlink) {
ret = 0;
goto out;
@@ -327,8 +332,8 @@ posix_do_utimes (xlator_t *this,
ret = sys_lstat (path, &stat);
if (ret != 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "%s (%s)", path, strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_FILE_OP_FAILED, "%s", path);
goto out;
}
@@ -342,8 +347,8 @@ posix_do_utimes (xlator_t *this,
ret = lutimes (path, tv);
if ((ret == -1) && (errno == ENOSYS)) {
- gf_log (this->name, GF_LOG_DEBUG,
- "%s (%s)", path, strerror (errno));
+ gf_msg_debug (this->name, 0, "%s (%s)",
+ path, strerror (errno));
if (is_symlink) {
ret = 0;
goto out;
@@ -377,9 +382,9 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "setattr (lstat) on %s failed: %s",
- real_path ? real_path : "<null>", strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "setattr (lstat) on %s failed",
+ real_path ? real_path : "<null>");
goto out;
}
@@ -387,9 +392,9 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_do_chown (this, real_path, stbuf, valid);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "setattr (chown) on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_CHOWN_FAILED, "setattr (chown) on %s "
+ "failed", real_path);
goto out;
}
}
@@ -398,9 +403,9 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_do_chmod (this, real_path, stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "setattr (chmod) on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_CHMOD_FAILED, "setattr (chmod) on %s "
+ "failed", real_path);
goto out;
}
}
@@ -409,9 +414,9 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_do_utimes (this, real_path, stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "setattr (utimes) on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_UTIMES_FAILED, "setattr (utimes) on %s "
+ "failed", real_path);
goto out;
}
}
@@ -420,9 +425,9 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
op_ret = lchown (real_path, -1, -1);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lchown (%s, -1, -1) failed => (%s)",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_LCHOWN_FAILED, "lchown (%s, -1, -1) "
+ "failed", real_path);
goto out;
}
@@ -431,9 +436,8 @@ posix_setattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->gfid, real_path, &statpost);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "setattr (lstat) on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "setattr (lstat) on %s failed", real_path);
goto out;
}
@@ -485,7 +489,8 @@ posix_do_futimes (xlator_t *this,
int fd,
struct iatt *stbuf)
{
- gf_log (this->name, GF_LOG_WARNING, "function not implemented fd(%d)", fd);
+ gf_msg (this->name, GF_LOG_WARNING, ENOSYS, P_MSG_UNKNOWN_OP,
+ "function not implemented fd(%d)", fd);
errno = ENOSYS;
return -1;
@@ -513,17 +518,15 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_DEBUG,
- "pfd is NULL from fd=%p", fd);
+ gf_msg_debug (this->name, 0, "pfd is NULL from fd=%p", fd);
goto out;
}
op_ret = posix_fdstat (this, pfd->fd, &statpre);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fsetattr (fstat) failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "fsetattr (fstat) failed on fd=%p", fd);
goto out;
}
@@ -531,9 +534,9 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_do_fchown (this, pfd->fd, stbuf, valid);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fsetattr (fchown) failed on fd=%p: %s",
- fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FCHOWN_FAILED, "fsetattr (fchown) failed"
+ " on fd=%p", fd);
goto out;
}
@@ -543,9 +546,9 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_do_fchmod (this, pfd->fd, stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fsetattr (fchmod) failed on fd=%p: %s",
- fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FCHMOD_FAILED, "fsetattr (fchmod) failed"
+ " on fd=%p", fd);
goto out;
}
}
@@ -554,9 +557,9 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_do_futimes (this, pfd->fd, stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fsetattr (futimes) on failed fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FUTIMES_FAILED, "fsetattr (futimes) on "
+ "failed fd=%p", fd);
goto out;
}
}
@@ -565,9 +568,10 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
op_ret = fchown (pfd->fd, -1, -1);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fchown (%d, -1, -1) failed => (%s)",
- pfd->fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FCHOWN_FAILED,
+ "fchown (%d, -1, -1) failed",
+ pfd->fd);
goto out;
}
@@ -576,9 +580,8 @@ posix_fsetattr (call_frame_t *frame, xlator_t *this,
op_ret = posix_fdstat (this, pfd->fd, &statpost);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fsetattr (fstat) failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "fsetattr (fstat) failed on fd=%p", fd);
goto out;
}
@@ -611,17 +614,15 @@ posix_do_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "pfd is NULL from fd=%p", fd);
+ gf_msg_debug (this->name, 0, "pfd is NULL from fd=%p", fd);
goto out;
}
ret = posix_fdstat (this, pfd->fd, statpre);
if (ret == -1) {
ret = -errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fallocate (fstat) failed on fd=%p: %s", fd,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "fallocate (fstat) failed on fd=%p", fd);
goto out;
}
@@ -634,9 +635,8 @@ posix_do_fallocate(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags,
ret = posix_fdstat (this, pfd->fd, statpost);
if (ret == -1) {
ret = -errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fallocate (fstat) failed on fd=%p: %s", fd,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "fallocate (fstat) failed on fd=%p", fd);
goto out;
}
@@ -696,9 +696,6 @@ _posix_do_zerofill(int fd, off_t offset, off_t len, int o_direct)
if (o_direct) {
alloc_buf = _page_aligned_alloc(vect_size, &iov_base);
if (!alloc_buf) {
- gf_log ("_posix_do_zerofill", GF_LOG_DEBUG,
- "memory alloc failed, vect_size %d: %s",
- vect_size, strerror(errno));
GF_FREE(vector);
return -1;
}
@@ -763,33 +760,31 @@ posix_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "pfd is NULL from fd=%p", fd);
+ gf_msg_debug (this->name, 0, "pfd is NULL from fd=%p", fd);
goto out;
}
ret = posix_fdstat (this, pfd->fd, statpre);
if (ret == -1) {
ret = -errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation fstat failed on fd = %p: %s", fd,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "pre-operation fstat failed on fd = %p", fd);
goto out;
}
ret = _posix_do_zerofill(pfd->fd, offset, len, pfd->flags & O_DIRECT);
if (ret < 0) {
ret = -errno;
- gf_log(this->name, GF_LOG_ERROR,
- "zerofill failed on fd %d length %" PRId64 " %s",
- pfd->fd, len, strerror(errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_ZEROFILL_FAILED,
+ "zerofill failed on fd %d length %" PRId64 ,
+ pfd->fd, len);
goto out;
}
if (pfd->flags & (O_SYNC|O_DSYNC)) {
ret = fsync (pfd->fd);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "fsync() in writev on fd %d failed: %s",
- pfd->fd, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_WRITEV_FAILED, "fsync() in writev on fd"
+ "%d failed", pfd->fd);
ret = -errno;
goto out;
}
@@ -798,9 +793,8 @@ posix_do_zerofill(call_frame_t *frame, xlator_t *this, fd_t *fd,
ret = posix_fdstat (this, pfd->fd, statpost);
if (ret == -1) {
ret = -errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post operation fstat failed on fd=%p: %s", fd,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "post operation fstat failed on fd=%p", fd);
goto out;
}
@@ -894,7 +888,8 @@ posix_ipc (call_frame_t *frame, xlator_t *this, int32_t op, dict_t *xdata)
* means somebody sent one that nobody else recognized, which is an
* error much like an uncaught exception.
*/
- gf_log (this->name, GF_LOG_ERROR, "GF_LOG_IPC(%d) not handled", op);
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_IPC_NOT_HANDLE,
+ "GF_LOG_IPC(%d) not handled", op);
STACK_UNWIND_STRICT (ipc, frame, -1, -EOPNOTSUPP, NULL);
return 0;
@@ -929,18 +924,16 @@ posix_opendir (call_frame_t *frame, xlator_t *this,
if (dir == NULL) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "opendir failed on %s: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_OPENDIR_FAILED,
+ "opendir failed on %s", real_path);
goto out;
}
op_ret = dirfd (dir);
if (op_ret < 0) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "dirfd() failed on %s: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_DIRFD_FAILED,
+ "dirfd() failed on %s", real_path);
goto out;
}
@@ -956,9 +949,9 @@ posix_opendir (call_frame_t *frame, xlator_t *this,
op_ret = fd_ctx_set (fd, this, (uint64_t)(long)pfd);
if (op_ret)
- gf_log (this->name, GF_LOG_WARNING,
- "failed to set the fd context path=%s fd=%p",
- real_path, fd);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_FD_PATH_SETTING_FAILED, "failed to set the fd"
+ "context path=%s fd=%p", real_path, fd);
op_ret = 0;
@@ -994,14 +987,13 @@ posix_releasedir (xlator_t *this,
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;
}
pfd = (struct posix_fd *)(long)tmp_pfd;
if (!pfd->dir) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_PFD_NULL,
"pfd->dir is NULL for fd=%p", fd);
goto out;
}
@@ -1042,19 +1034,17 @@ posix_readlink (call_frame_t *frame, xlator_t *this,
MAKE_INODE_HANDLE (real_path, this, loc, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lstat on %s failed: %s",
- loc->path ? loc->path : "<null>",
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat on %s failed",
+ loc->path ? loc->path : "<null>");
goto out;
}
op_ret = sys_readlink (real_path, dest, size);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "readlink on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_READYLINK_FAILED,
+ "readlink on %s failed", real_path);
goto out;
}
@@ -1113,9 +1103,9 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent of %s failed: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent of %s failed",
+ real_path);
goto out;
}
@@ -1130,9 +1120,8 @@ posix_mknod (call_frame_t *frame, xlator_t *this,
dict_del (xdata, GLUSTERFS_INTERNAL_FOP_KEY);
op_ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
if (op_ret) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to get the gfid from dict for %s",
- loc->path);
+ gf_msg_debug (this->name, 0, "failed to get the gfid from "
+ "dict for %s", loc->path);
goto real_op;
}
op_ret = posix_create_link_if_gfid_exists (this, uuid_req,
@@ -1158,17 +1147,17 @@ real_op:
doesn't work */
tmp_fd = creat (real_path, mode);
if (tmp_fd == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "create failed on %s: %s",
- real_path, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_CREATE_FAILED, "create failed on"
+ "%s", real_path);
goto out;
}
close (tmp_fd);
} else {
- gf_log (this->name, GF_LOG_ERROR,
- "mknod on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_MKNOD_FAILED,
+ "mknod on %s failed", real_path);
goto out;
}
}
@@ -1179,9 +1168,8 @@ real_op:
op_ret = lchown (real_path, frame->root->uid, gid);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lchown on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LCHOWN_FAILED,
+ "lchown on %s failed", real_path);
goto out;
}
#endif
@@ -1189,9 +1177,8 @@ real_op:
post_op:
op_ret = posix_acl_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting ACLs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_ACL_FAILED,
+ "setting ACLs on %s failed", real_path);
}
if (priv->update_pgfid_nlinks) {
@@ -1206,15 +1193,14 @@ post_op:
ignore:
op_ret = posix_entry_create_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting xattrs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_XATTR_FAILED,
+ "setting xattrs on %s failed", real_path);
}
if (!linked) {
op_ret = posix_gfid_set (this, real_path, loc, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED,
"setting gfid on %s failed", real_path);
} else {
gfid_set = _gf_true;
@@ -1224,18 +1210,17 @@ ignore:
op_ret = posix_pstat (this, NULL, real_path, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "mknod on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_MKNOD_FAILED,
+ "mknod on %s failed", real_path);
goto out;
}
op_ret = posix_pstat (this, loc->pargfid, par_path, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -1290,9 +1275,9 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
should not get created from a user request */
if (__is_root_gfid (loc->pargfid) &&
(strcmp (loc->name, GF_HIDDEN_PATH) == 0)) {
- gf_log (this->name, GF_LOG_WARNING,
- "mkdir issued on %s, which is not permitted",
- GF_HIDDEN_PATH);
+ gf_msg (this->name, GF_LOG_WARNING, EPERM,
+ P_MSG_MKDIR_NOT_PERMITTED, "mkdir issued on %s, which"
+ "is not permitted", GF_HIDDEN_PATH);
op_errno = EPERM;
op_ret = -1;
goto out;
@@ -1327,11 +1312,11 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
posix_handle_path (this, uuid_req, NULL,
gfid_path, size);
- gf_log (this->name, GF_LOG_WARNING,
- "mkdir (%s): gfid (%s) is already associated "
- "with directory (%s). Hence, both directories "
- "will share same gfid and this can lead to "
- "inconsistencies.", loc->path,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_DIR_OF_SAME_ID, "mkdir (%s): gfid (%s) is"
+ "already associated with directory (%s). Hence,"
+ "both directories will share same gfid and this"
+ "can lead to inconsistencies.", loc->path,
uuid_utoa (uuid_req), gfid_path ? gfid_path
: "<NULL>");
}
@@ -1340,9 +1325,9 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -1354,9 +1339,8 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
op_ret = mkdir (real_path, mode);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "mkdir of %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_MKDIR_FAILED,
+ "mkdir of %s failed", real_path);
goto out;
}
@@ -1366,29 +1350,26 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
op_ret = chown (real_path, frame->root->uid, gid);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "chown on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_CHOWN_FAILED,
+ "chown on %s failed", real_path);
goto out;
}
#endif
op_ret = posix_acl_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting ACLs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_ACL_FAILED,
+ "setting ACLs on %s failed ", real_path);
}
op_ret = posix_entry_create_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting xattrs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_XATTR_FAILED,
+ "setting xattrs on %s failed", real_path);
}
op_ret = posix_gfid_set (this, real_path, loc, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED,
"setting gfid on %s failed", real_path);
} else {
gfid_set = _gf_true;
@@ -1397,18 +1378,17 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, NULL, real_path, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lstat on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat on %s failed", real_path);
goto out;
}
op_ret = posix_pstat (this, loc->pargfid, par_path, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent of %s failed: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent of %s failed",
+ real_path);
goto out;
}
@@ -1443,10 +1423,10 @@ posix_unlink_gfid_handle_and_entry (xlator_t *this, const char *real_path,
if (stbuf && stbuf->ia_nlink == 1) {
ret = posix_handle_unset (this, stbuf->ia_gfid, NULL);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "unlink of gfid handle failed for path:%s with"
- " gfid %s with errno:%s", real_path,
- uuid_utoa (stbuf->ia_gfid), strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_UNLINK_FAILED, "unlink of gfid handle "
+ "failed for path:%s with gfid %s",
+ real_path, uuid_utoa (stbuf->ia_gfid));
}
}
@@ -1456,9 +1436,8 @@ posix_unlink_gfid_handle_and_entry (xlator_t *this, const char *real_path,
if (op_errno)
*op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "unlink of %s failed: %s", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_UNLINK_FAILED,
+ "unlink of %s failed", real_path);
goto err;
}
@@ -1508,9 +1487,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -1529,8 +1508,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
UNLOCK (&loc->inode->lock);
- gf_log (this->name, GF_LOG_INFO, "open-fd-key-status: "
- "%"PRIu32" for %s", skip_unlink, real_path);
+ gf_msg (this->name, GF_LOG_INFO, 0, P_MSG_KEY_STATUS_INFO,
+ "open-fd-key-status: %"PRIu32" for %s", skip_unlink,
+ real_path);
if (skip_unlink) {
op_ret = -1;
@@ -1559,8 +1539,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
UNLOCK (&loc->inode->lock);
- gf_log (this->name, GF_LOG_INFO, "linkto_xattr status: "
- "%"PRIu32" for %s", skip_unlink, real_path);
+ gf_msg (this->name, GF_LOG_INFO, 0, P_MSG_XATTR_STATUS,
+ "linkto_xattr status: %"PRIu32" for %s", skip_unlink,
+ real_path);
if (skip_unlink) {
op_ret = -1;
@@ -1576,9 +1557,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
if (fd == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "open of %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_OPEN_FAILED,
+ "open of %s failed", real_path);
goto out;
}
}
@@ -1597,7 +1578,8 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
UNLOCK (&loc->inode->lock);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_WARNING, "modification of "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_XATTR_FAILED, "modification of "
"parent gfid xattr failed (path:%s gfid:%s)",
real_path, uuid_utoa (loc->inode->gfid));
if (op_errno != ENOATTR)
@@ -1615,9 +1597,9 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->pargfid, par_path, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -1646,9 +1628,6 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
* all records if link count == 0*/
if (!unwind_dict) {
op_ret = 0;
- gf_log (this->name, GF_LOG_WARNING,
- "Memory allocation failure while "
- "creating unwind_dict");
goto out;
}
/* Even if unwind_dict fails to set CTR_RESPONSE_LINK_COUNT_XDATA we
@@ -1658,7 +1637,7 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
op_ret = dict_set_uint32 (unwind_dict, CTR_RESPONSE_LINK_COUNT_XDATA,
stbuf.ia_nlink);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_SET_XDATA_FAIL,
"Failed to set CTR_RESPONSE_LINK_COUNT_XDATA");
}
@@ -1709,9 +1688,9 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
should not get deleted from inside process */
if (__is_root_gfid (loc->pargfid) &&
(strcmp (loc->name, GF_HIDDEN_PATH) == 0)) {
- gf_log (this->name, GF_LOG_WARNING,
- "rmdir issued on %s, which is not permitted",
- GF_HIDDEN_PATH);
+ gf_msg (this->name, GF_LOG_WARNING, EPERM,
+ P_MSG_RMDIR_NOT_PERMITTED, "rmdir issued on %s, which"
+ "is not permitted", GF_HIDDEN_PATH);
op_errno = EPERM;
op_ret = -1;
goto out;
@@ -1729,9 +1708,9 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -1743,9 +1722,9 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
op_ret = mkdir (priv->trash_path, 0755);
if (errno != EEXIST && op_ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "mkdir of %s failed: %s", priv->trash_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_MKDIR_FAILED,
+ "mkdir of %s failed", priv->trash_path);
} else {
sprintf (tmp_path, "%s/%s", priv->trash_path, gfid_str);
op_ret = rename (real_path, tmp_path);
@@ -1765,25 +1744,28 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
/* No need to log a common error as ENOTEMPTY */
if (op_ret == -1 && op_errno != ENOTEMPTY) {
- gf_log (this->name, GF_LOG_ERROR,
- "rmdir of %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_RMDIR_FAILED,
+ "rmdir of %s failed", real_path);
}
if (op_ret == -1) {
- gf_log (this->name,
- (op_errno == ENOTEMPTY) ? GF_LOG_DEBUG : GF_LOG_ERROR,
- "%s on %s failed", (flags) ? "rename" : "rmdir",
- real_path);
+ if (op_errno == ENOTEMPTY) {
+ gf_msg_debug (this->name, 0, "%s on %s failed", (flags)
+ ? "rename" : "rmdir", real_path);
+ } else {
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_DIR_OPERATION_FAILED, "%s on %s failed",
+ (flags) ? "rename" : "rmdir", real_path);
+ }
goto out;
}
op_ret = posix_pstat (this, loc->pargfid, par_path, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent of %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent of %s failed",
+ par_path);
goto out;
}
@@ -1838,9 +1820,9 @@ posix_symlink (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -1852,9 +1834,9 @@ posix_symlink (call_frame_t *frame, xlator_t *this,
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "symlink of %s --> %s failed: %s",
- real_path, linkname, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_SYMLINK_FAILED,
+ "symlink of %s --> %s failed",
+ real_path, linkname);
goto out;
}
@@ -1864,17 +1846,15 @@ posix_symlink (call_frame_t *frame, xlator_t *this,
op_ret = lchown (real_path, frame->root->uid, gid);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lchown failed on %s: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LCHOWN_FAILED,
+ "lchown failed on %s", real_path);
goto out;
}
#endif
op_ret = posix_acl_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting ACLs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_ACL_FAILED,
+ "setting ACLs on %s failed", real_path);
}
if (priv->update_pgfid_nlinks) {
@@ -1887,14 +1867,13 @@ posix_symlink (call_frame_t *frame, xlator_t *this,
ignore:
op_ret = posix_entry_create_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting xattrs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_XATTR_FAILED,
+ "setting xattrs on %s failed ", real_path);
}
op_ret = posix_gfid_set (this, real_path, loc, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED,
"setting gfid on %s failed", real_path);
} else {
gfid_set = _gf_true;
@@ -1903,18 +1882,17 @@ ignore:
op_ret = posix_pstat (this, NULL, real_path, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lstat failed on %s: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat failed on %s", real_path);
goto out;
}
op_ret = posix_pstat (this, loc->pargfid, par_path, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -1992,18 +1970,18 @@ posix_rename (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, oldloc->pargfid, par_oldpath, &preoldparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent %s failed: %s",
- par_oldpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent %s failed",
+ par_oldpath);
goto out;
}
op_ret = posix_pstat (this, newloc->pargfid, par_newpath, &prenewparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent of %s failed: %s",
- par_newpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent of %s failed",
+ par_newpath);
goto out;
}
@@ -2018,7 +1996,7 @@ posix_rename (call_frame_t *frame, xlator_t *this,
}
if (was_present && IA_ISDIR(stbuf.ia_type) && !newloc->inode) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, EEXIST, P_MSG_DIR_FOUND,
"found directory at %s while expecting ENOENT",
real_newpath);
op_ret = -1;
@@ -2028,7 +2006,7 @@ posix_rename (call_frame_t *frame, xlator_t *this,
if (was_present && IA_ISDIR(stbuf.ia_type) &&
gf_uuid_compare (newloc->inode->gfid, stbuf.ia_gfid)) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, EEXIST, P_MSG_DIR_FOUND,
"found directory %s at %s while renaming %s",
uuid_utoa_r (newloc->inode->gfid, olddirid),
real_newpath,
@@ -2058,12 +2036,17 @@ posix_rename (call_frame_t *frame, xlator_t *this,
op_ret = sys_rename (real_oldpath, real_newpath);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name,
- (op_errno == ENOTEMPTY ? GF_LOG_DEBUG
- : GF_LOG_ERROR),
- "rename of %s to %s failed: %s",
- real_oldpath, real_newpath,
- strerror (op_errno));
+ if (op_errno == ENOTEMPTY) {
+ gf_msg_debug (this->name, 0, "rename of %s to"
+ " %s failed: %s", real_oldpath,
+ real_newpath,
+ strerror (op_errno));
+ } else {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_RENAME_FAILED,
+ "rename of %s to %s failed",
+ real_oldpath, real_newpath);
+ }
if (priv->update_pgfid_nlinks
&& !IA_ISDIR (oldloc->inode->ia_type)) {
@@ -2093,7 +2076,8 @@ unlock:
UNLOCK (&oldloc->inode->lock);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_WARNING, "modification of "
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_XATTR_FAILED,
+ "modification of "
"parent gfid xattr failed (gfid:%s)",
uuid_utoa (oldloc->inode->gfid));
goto out;
@@ -2113,27 +2097,26 @@ unlock:
op_ret = posix_pstat (this, NULL, real_newpath, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lstat on %s failed: %s",
- real_newpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat on %s failed", real_newpath);
goto out;
}
op_ret = posix_pstat (this, oldloc->pargfid, par_oldpath, &postoldparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent %s failed: %s",
- par_oldpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent %s failed",
+ par_oldpath);
goto out;
}
op_ret = posix_pstat (this, newloc->pargfid, par_newpath, &postnewparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent %s failed: %s",
- par_newpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent %s failed",
+ par_newpath);
goto out;
}
@@ -2195,8 +2178,8 @@ posix_link (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, newloc->pargfid, par_newpath, &preparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "lstat failed: %s: %s",
- par_newpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat failed: %s", par_newpath);
goto out;
}
@@ -2205,9 +2188,9 @@ posix_link (call_frame_t *frame, xlator_t *this,
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "link %s to %s failed: %s",
- real_oldpath, real_newpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LINK_FAILED,
+ "link %s to %s failed",
+ real_oldpath, real_newpath);
goto out;
}
@@ -2216,17 +2199,16 @@ posix_link (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, NULL, real_newpath, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "lstat on %s failed: %s",
- real_newpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat on %s failed", real_newpath);
goto out;
}
op_ret = posix_pstat (this, newloc->pargfid, par_newpath, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "lstat failed: %s: %s",
- par_newpath, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat failed: %s", par_newpath);
goto out;
}
@@ -2244,7 +2226,8 @@ posix_link (call_frame_t *frame, xlator_t *this,
UNLOCK (&newloc->inode->lock);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_WARNING, "modification of "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_XATTR_FAILED, "modification of "
"parent gfid xattr failed (path:%s gfid:%s)",
real_newpath, uuid_utoa (newloc->inode->gfid));
goto out;
@@ -2294,26 +2277,25 @@ posix_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset,
MAKE_INODE_HANDLE (real_path, this, loc, &prebuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on %s failed: %s",
- real_path ? real_path : "<null>", strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on %s failed",
+ real_path ? real_path : "<null>");
goto out;
}
op_ret = truncate (real_path, offset);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "truncate on %s failed: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_TRUNCATE_FAILED,
+ "truncate on %s failed", real_path);
goto out;
}
op_ret = posix_pstat (this, loc->gfid, real_path, &postbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "lstat on %s failed: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "lstat on %s failed", real_path);
goto out;
}
@@ -2377,9 +2359,9 @@ posix_create (call_frame_t *frame, xlator_t *this,
op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "pre-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -2407,9 +2389,8 @@ posix_create (call_frame_t *frame, xlator_t *this,
if (_fd == -1) {
op_errno = errno;
op_ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
- "open on %s failed: %s", real_path,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_OPEN_FAILED,
+ "open on %s failed", real_path);
goto out;
}
@@ -2425,16 +2406,14 @@ posix_create (call_frame_t *frame, xlator_t *this,
op_ret = chown (real_path, frame->root->uid, gid);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "chown on %s failed: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_CHOWN_FAILED,
+ "chown on %s failed", real_path);
}
#endif
op_ret = posix_acl_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting ACLs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_ACL_FAILED,
+ "setting ACLs on %s failed", real_path);
}
if (priv->update_pgfid_nlinks) {
@@ -2447,15 +2426,14 @@ posix_create (call_frame_t *frame, xlator_t *this,
ignore:
op_ret = posix_entry_create_xattr_set (this, real_path, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "setting xattrs on %s failed (%s)", real_path,
- strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_XATTR_FAILED,
+ "setting xattrs on %s failed ", real_path);
}
fill_stat:
op_ret = posix_gfid_set (this, real_path, loc, xdata);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_GFID_FAILED,
"setting gfid on %s failed", real_path);
} else {
gfid_set = _gf_true;
@@ -2464,17 +2442,17 @@ fill_stat:
op_ret = posix_fdstat (this, _fd, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fstat on %d failed: %s", _fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "fstat on %d failed", _fd);
goto out;
}
op_ret = posix_pstat (this, loc->pargfid, par_path, &postparent);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation lstat on parent %s failed: %s",
- par_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_LSTAT_FAILED,
+ "post-operation lstat on parent %s failed",
+ par_path);
goto out;
}
@@ -2490,7 +2468,8 @@ fill_stat:
op_ret = fd_ctx_set (fd, this, (uint64_t)(long)pfd);
if (op_ret)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_FD_PATH_SETTING_FAILED,
"failed to set the fd context path=%s fd=%p",
real_path, fd);
@@ -2570,8 +2549,8 @@ posix_open (call_frame_t *frame, xlator_t *this,
if (_fd == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "open on %s, flags: %d: %s",
- real_path, flags, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FILE_OP_FAILED,
+ "open on %s, flags: %d", real_path, flags);
goto out;
}
@@ -2586,7 +2565,8 @@ posix_open (call_frame_t *frame, xlator_t *this,
op_ret = fd_ctx_set (fd, this, (uint64_t)(long)pfd);
if (op_ret)
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_FD_PATH_SETTING_FAILED,
"failed to set the fd context path=%s fd=%p",
real_path, fd);
@@ -2638,14 +2618,15 @@ posix_readv (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
goto out;
}
if (!size) {
op_errno = EINVAL;
- gf_log (this->name, GF_LOG_WARNING, "size=%"GF_PRI_SIZET, size);
+ gf_msg (this->name, GF_LOG_WARNING, EINVAL,
+ P_MSG_INVALID_ARGUMENT, "size=%"GF_PRI_SIZET, size);
goto out;
}
@@ -2659,9 +2640,8 @@ posix_readv (call_frame_t *frame, xlator_t *this,
op_ret = pread (_fd, iobuf->ptr, size, offset);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "read failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_READ_FAILED,
+ "read failed on fd=%p", fd);
goto out;
}
@@ -2686,9 +2666,8 @@ posix_readv (call_frame_t *frame, xlator_t *this,
op_ret = posix_fdstat (this, _fd, &stbuf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fstat failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "fstat failed on fd=%p", fd);
goto out;
}
@@ -2813,16 +2792,17 @@ _fill_writev_xdata (fd_t *fd, dict_t *xdata, xlator_t *this, int is_append)
ret = dict_set_uint32 (rsp_xdata, GLUSTERFS_OPEN_FD_COUNT,
fd->inode->fd_count);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING, "%s: Failed to set "
- "dictionary value for %s", uuid_utoa (fd->inode->gfid),
- GLUSTERFS_OPEN_FD_COUNT);
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value for %s",
+ uuid_utoa (fd->inode->gfid), GLUSTERFS_OPEN_FD_COUNT);
}
ret = dict_set_uint32 (rsp_xdata, GLUSTERFS_WRITE_IS_APPEND,
is_append);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING, "%s: Failed to set "
- "dictionary value for %s", uuid_utoa (fd->inode->gfid),
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_DICT_SET_FAILED,
+ "%s: Failed to set dictionary value for %s",
+ uuid_utoa (fd->inode->gfid),
GLUSTERFS_WRITE_IS_APPEND);
}
out:
@@ -2858,7 +2838,7 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, ret, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
op_errno = -ret;
goto out;
@@ -2880,9 +2860,8 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
op_ret = posix_fdstat (this, _fd, &preop);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation fstat failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "pre-operation fstat failed on fd=%p", fd);
goto out;
}
@@ -2902,8 +2881,9 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
if (op_ret < 0) {
op_errno = -op_ret;
op_ret = -1;
- gf_log (this->name, GF_LOG_ERROR, "write failed: offset %"PRIu64
- ", %s", offset, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno, P_MSG_WRITE_FAILED,
+ "write failed: offset %"PRIu64
+ ",", offset);
goto out;
}
@@ -2922,9 +2902,10 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
if (flags & (O_SYNC|O_DSYNC)) {
ret = fsync (_fd);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
- "fsync() in writev on fd %d failed: %s",
- _fd, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_WRITEV_FAILED,
+ "fsync() in writev on fd %d failed",
+ _fd);
op_ret = -1;
op_errno = errno;
goto out;
@@ -2935,9 +2916,10 @@ posix_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
if (ret == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation fstat failed on fd=%p: %s",
- fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FSTAT_FAILED,
+ "post-operation fstat failed on fd=%p",
+ fd);
goto out;
}
}
@@ -2986,9 +2968,8 @@ posix_statfs (call_frame_t *frame, xlator_t *this,
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "statvfs failed on %s: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_STATVFS_FAILED,
+ "statvfs failed on %s", real_path);
goto out;
}
@@ -3025,7 +3006,7 @@ posix_flush (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL on fd=%p", fd);
goto out;
}
@@ -3054,14 +3035,14 @@ posix_release (xlator_t *this, fd_t *fd)
ret = fd_ctx_del (fd, this, &tmp_pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
goto out;
}
pfd = (struct posix_fd *)(long)tmp_pfd;
if (pfd->dir) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_DIR_NOT_NULL,
"pfd->dir is %p (not NULL) for file fd=%p",
pfd->dir, fd);
}
@@ -3148,7 +3129,7 @@ posix_fsync (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd not found in fd's ctx");
goto out;
}
@@ -3158,9 +3139,8 @@ posix_fsync (call_frame_t *frame, xlator_t *this,
op_ret = posix_fdstat (this, _fd, &preop);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_WARNING,
- "pre-operation fstat failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno, P_MSG_FSTAT_FAILED,
+ "pre-operation fstat failed on fd=%p", fd);
goto out;
}
@@ -3168,18 +3148,18 @@ posix_fsync (call_frame_t *frame, xlator_t *this,
op_ret = sys_fdatasync (_fd);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fdatasync on fd=%p failed: %s",
- fd, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FSYNC_FAILED, "fdatasync on fd=%p"
+ "failed:", fd);
goto out;
}
} else {
op_ret = sys_fsync (_fd);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "fsync on fd=%p failed: %s",
- fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FSYNC_FAILED, "fsync on fd=%p "
+ "failed", fd);
goto out;
}
}
@@ -3187,9 +3167,8 @@ posix_fsync (call_frame_t *frame, xlator_t *this,
op_ret = posix_fdstat (this, _fd, &postop);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_WARNING,
- "post-operation fstat failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno, P_MSG_FSTAT_FAILED,
+ "post-operation fstat failed on fd=%p", fd);
goto out;
}
@@ -3444,9 +3423,8 @@ posix_links_in_same_directory (char *dirpath, int count, inode_t *leaf_inode,
dirp = opendir (dirpath);
if (!dirp) {
*op_errno = errno;
- gf_log (this->name, GF_LOG_WARNING,
- "could not opendir %s: %s", dirpath,
- strerror (*op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno, P_MSG_OPEN_FAILED,
+ "could not opendir %s", dirpath);
goto out;
}
@@ -3501,8 +3479,6 @@ posix_links_in_same_directory (char *dirpath, int count, inode_t *leaf_inode,
+ 1 // ':'
+ strlen (temppath) + 1 );
if (!tempv) {
- gf_log (this->name, GF_LOG_WARNING,
- "realloc failed on path");
GF_FREE (*path);
op_ret = -1;
*op_errno = ENOMEM;
@@ -3523,9 +3499,8 @@ out:
op_ret = closedir (dirp);
if (op_ret == -1) {
*op_errno = errno;
- gf_log (this->name, GF_LOG_WARNING,
- "closedir failed: %s",
- strerror (*op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_CLOSE_FAILED, "closedir failed");
}
}
@@ -3583,9 +3558,9 @@ posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode,
" with 'user_xattr' flag)");
} else {
- gf_log (this->name, GF_LOG_WARNING,
- "listxattr failed on %s: %s",
- leaf_path, strerror (*op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_XATTR_FAILED, "listxattr failed on"
+ "%s", leaf_path);
}
@@ -3615,9 +3590,8 @@ posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode,
op_ret = sys_lstat (leaf_path, &stbuf);
if (op_ret == -1) {
*op_errno = errno;
- gf_log (this->name, GF_LOG_WARNING, "lstat failed"
- " on %s: %s", leaf_path,
- strerror (*op_errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno, P_MSG_LSTAT_FAILED,
+ "lstat failed on %s", leaf_path);
goto out;
}
@@ -3632,12 +3606,9 @@ posix_get_ancestry_non_directory (xlator_t *this, inode_t *leaf_inode,
sizeof(nlink_samepgfid));
if (op_ret == -1) {
*op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "getxattr failed on "
- "%s: key = %s (%s)",
- leaf_path,
- key,
- strerror (*op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "getxattr failed on "
+ "%s: key = %s ", leaf_path, key);
goto out;
}
@@ -3761,9 +3732,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
&file_contents);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_ERROR,
- "getting file contents failed: %s",
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_FILE_FAILED, "getting file contents"
+ "failed");
goto out;
}
}
@@ -3777,9 +3748,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (loc->inode && name && GF_POSIX_ACL_REQUEST (name)) {
ret = posix_pacl_get (real_path, name, &value);
if (ret || !value) {
- gf_log (this->name, GF_LOG_WARNING,
- "could not get acl (%s) for %s: %s", name,
- real_path, strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_ACL_FAILED, "could not get acl (%s) for"
+ "%s", name, real_path);
op_ret = -1;
op_errno = errno;
goto out;
@@ -3788,9 +3759,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
ret = dict_set_dynstr (dict, (char *)name, value);
if (ret < 0) {
GF_FREE (value);
- gf_log (this->name, GF_LOG_WARNING,
- "could not set acl (%s) for %s in dictionary: "
- "(%s)", name, real_path, strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_ACL_FAILED, "could not set acl (%s) for"
+ "%s in dictionary", name, real_path);
op_ret = -1;
op_errno = errno;
goto out;
@@ -3808,10 +3779,16 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (ret < 0) {
op_ret = -1;
op_errno = -ret;
- gf_log (this->name, (op_errno == ENOENT) ?
- GF_LOG_DEBUG : GF_LOG_WARNING,
- "Failed to get real filename (%s, %s): %s",
- loc->path, name, strerror (op_errno));
+ if (op_errno == ENOENT) {
+ gf_msg_debug (this->name, 0, "Failed to get "
+ "real filename (%s, %s)",
+ loc->path, name);
+ } else {
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ P_MSG_GETTING_FILENAME_FAILED,
+ "Failed to get real filename (%s, %s):"
+ , loc->path, name);
+ }
goto out;
}
@@ -3823,15 +3800,15 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (!list_empty (&loc->inode->fd_list)) {
ret = dict_set_uint32 (dict, (char *)name, 1);
if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
- "Failed to set dictionary value for %s",
- name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_DICT_SET_FAILED, "Failed to set "
+ "dictionary value for %s", name);
} else {
ret = dict_set_uint32 (dict, (char *)name, 0);
if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
- "Failed to set dictionary value for %s",
- name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_DICT_SET_FAILED, "Failed to set "
+ "dictionary value for %s", name);
}
goto done;
}
@@ -3857,9 +3834,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
size = strlen (dyn_rpath) + 1;
ret = dict_set_dynstr (dict, (char *)name, dyn_rpath);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "could not set value (%s) in dictionary",
- dyn_rpath);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_DICT_SET_FAILED, "could not set value"
+ " (%s) in dictionary", dyn_rpath);
GF_FREE (dyn_rpath);
}
@@ -3882,9 +3859,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
ret = dict_set_dynstr (dict, GF_XATTR_NODE_UUID_KEY,
dyn_rpath);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "could not set value (%s) in dictionary",
- dyn_rpath);
+ gf_msg (this->name, GF_LOG_WARNING, -ret,
+ P_MSG_DICT_SET_FAILED, "could not set value"
+ "(%s) in dictionary", dyn_rpath);
GF_FREE (dyn_rpath);
op_errno = -ret;
goto out;
@@ -3897,7 +3874,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
ret = inode_path (loc->inode, NULL, &path);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING, "%s: could not get "
+ gf_msg (this->name, GF_LOG_WARNING, op_errno,
+ P_MSG_INODE_PATH_GET_FAILED,
+ "%s: could not get "
"inode path", uuid_utoa (loc->inode->gfid));
goto out;
}
@@ -3906,9 +3885,6 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
ret = dict_set_dynstr (dict, GFID_TO_PATH_KEY, path);
if (ret < 0) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_WARNING,
- "could not set value (%s) in dictionary",
- host_buf);
GF_FREE (path);
goto out;
}
@@ -3930,7 +3906,8 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
op_ret = dict_set_dynstr (dict, GET_ANCESTRY_PATH_KEY, path);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_WARNING, "could not get "
+ gf_msg (this->name, GF_LOG_WARNING, -op_ret,
+ P_MSG_GET_KEY_VALUE_FAILED, "could not get "
"value for key (%s)", GET_ANCESTRY_PATH_KEY);
GF_FREE (path);
op_errno = -op_ret;
@@ -3959,9 +3936,7 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (priv->xattr_user_namespace == XATTR_STRIP) {
if (strncmp(key, "user.",5) == 0) {
key += 5;
- gf_log (this->name,
- GF_LOG_DEBUG,
- "getxattr for file %s"
+ gf_msg_debug (this->name, 0, "getxattr for file %s"
" stripping user key: %s -> %s",
real_path, keybuffer, key);
}
@@ -3979,13 +3954,13 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
"flag)");
} else if (op_errno == ENOATTR ||
op_errno == ENODATA) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"No such attribute:%s for file %s",
key, real_path);
} else {
- gf_log (this->name, GF_LOG_ERROR,
- "getxattr failed on %s: %s (%s)",
- real_path, key, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_XATTR_FAILED, "getxattr failed"
+ " on %s: %s ", real_path, key);
}
goto done;
@@ -4000,9 +3975,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (size == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "getxattr failed on "
- "%s: key = %s (%s)", real_path, key,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "getxattr failed on "
+ "%s: key = %s", real_path, key);
GF_FREE (value);
goto out;
}
@@ -4010,7 +3985,8 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
op_ret = dict_set_dynptr (dict, key, value, size);
if (op_ret < 0) {
op_errno = -op_ret;
- gf_log (this->name, GF_LOG_ERROR, "dict set operation "
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_DICT_SET_FAILED, "dict set operation "
"on %s for the key %s failed.", real_path, key);
GF_FREE (value);
goto out;
@@ -4031,9 +4007,10 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
"flag)");
}
else {
- gf_log (this->name, GF_LOG_ERROR,
- "listxattr failed on %s: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED,
+ "listxattr failed on %s",
+ real_path);
}
goto out;
}
@@ -4062,9 +4039,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (size == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "getxattr failed on "
- "%s: key = %s (%s)", real_path, keybuffer,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "getxattr failed on "
+ "%s: key = %s ", real_path, keybuffer);
break;
}
@@ -4079,9 +4056,9 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
if (size == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "getxattr failed on "
- "%s: key = %s (%s)", real_path, keybuffer,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "getxattr failed on "
+ "%s: key = %s ", real_path, keybuffer);
GF_FREE (value);
break;
}
@@ -4097,7 +4074,8 @@ posix_getxattr (call_frame_t *frame, xlator_t *this,
op_ret = dict_set_dynptr (dict, keybuffer, value, size);
if (op_ret < 0) {
op_errno = -op_ret;
- gf_log (this->name, GF_LOG_ERROR, "dict set operation "
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_DICT_SET_FAILED, "dict set operation "
"on %s for the key %s failed.", real_path,
keybuffer);
GF_FREE (value);
@@ -4158,7 +4136,7 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
goto out;
}
@@ -4174,9 +4152,9 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
if (name && !strcmp (name, GLUSTERFS_OPEN_FD_COUNT)) {
ret = dict_set_uint32 (dict, (char *)name, 1);
if (ret < 0)
- gf_log (this->name, GF_LOG_WARNING,
- "Failed to set dictionary value for %s",
- name);
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_DICT_SET_FAILED, "Failed to set "
+ "dictionary value for %s", name);
goto done;
}
@@ -4206,11 +4184,15 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
size = sys_fgetxattr (_fd, key, NULL, 0);
if (size == -1) {
op_errno = errno;
- gf_log (this->name,
- ((errno == ENODATA || errno == ENOATTR) ?
- GF_LOG_DEBUG : GF_LOG_ERROR),
- "fgetxattr failed on key %s (%s)", key,
- strerror (op_errno));
+ if (errno == ENODATA || errno == ENOATTR) {
+ gf_msg_debug (this->name, 0, "fgetxattr failed"
+ " on key %s (%s)", key,
+ strerror (op_errno));
+ } else {
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "fgetxattr failed "
+ "on key %s", key);
+ }
goto done;
}
@@ -4223,16 +4205,17 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
if (size == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "fgetxattr failed on "
- "fd %p for the key %s (%s)", fd, key,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "fgetxattr failed on "
+ "fd %p for the key %s ", fd, key);
GF_FREE (value);
goto out;
}
value [size] = '\0';
op_ret = dict_set_dynptr (dict, key, value, size);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_ERROR, "dict set operation "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_DICT_SET_FAILED, "dict set operation "
"on key %s failed", key);
GF_FREE (value);
goto out;
@@ -4251,9 +4234,9 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
"brick with 'user_xattr' flag)");
}
else {
- gf_log (this->name, GF_LOG_ERROR,
- "listxattr failed on %p: %s",
- fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "listxattr failed on %p:",
+ fd);
}
goto out;
}
@@ -4280,9 +4263,9 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
if (size == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "fgetxattr failed on "
- "fd %p for the key %s (%s)", fd, key,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "fgetxattr failed on "
+ "fd %p for the key %s ", fd, key);
break;
}
@@ -4298,9 +4281,9 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
if (size == -1) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "fgetxattr failed on "
- "the fd %p for the key %s (%s)", fd, key,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "fgetxattr failed on "
+ "the fd %p for the key %s ", fd, key);
GF_FREE (value);
break;
}
@@ -4309,7 +4292,8 @@ posix_fgetxattr (call_frame_t *frame, xlator_t *this,
op_ret = dict_set_dynptr (dict, key, value, size);
if (op_ret) {
- gf_log (this->name, GF_LOG_ERROR, "dict set operation "
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_DICT_SET_FAILED, "dict set operation "
"failed on key %s", key);
GF_FREE (value);
goto out;
@@ -4375,7 +4359,7 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
goto out;
}
@@ -4403,9 +4387,10 @@ posix_fsetxattr (call_frame_t *frame, xlator_t *this,
if (op_ret < 0) {
op_ret = -1;
op_errno = errno;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_DURABILITY_REQ_NOT_SATISFIED,
"could not satisfy durability request: "
- "reason (%s)", strerror (errno));
+ "reason ");
}
}
@@ -4450,7 +4435,7 @@ _posix_remove_xattr (dict_t *dict, char *key, data_t *value, void *data)
char *newkey = NULL;
if (priv->xattr_user_namespace == XATTR_STRIP) {
gf_remove_prefix (XATTR_USER_PREFIX, key, &newkey);
- gf_log("remove_xattr", GF_LOG_DEBUG, "key %s => %s" , key,
+ gf_msg_debug ("remove_xattr", 0, "key %s => %s" , key,
newkey);
key = newkey;
}
@@ -4473,9 +4458,9 @@ _posix_remove_xattr (dict_t *dict, char *key, data_t *value, void *data)
if (op_ret == -1) {
filler->op_errno = errno;
if (errno != ENOATTR && errno != ENODATA && errno != EPERM)
- gf_log (this->name, GF_LOG_ERROR,
- "removexattr failed on %s (for %s): %s",
- filler->real_path, key, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "removexattr failed on %s"
+ " (for %s)", filler->real_path, key);
}
#ifdef GF_DARWIN_HOST_OS
GF_FREE(newkey);
@@ -4507,14 +4492,15 @@ posix_removexattr (call_frame_t *frame, xlator_t *this,
if (!strcmp (GFID_XATTR_KEY, name)) {
- gf_log (this->name, GF_LOG_WARNING, "Remove xattr called"
- " on gfid for file %s", real_path);
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_XATTR_NOT_REMOVED,
+ "Remove xattr called on gfid for file %s", real_path);
op_ret = -1;
goto out;
}
if (!strcmp (GF_XATTR_VOL_ID_KEY, name)) {
- gf_log (this->name, GF_LOG_WARNING, "Remove xattr called"
- " on volume-id for file %s", real_path);
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_XATTR_NOT_REMOVED,
+ "Remove xattr called on volume-id for file %s",
+ real_path);
op_ret = -1;
goto out;
}
@@ -4543,9 +4529,9 @@ posix_removexattr (call_frame_t *frame, xlator_t *this,
op_errno = errno;
if (op_errno != ENOATTR && op_errno != ENODATA &&
op_errno != EPERM)
- gf_log (this->name, GF_LOG_ERROR,
- "removexattr on %s (for %s): %s", real_path,
- name, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "removexattr on %s "
+ "(for %s)", real_path, name);
goto out;
}
@@ -4587,20 +4573,20 @@ posix_fremovexattr (call_frame_t *frame, xlator_t *this,
DECLARE_OLD_FS_ID_VAR;
if (!strcmp (GFID_XATTR_KEY, name)) {
- gf_log (this->name, GF_LOG_WARNING, "Remove xattr called"
- " on gfid for file");
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_XATTR_NOT_REMOVED,
+ "Remove xattr called on gfid for file");
goto out;
}
if (!strcmp (GF_XATTR_VOL_ID_KEY, name)) {
- gf_log (this->name, GF_LOG_WARNING, "Remove xattr called"
- " on volume-id for file");
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_XATTR_NOT_REMOVED,
+ "Remove xattr called on volume-id for file");
goto out;
}
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL from fd=%p", fd);
goto out;
}
@@ -4615,9 +4601,9 @@ posix_fremovexattr (call_frame_t *frame, xlator_t *this,
op_errno = errno;
if (op_errno != ENOATTR && op_errno != ENODATA &&
op_errno != EPERM)
- gf_log (this->name, GF_LOG_ERROR,
- "fremovexattr (for %s): %s",
- name, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_XATTR_FAILED, "fremovexattr (for %s)",
+ name);
goto out;
}
@@ -4661,7 +4647,7 @@ posix_fsyncdir (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
op_errno = -ret;
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, op_errno, P_MSG_PFD_NULL,
"pfd is NULL, fd=%p", fd);
goto out;
}
@@ -4681,7 +4667,7 @@ posix_print_xattr (dict_t *this,
data_t *value,
void *data)
{
- gf_log ("posix", GF_LOG_DEBUG,
+ gf_msg_debug ("posix", 0,
"(key/val) = (%s/%d)", key, data_to_int32 (value));
}
@@ -4767,13 +4753,14 @@ _posix_handle_xattr_keyvalue_pair (dict_t *d, char *k, data_t *v,
!posix_special_xattr (marker_xattrs,
k)) {
if (filler->real_path)
- gf_log (this->name, GF_LOG_ERROR,
- "getxattr failed on %s while doing "
- "xattrop: Key:%s (%s)",
- filler->real_path,
- k, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR,
+ op_errno, P_MSG_XATTR_FAILED,
+ "getxattr failed on %s while "
+ "doing xattrop: Key:%s ",
+ filler->real_path, k);
else
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR,
+ op_errno, P_MSG_XATTR_FAILED,
"fgetxattr failed on gfid=%s "
"while doing xattrop: "
"Key:%s (%s)",
@@ -4809,11 +4796,11 @@ _posix_handle_xattr_keyvalue_pair (dict_t *d, char *k, data_t *v,
break;
default:
- gf_log (this->name, GF_LOG_ERROR,
- "Unknown xattrop type (%d) on %s. "
- "Please send a bug report to "
- "gluster-devel@gluster.org",
- optype, filler->real_path);
+ gf_msg (this->name, GF_LOG_ERROR, EINVAL,
+ P_MSG_UNKNOWN_OP, "Unknown xattrop type (%d)"
+ " on %s. Please send a bug report to "
+ "gluster-devel@gluster.org", optype,
+ filler->real_path);
op_ret = -1;
op_errno = EINVAL;
goto unlock;
@@ -4837,17 +4824,17 @@ unlock:
if (size == -1) {
if (filler->real_path)
- gf_log (this->name, GF_LOG_ERROR,
- "setxattr failed on %s while doing xattrop: "
- "key=%s (%s)", filler->real_path,
- k, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_XATTR_FAILED, "setxattr failed on %s "
+ "while doing xattrop: key=%s",
+ filler->real_path, k);
else
- gf_log (this->name, GF_LOG_ERROR,
- "fsetxattr failed on gfid=%s while doing xattrop: "
- "key=%s (%s)",
+ gf_msg (this->name, GF_LOG_ERROR, op_errno,
+ P_MSG_XATTR_FAILED,
+ "fsetxattr failed on gfid=%s while doing "
+ "xattrop: key=%s (%s)",
uuid_utoa (filler->inode->gfid),
k, strerror (op_errno));
-
op_ret = -1;
goto out;
} else {
@@ -4855,12 +4842,12 @@ unlock:
if (size != 0) {
if (filler->real_path)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"dict_set_bin failed (path=%s): "
"key=%s (%s)", filler->real_path,
k, strerror (-size));
else
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"dict_set_bin failed (gfid=%s): "
"key=%s (%s)",
uuid_utoa (filler->inode->gfid),
@@ -4907,9 +4894,9 @@ do_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
if (fd) {
op_ret = posix_fd_ctx_get (fd, this, &pfd);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "failed to get pfd from fd=%p",
- fd);
+ gf_msg (this->name, GF_LOG_WARNING, EBADFD,
+ P_MSG_PFD_GET_FAILED, "failed to get pfd from"
+ " fd=%p", fd);
op_errno = EBADFD;
goto out;
}
@@ -4991,8 +4978,8 @@ posix_access (call_frame_t *frame, xlator_t *this,
op_ret = access (real_path, mask & 07);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "access failed on %s: %s",
- real_path, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_ACCESS_FAILED,
+ "access failed on %s", real_path);
goto out;
}
op_ret = 0;
@@ -5030,7 +5017,7 @@ posix_ftruncate (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, -ret, P_MSG_PFD_NULL,
"pfd is NULL, fd=%p", fd);
op_errno = -ret;
goto out;
@@ -5041,9 +5028,8 @@ posix_ftruncate (call_frame_t *frame, xlator_t *this,
op_ret = posix_fdstat (this, _fd, &preop);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "pre-operation fstat failed on fd=%p: %s", fd,
- strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "pre-operation fstat failed on fd=%p", fd);
goto out;
}
@@ -5051,18 +5037,16 @@ posix_ftruncate (call_frame_t *frame, xlator_t *this,
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "ftruncate failed on fd=%p (%"PRId64": %s",
- fd, offset, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_TRUNCATE_FAILED,
+ "ftruncate failed on fd=%p (%"PRId64"", fd, offset);
goto out;
}
op_ret = posix_fdstat (this, _fd, &postop);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR,
- "post-operation fstat failed on fd=%p: %s",
- fd, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "post-operation fstat failed on fd=%p", fd);
goto out;
}
@@ -5103,7 +5087,7 @@ posix_fstat (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, -ret, P_MSG_PFD_NULL,
"pfd is NULL, fd=%p", fd);
op_errno = -ret;
goto out;
@@ -5114,8 +5098,8 @@ posix_fstat (call_frame_t *frame, xlator_t *this,
op_ret = posix_fdstat (this, _fd, &buf);
if (op_ret == -1) {
op_errno = errno;
- gf_log (this->name, GF_LOG_ERROR, "fstat failed on fd=%p: %s",
- fd, strerror (op_errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno, P_MSG_FSTAT_FAILED,
+ "fstat failed on fd=%p", fd);
goto out;
}
@@ -5230,7 +5214,7 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, -ret, P_MSG_PFD_NULL,
"pfd is NULL, fd=%p", fd);
count = -1;
errno = -ret;
@@ -5263,7 +5247,8 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,
seekdir (dir, off);
#ifndef GF_LINUX_HOST_OS
if ((u_long)telldir(dir) != off && off != pfd->dir_eof) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ P_MSG_DIR_OPERATION_FAILED,
"seekdir(0x%llx) failed on dir=%p: "
"Invalid argument (offset reused from "
"another DIR * structure?)", off, dir);
@@ -5278,9 +5263,9 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,
in_case = (u_long)telldir (dir);
if (in_case == -1) {
- gf_log (THIS->name, GF_LOG_ERROR,
- "telldir failed on dir=%p: %s",
- dir, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ P_MSG_DIR_OPERATION_FAILED,
+ "telldir failed on dir=%p", dir);
goto out;
}
@@ -5290,9 +5275,10 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,
if (!entry) {
if (errno == EBADF) {
- gf_log (THIS->name, GF_LOG_WARNING,
- "readdir failed on dir=%p: %s",
- dir, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_WARNING, errno,
+ P_MSG_DIR_OPERATION_FAILED,
+ "readdir failed on dir=%p",
+ dir);
goto out;
}
break;
@@ -5337,7 +5323,8 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,
#ifndef GF_LINUX_HOST_OS
if ((u_long)telldir(dir) != in_case &&
in_case != pfd->dir_eof) {
- gf_log (THIS->name, GF_LOG_ERROR,
+ gf_msg (THIS->name, GF_LOG_ERROR, EINVAL,
+ P_MSG_DIR_OPERATION_FAILED,
"seekdir(0x%llx) failed on dir=%p: "
"Invalid argument (offset reused from "
"another DIR * structure?)",
@@ -5353,9 +5340,10 @@ posix_fill_readdir (fd_t *fd, DIR *dir, off_t off, size_t size,
this_entry = gf_dirent_for_name (entry->d_name);
if (!this_entry) {
- gf_log (THIS->name, GF_LOG_ERROR,
- "could not create gf_dirent for entry %s: (%s)",
- entry->d_name, strerror (errno));
+ gf_msg (THIS->name, GF_LOG_ERROR, errno,
+ P_MSG_GF_DIRENT_CREATE_FAILED,
+ "could not create "
+ "gf_dirent for entry %s", entry->d_name);
goto out;
}
/*
@@ -5398,7 +5386,8 @@ posix_entry_xattr_fill (xlator_t *this, inode_t *inode,
MAKE_HANDLE_PATH (entry_path, this, fd->inode->gfid, name);
if (!entry_path) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_HANDLE_CREATE,
"Failed to create handle path for %s/%s",
uuid_utoa (fd->inode->gfid), name);
@@ -5495,7 +5484,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, -ret, P_MSG_PFD_NULL,
"pfd is NULL, fd=%p", fd);
op_errno = -ret;
goto out;
@@ -5504,7 +5493,7 @@ posix_do_readdir (call_frame_t *frame, xlator_t *this,
dir = pfd->dir;
if (!dir) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, EINVAL, P_MSG_PFD_NULL,
"dir is NULL for fd=%p", fd);
op_errno = EINVAL;
goto out;
@@ -5658,7 +5647,7 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this,
ret = posix_fd_ctx_get (fd, this, &pfd);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, -ret, P_MSG_PFD_NULL,
"pfd is NULL, fd=%p", fd);
op_errno = -ret;
goto out;
@@ -5673,9 +5662,10 @@ posix_rchecksum (call_frame_t *frame, xlator_t *this,
ret = pread (_fd, buf, len, offset);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "pread of %d bytes returned %d (%s)",
- len, ret, strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_PREAD_FAILED,
+ "pread of %d bytes returned %d ",
+ len, ret);
op_errno = errno;
}
@@ -5735,8 +5725,6 @@ mem_acct_init (xlator_t *this)
ret = xlator_mem_acct_init (this, gf_posix_mt_end + 1);
if (ret != 0) {
- gf_log(this->name, GF_LOG_ERROR, "Memory accounting init"
- "failed");
return ret;
}
@@ -5754,9 +5742,10 @@ posix_set_owner (xlator_t *this, uid_t uid, gid_t gid)
ret = sys_lstat (priv->base_path, &st);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "Failed to stat "
- "brick path %s (%s)",
- priv->base_path, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_DIR_OPERATION_FAILED, "Failed to stat "
+ "brick path %s",
+ priv->base_path);
return ret;
}
@@ -5766,9 +5755,9 @@ posix_set_owner (xlator_t *this, uid_t uid, gid_t gid)
ret = sys_chown (priv->base_path, uid, gid);
if (ret)
- gf_log (this->name, GF_LOG_ERROR, "Failed to set "
- "uid/gid for brick path %s, %s",
- priv->base_path, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_DIR_OPERATION_FAILED, "Failed to set uid/gid for"
+ " brick path %s", priv->base_path);
return ret;
}
@@ -5815,7 +5804,7 @@ int
reconfigure (xlator_t *this, dict_t *options)
{
int ret = -1;
- struct posix_private *priv = NULL;
+struct posix_private *priv = NULL;
int32_t uid = -1;
int32_t gid = -1;
char *batch_fsync_mode_str = NULL;
@@ -5834,8 +5823,8 @@ reconfigure (xlator_t *this, dict_t *options)
options, str, out);
if (set_batch_fsync_mode (priv, batch_fsync_mode_str) != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Unknown mode string: %s",
- batch_fsync_mode_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_INVALID_ARGUMENT,
+ "Unknown mode string: %s", batch_fsync_mode_str);
goto out;
}
@@ -5847,7 +5836,8 @@ reconfigure (xlator_t *this, dict_t *options)
options, str, out);
if (set_xattr_user_namespace_mode (priv, xattr_user_namespace_mode_str) != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Unknown xattr user namespace mode string: %s",
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_UNKNOWN_ARGUMENT,
+ "Unknown xattr user namespace mode string: %s",
xattr_user_namespace_mode_str);
goto out;
}
@@ -5869,10 +5859,10 @@ reconfigure (xlator_t *this, dict_t *options)
options, bool, out);
if (priv->node_uuid_pathinfo &&
- (gf_uuid_is_null (priv->glusterd_uuid))) {
- gf_log (this->name, GF_LOG_INFO,
- "glusterd uuid is NULL, pathinfo xattr would"
- " fallback to <hostname>:<export>");
+ (gf_uuid_is_null (priv->glusterd_uuid))) {
+ gf_msg (this->name, GF_LOG_INFO, 0, P_MSG_UUID_NULL,
+ "glusterd uuid is NULL, pathinfo xattr would"
+ " fallback to <hostname>:<export>");
}
GF_OPTION_RECONF ("health-check-interval", priv->health_check_interval,
@@ -5913,19 +5903,20 @@ init (xlator_t *this)
dir_data = dict_get (this->options, "directory");
if (this->children) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0, P_MSG_SUBVOLUME_ERROR,
"FATAL: storage/posix cannot have subvolumes");
ret = -1;
goto out;
}
if (!this->parents) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0, P_MSG_VOLUME_DANGLING,
"Volume is dangling. Please check the volume file.");
}
if (!dir_data) {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ P_MSG_EXPORT_DIR_MISSING,
"Export directory not specified in volume file.");
ret = -1;
goto out;
@@ -5936,7 +5927,7 @@ init (xlator_t *this)
/* Check whether the specified directory exists, if not log it. */
op_ret = stat (dir_data->data, &buf);
if ((op_ret != 0) || !S_ISDIR (buf.st_mode)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_DIR_OPERATION_FAILED,
"Directory '%s' doesn't exist, exiting.",
dir_data->data);
ret = -1;
@@ -5954,25 +5945,29 @@ init (xlator_t *this)
if (tmp_data) {
if (gf_string2boolean (tmp_data->data,
&tmp_bool) == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_INVALID_OPTION,
"wrong option provided for key "
"\"mandate-attribute\"");
ret = -1;
goto out;
}
if (!tmp_bool) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_XATTR_NOTSUP,
"Extended attribute not supported, "
"starting as per option");
} else {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ P_MSG_XATTR_NOTSUP,
"Extended attribute not supported, "
"exiting.");
ret = -1;
goto out;
}
} else {
- gf_log (this->name, GF_LOG_CRITICAL,
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ P_MSG_XATTR_NOTSUP,
"Extended attribute not supported, exiting.");
ret = -1;
goto out;
@@ -5983,9 +5978,10 @@ init (xlator_t *this)
if (tmp_data) {
op_ret = gf_uuid_parse (tmp_data->data, dict_uuid);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
- "wrong volume-id (%s) set in volume file",
- tmp_data->data);
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_INVALID_VOLUME_ID,
+ "wrong volume-id (%s) set"
+ " in volume file", tmp_data->data);
ret = -1;
goto out;
}
@@ -5993,7 +5989,8 @@ init (xlator_t *this)
"trusted.glusterfs.volume-id", old_uuid, 16);
if (size == 16) {
if (gf_uuid_compare (old_uuid, dict_uuid)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_INVALID_VOLUME_ID,
"mismatching volume-id (%s) received. "
"already is a part of volume %s ",
tmp_data->data, uuid_utoa (old_uuid));
@@ -6002,7 +5999,8 @@ init (xlator_t *this)
}
} else if ((size == -1) &&
(errno == ENODATA || errno == ENOATTR)) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_VOLUME_ID_ABSENT,
"Extended attribute trusted.glusterfs."
"volume-id is absent");
ret = -1;
@@ -6011,14 +6009,16 @@ init (xlator_t *this)
} else if ((size == -1) && (errno != ENODATA) &&
(errno != ENOATTR)) {
/* Wrong 'volume-id' is set, it should be error */
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to fetch volume-id (%s)",
- dir_data->data, strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_VOLUME_ID_FETCH_FAILED,
+ "%s: failed to fetch volume-id",
+ dir_data->data);
ret = -1;
goto out;
} else {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_VOLUME_ID_FETCH_FAILED,
"failed to fetch proper volume id from export");
goto out;
}
@@ -6029,7 +6029,8 @@ init (xlator_t *this)
size = sys_lgetxattr (dir_data->data, "trusted.gfid", gfid, 16);
if (size == 16) {
if (!__is_root_gfid (gfid)) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_GFID_SET_FAILED,
"%s: gfid (%s) is not that of glusterfs '/' ",
dir_data->data, uuid_utoa (gfid));
ret = -1;
@@ -6037,7 +6038,8 @@ init (xlator_t *this)
}
} else if (size != -1) {
/* Wrong 'gfid' is set, it should be error */
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_GFID_SET_FAILED,
"%s: wrong value set as gfid",
dir_data->data);
ret = -1;
@@ -6045,9 +6047,10 @@ init (xlator_t *this)
} else if ((size == -1) && (errno != ENODATA) &&
(errno != ENOATTR)) {
/* Wrong 'gfid' is set, it should be error */
- gf_log (this->name, GF_LOG_WARNING,
- "%s: failed to fetch gfid (%s)",
- dir_data->data, strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_GFID_SET_FAILED,
+ "%s: failed to fetch gfid",
+ dir_data->data);
ret = -1;
goto out;
} else {
@@ -6055,9 +6058,10 @@ init (xlator_t *this)
size = sys_lsetxattr (dir_data->data, "trusted.gfid", rootgfid,
16, XATTR_CREATE);
if (size == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "%s: failed to set gfid (%s)",
- dir_data->data, strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_GFID_SET_FAILED,
+ "%s: failed to set gfid",
+ dir_data->data);
ret = -1;
goto out;
}
@@ -6066,7 +6070,8 @@ init (xlator_t *this)
size = sys_lgetxattr (dir_data->data, POSIX_ACL_ACCESS_XATTR,
NULL, 0);
if ((size < 0) && (errno == ENOTSUP))
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_ACL_NOTSUP,
"Posix access control list is not supported.");
ret = 0;
@@ -6094,7 +6099,8 @@ init (xlator_t *this)
_XOPEN_PATH_MAX + _private->base_path_length > _private->path_max) {
ret = chdir(_private->base_path);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_BASEPATH_CHDIR_FAILED,
"chdir() to \"%s\" failed",
_private->base_path);
goto out;
@@ -6125,8 +6131,9 @@ init (xlator_t *this)
}
ret = gethostname (_private->hostname, 256);
if (ret < 0) {
- gf_log (this->name, GF_LOG_WARNING,
- "could not find hostname (%s)", strerror (errno));
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_HOSTNAME_MISSING,
+ "could not find hostname ");
}
}
@@ -6136,13 +6143,14 @@ init (xlator_t *this)
if (gf_string2boolean (tmp_data->data,
&_private->export_statfs) == -1) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_INVALID_OPTION_VAL,
"'export-statfs-size' takes only boolean "
"options");
goto out;
}
if (!_private->export_statfs)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"'statfs()' returns dummy size");
}
@@ -6152,14 +6160,14 @@ init (xlator_t *this)
if (gf_string2boolean (tmp_data->data,
&_private->background_unlink) == -1) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
- "'background-unlink' takes only boolean "
- "options");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_INVALID_OPTION_VAL, "'background-unlink'"
+ " takes only boolean options");
goto out;
}
if (_private->background_unlink)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_msg_debug (this->name, 0,
"unlinks will be performed in background");
}
@@ -6168,14 +6176,14 @@ init (xlator_t *this)
if (gf_string2boolean (tmp_data->data,
&_private->o_direct) == -1) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_INVALID_OPTION_VAL,
"wrong option provided for 'o-direct'");
goto out;
}
if (_private->o_direct)
- gf_log (this->name, GF_LOG_DEBUG,
- "o-direct mode is enabled (O_DIRECT "
- "for every open)");
+ gf_msg_debug (this->name, 0, "o-direct mode is enabled"
+ " (O_DIRECT for every open)");
}
tmp_data = dict_get (this->options, "update-link-count-parent");
@@ -6183,29 +6191,31 @@ init (xlator_t *this)
if (gf_string2boolean (tmp_data->data,
&_private->update_pgfid_nlinks) == -1) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
- "wrong value provided for "
- "'update-link-count-parent'");
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ P_MSG_INVALID_OPTION, "wrong value provided "
+ "for 'update-link-count-parent'");
goto out;
}
if (_private->update_pgfid_nlinks)
- gf_log (this->name, GF_LOG_DEBUG,
- "update-link-count-parent is enabled. Thus for each "
- "file an extended attribute representing the "
- "number of hardlinks for that file within the "
- "same parent directory is set.");
+ gf_msg_debug (this->name, 0, "update-link-count-parent"
+ " is enabled. Thus for each file an "
+ "extended attribute representing the "
+ "number of hardlinks for that file "
+ "within the same parent directory is"
+ " set.");
}
ret = dict_get_str (this->options, "glusterd-uuid", &guuid);
if (!ret) {
if (gf_uuid_parse (guuid, _private->glusterd_uuid))
- gf_log (this->name, GF_LOG_WARNING, "Cannot parse "
+ gf_msg (this->name, GF_LOG_WARNING, 0,
+ P_MSG_INVALID_NODE_UUID, "Cannot parse "
"glusterd (node) UUID, node-uuid xattr "
"request would return - \"No such attribute\"");
} else {
- gf_log (this->name, GF_LOG_DEBUG, "No glusterd (node) UUID "
- "passed - node-uuid xattr request will return "
- "\"No such attribute\"");
+ gf_msg_debug (this->name, 0, "No glusterd (node) UUID passed -"
+ " node-uuid xattr request will return \"No such"
+ " attribute\"");
}
ret = 0;
@@ -6214,9 +6224,8 @@ init (xlator_t *this)
dict_ret = dict_get_int32 (this->options, "janitor-sleep-duration",
&janitor_sleep);
if (dict_ret == 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "Setting janitor sleep duration to %d.",
- janitor_sleep);
+ gf_msg_debug (this->name, 0, "Setting janitor sleep duration "
+ "to %d.", janitor_sleep);
_private->janitor_sleep_duration = janitor_sleep;
}
@@ -6226,7 +6235,7 @@ init (xlator_t *this)
_private->mount_lock = opendir (dir_data->data);
if (!_private->mount_lock) {
ret = -1;
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_DIR_OPERATION_FAILED,
"Could not lock brick directory");
goto out;
}
@@ -6237,22 +6246,23 @@ init (xlator_t *this)
lim.rlim_max = 1048576;
if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_SET_ULIMIT_FAILED,
"Failed to set 'ulimit -n "
- " 1048576': %s", strerror(errno));
+ " 1048576'");
lim.rlim_cur = 65536;
lim.rlim_max = 65536;
if (setrlimit (RLIMIT_NOFILE, &lim) == -1) {
- gf_log (this->name, GF_LOG_WARNING,
+ gf_msg (this->name, GF_LOG_WARNING, errno,
+ P_MSG_SET_FILE_MAX_FAILED,
"Failed to set maximum allowed open "
- "file descriptors to 64k: %s",
- strerror(errno));
+ "file descriptors to 64k");
}
else {
- gf_log (this->name, GF_LOG_INFO,
- "Maximum allowed open file descriptors "
- "set to 65536");
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ P_MSG_MAX_FILE_OPEN, "Maximum allowed "
+ "open file descriptors set to 65536");
}
}
}
@@ -6261,7 +6271,7 @@ init (xlator_t *this)
op_ret = posix_handle_init (this);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_HANDLE_CREATE,
"Posix handle setup failed");
ret = -1;
goto out;
@@ -6269,7 +6279,7 @@ init (xlator_t *this)
op_ret = posix_handle_trash_init (this);
if (op_ret < 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_HANDLE_CREATE_TRASH,
"Posix landfill setup failed");
ret = -1;
goto out;
@@ -6289,7 +6299,7 @@ init (xlator_t *this)
op_ret = posix_aio_on (this);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_POSIX_AIO,
"Posix AIO init failed");
ret = -1;
goto out;
@@ -6300,7 +6310,7 @@ init (xlator_t *this)
_private->node_uuid_pathinfo, bool, out);
if (_private->node_uuid_pathinfo &&
(gf_uuid_is_null (_private->glusterd_uuid))) {
- gf_log (this->name, GF_LOG_INFO,
+ gf_msg (this->name, GF_LOG_INFO, 0, P_MSG_UUID_NULL,
"glusterd uuid is NULL, pathinfo xattr would"
" fallback to <hostname>:<export>");
}
@@ -6323,16 +6333,17 @@ init (xlator_t *this)
ret = gf_thread_create (&_private->fsyncer, NULL, posix_fsyncer, this);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR, "fsyncer thread"
- " creation failed (%s)", strerror (errno));
+ gf_msg (this->name, GF_LOG_ERROR, errno,
+ P_MSG_FSYNCER_THREAD_CREATE_FAILED,
+ "fsyncer thread creation failed");
goto out;
}
GF_OPTION_INIT ("batch-fsync-mode", batch_fsync_mode_str, str, out);
if (set_batch_fsync_mode (_private, batch_fsync_mode_str) != 0) {
- gf_log (this->name, GF_LOG_ERROR, "Unknown mode string: %s",
- batch_fsync_mode_str);
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_INVALID_ARGUMENT,
+ "Unknown mode string: %s", batch_fsync_mode_str);
goto out;
}
@@ -6345,7 +6356,7 @@ init (xlator_t *this)
if (set_xattr_user_namespace_mode (_private,
xattr_user_namespace_mode_str) != 0) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0, P_MSG_INVALID_ARGUMENT,
"Unknown xattr user namespace mode string: %s",
xattr_user_namespace_mode_str);
goto out;
@@ -6371,7 +6382,6 @@ fini (xlator_t *this)
GF_FREE (priv);
return;
}
-
struct xlator_dumpops dumpops = {
.priv = posix_priv,
.inode = posix_inode,