summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-common.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/nfs/server/src/nfs-common.c')
-rw-r--r--xlators/nfs/server/src/nfs-common.c52
1 files changed, 32 insertions, 20 deletions
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index 547e5b3a833..b6791566c2c 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -24,6 +24,7 @@
#include "nfs-mem-types.h"
#include "rpcsvc.h"
#include "iatt.h"
+#include "nfs-messages.h"
#include <libgen.h>
@@ -87,7 +88,7 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path)
volname = strdupa (path);
pathlen = strlen (volname);
- gf_log (GF_NFS, GF_LOG_TRACE, "Subvolume search: %s", path);
+ gf_msg_trace (GF_NFS, 0, "Subvolume search: %s", path);
if (volname[0] == '/')
volptr = &volname[1];
else
@@ -167,7 +168,8 @@ nfs_loc_fill (loc_t *loc, inode_t *inode, inode_t *parent, char *path)
if (path) {
loc->path = gf_strdup (path);
if (!loc->path) {
- gf_log (GF_NFS, GF_LOG_ERROR, "strdup failed");
+ gf_msg (GF_NFS, GF_LOG_ERROR, ENOMEM,
+ NFS_MSG_NO_MEMORY, "strdup failed");
goto loc_wipe;
}
loc->name = strrchr (loc->path, '/');
@@ -201,8 +203,9 @@ nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how)
if (!gf_uuid_is_null (inode->gfid)) {
ret = inode_path (inode, NULL, &resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed "
- "%s", resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, 0,
+ NFS_MSG_PATH_RESOLVE_FAIL, "path resolution "
+ "failed %s", resolvedpath);
goto err;
}
}
@@ -218,8 +221,9 @@ nfs_inode_loc_fill (inode_t *inode, loc_t *loc, int how)
ret = nfs_loc_fill (loc, inode, parent, resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "loc fill resolution failed %s",
- resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret,
+ NFS_MSG_LOC_FILL_RESOLVE_FAIL,
+ "loc fill resolution failed %s", resolvedpath);
goto err;
}
@@ -244,31 +248,37 @@ nfs_gfid_loc_fill (inode_table_t *itable, uuid_t gfid, loc_t *loc, int how)
inode = inode_find (itable, gfid);
if (!inode) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Inode not found in itable, will try to create one.");
+ gf_msg_trace (GF_NFS, 0, "Inode not found in itable, will "
+ "try to create one.");
if (how == NFS_RESOLVE_CREATE) {
- gf_log (GF_NFS, GF_LOG_TRACE, "Inode needs to be created.");
+ gf_msg_trace (GF_NFS, 0, "Inode needs to be created.");
inode = inode_new (itable);
if (!inode) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to "
+ gf_msg (GF_NFS, GF_LOG_ERROR, ENOMEM,
+ NFS_MSG_NO_MEMORY, "Failed to "
"allocate memory");
ret = -ENOMEM;
goto err;
}
} else {
- gf_log (GF_NFS, GF_LOG_ERROR, "Inode not found in itable and no creation was requested.");
+ gf_msg (GF_NFS, GF_LOG_ERROR, ENOENT,
+ NFS_MSG_INODE_NOT_FOUND, "Inode not found in "
+ "itable and no creation was requested.");
ret = -ENOENT;
goto err;
}
} else {
- gf_log (GF_NFS, GF_LOG_TRACE, "Inode was found in the itable.");
+ gf_msg_trace (GF_NFS, 0, "Inode was found in the itable.");
}
gf_uuid_copy (loc->gfid, gfid);
ret = nfs_inode_loc_fill (inode, loc, how);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Inode loc filling failed.: %s", strerror (-ret));
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret,
+ NFS_MSG_INODE_LOC_FILL_ERROR,
+ "Inode loc filling failed.: %s", strerror (-ret));
goto err;
}
@@ -302,8 +312,8 @@ nfs_parent_inode_loc_fill (inode_t *parent, inode_t *entryinode, char *entry,
ret = inode_path (parent, entry, &path);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed %s",
- path);
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret, NFS_MSG_PATH_RESOLVE_FAIL,
+ "path resolution failed %s", path);
goto err;
}
@@ -369,16 +379,16 @@ nfs_entry_loc_fill (inode_table_t *itable, uuid_t pargfid, char *entry,
ret = inode_path (parent, entry, &resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "path resolution failed %s",
- resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, -ret, NFS_MSG_PATH_RESOLVE_FAIL,
+ "path resolution failed %s", resolvedpath);
ret = -3;
goto err;
}
ret = nfs_loc_fill (loc, entryinode, parent, resolvedpath);
if (ret < 0) {
- gf_log (GF_NFS, GF_LOG_ERROR, "loc_fill failed %s",
- resolvedpath);
+ gf_msg (GF_NFS, GF_LOG_ERROR, 0, NFS_MSG_INODE_LOC_FILL_ERROR,
+ "loc_fill failed %s", resolvedpath);
ret = -3;
}
@@ -449,7 +459,8 @@ nfs_fix_generation (xlator_t *this, inode_t *inode)
ictx = GF_CALLOC (1, sizeof (struct nfs_inode_ctx),
gf_nfs_mt_inode_ctx);
if (!ictx) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
+ NFS_MSG_NO_MEMORY,
"could not allocate nfs inode ctx");
return;
}
@@ -457,7 +468,8 @@ nfs_fix_generation (xlator_t *this, inode_t *inode)
ictx->generation = priv->generation;
ret = inode_ctx_put (inode, this, (uint64_t)ictx);
if (ret) {
- gf_log (this->name, GF_LOG_ERROR,
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ NFS_MSG_INODE_CTX_STORE_FAIL,
"could not store nfs inode ctx");
return;
}