summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-03-16 09:43:04 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-17 11:59:00 -0700
commitd643c1093a89398de6cbe333aeea5cf91a56b3ad (patch)
tree6eda56eea6f8747a3c76ff89aa3977d853e28078 /xlators/cluster/dht/src
parent7df49c62422d33d19eaebeddd3fcdacccc9c7bce (diff)
cluster/dht: log enhancements
Signed-off-by: Shishir Gowda <shishirng@gluster.com> Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2346 (Log message enhancements in GlusterFS - phase 1) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'xlators/cluster/dht/src')
-rw-r--r--xlators/cluster/dht/src/dht-common.c305
-rw-r--r--xlators/cluster/dht/src/dht-diskusage.c13
-rw-r--r--xlators/cluster/dht/src/dht-helper.c5
-rw-r--r--xlators/cluster/dht/src/dht-layout.c23
-rw-r--r--xlators/cluster/dht/src/dht-linkfile.c28
-rw-r--r--xlators/cluster/dht/src/dht-rename.c66
-rw-r--r--xlators/cluster/dht/src/dht-selfheal.c35
-rw-r--r--xlators/cluster/dht/src/dht.c67
-rw-r--r--xlators/cluster/dht/src/nufa.c16
-rw-r--r--xlators/cluster/dht/src/switch.c16
10 files changed, 263 insertions, 311 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 2f976823933..d1b5936b483 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -50,7 +50,11 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie,
{
dht_local_t *local = NULL;
dht_layout_t *layout = NULL;
- int ret = 0;
+ int ret = -1;
+
+ GF_VALIDATE_OR_GOTO ("dht", frame, out);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
local = frame->local;
ret = op_ret;
@@ -78,7 +82,8 @@ dht_lookup_selfheal_cbk (call_frame_t *frame, void *cookie,
DHT_STACK_UNWIND (lookup, frame, ret, local->op_errno, local->inode,
&local->stbuf, local->xattr, &local->postparent);
- return 0;
+out:
+ return ret;
}
@@ -93,9 +98,15 @@ dht_lookup_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
call_frame_t *prev = NULL;
dht_layout_t *layout = NULL;
- int ret = 0;
+ int ret = -1;
int is_dir = 0;
+ GF_VALIDATE_OR_GOTO ("dht", frame, out);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, out);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, out);
+
conf = this->private;
local = frame->local;
prev = cookie;
@@ -199,8 +210,8 @@ selfheal:
FRAME_SU_DO (frame, dht_local_t);
ret = dht_selfheal_directory (frame, dht_lookup_selfheal_cbk,
&local->loc, layout);
-
- return 0;
+out:
+ return ret;
}
int
@@ -214,9 +225,15 @@ dht_lookup_root_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
call_frame_t *prev = NULL;
dht_layout_t *layout = NULL;
- int ret = 0;
+ int ret = -1;
int is_dir = 0;
+ GF_VALIDATE_OR_GOTO ("dht", frame, out);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, out);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, out);
+
conf = this->private;
local = frame->local;
prev = cookie;
@@ -274,7 +291,7 @@ unlock:
local->loc.path);
}
- dht_layout_set (this, local->inode, layout);
+ ret = dht_layout_set (this, local->inode, layout);
}
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
@@ -282,7 +299,8 @@ unlock:
&local->postparent);
}
- return 0;
+out:
+ return ret;
}
static int
@@ -293,6 +311,11 @@ dht_do_fresh_lookup_on_root (xlator_t *this, call_frame_t *frame)
int ret = -1;
int call_cnt = 0;
int i = 0;
+ int op_errno = EINVAL;
+
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame, unwind);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, unwind);
local = frame->local;
conf = this->private;
@@ -316,8 +339,6 @@ dht_do_fresh_lookup_on_root (xlator_t *this, call_frame_t *frame)
conf->subvolume_cnt);
if (!local->layout) {
local->op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -333,7 +354,12 @@ err:
DHT_STACK_UNWIND (lookup, frame, -1, local->op_errno,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
+
return 0;
+unwind:
+ DHT_STACK_UNWIND (lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL);
+out:
+ return -1;
}
int
@@ -352,6 +378,11 @@ dht_revalidate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int is_linkfile = 0;
unsigned char root_gfid[16] = {0,};
+ GF_VALIDATE_OR_GOTO ("dht", frame, err);
+ GF_VALIDATE_OR_GOTO ("dht", this, err);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, err);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, err);
+
local = frame->local;
prev = cookie;
conf = this->private;
@@ -470,7 +501,8 @@ out:
&local->postparent);
}
- return 0;
+err:
+ return ret;
}
@@ -486,6 +518,12 @@ dht_lookup_linkfile_create_cbk (call_frame_t *frame, void *cookie,
dht_conf_t *conf = NULL;
int ret = -1;
+ GF_VALIDATE_OR_GOTO ("dht", frame, out);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, out);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, out);
+
local = frame->local;
cached_subvol = local->cached_subvol;
conf = this->private;
@@ -515,7 +553,8 @@ unwind:
DHT_STACK_UNWIND (lookup, frame, local->op_ret, local->op_errno,
local->inode, &local->stbuf, local->xattr,
&local->postparent);
- return 0;
+out:
+ return ret;
}
@@ -538,6 +577,12 @@ dht_lookup_everywhere_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
xlator_t *cached_subvol = NULL;
int ret = -1;
+ GF_VALIDATE_OR_GOTO ("dht", frame, out);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, out);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, out);
+
conf = this->private;
local = frame->local;
@@ -673,12 +718,13 @@ unlock:
loc->path, cached_subvol->name,
hashed_subvol->name);
- dht_linkfile_create (frame,
- dht_lookup_linkfile_create_cbk,
- cached_subvol, hashed_subvol, loc);
+ ret = dht_linkfile_create (frame,
+ dht_lookup_linkfile_create_cbk,
+ cached_subvol, hashed_subvol, loc);
}
- return 0;
+out:
+ return ret;
}
@@ -690,10 +736,14 @@ dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc)
int i = 0;
int call_cnt = 0;
+ GF_VALIDATE_OR_GOTO ("dht", frame, err);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, out);
+ GF_VALIDATE_OR_GOTO ("dht", loc, out);
+
conf = this->private;
local = frame->local;
- if (!conf)
- goto out;
call_cnt = conf->subvolume_cnt;
local->call_cnt = call_cnt;
@@ -711,7 +761,8 @@ dht_lookup_everywhere (call_frame_t *frame, xlator_t *this, loc_t *loc)
return 0;
out:
DHT_STACK_UNWIND (lookup, frame, -1, EINVAL, NULL, NULL, NULL, NULL);
- return 0;
+err:
+ return -1;
}
@@ -728,6 +779,12 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
dht_conf_t *conf = NULL;
int ret = 0;
+ GF_VALIDATE_OR_GOTO ("dht", frame, out);
+ GF_VALIDATE_OR_GOTO ("dht", this, unwind);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, unwind);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, unwind);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, unwind);
+
prev = cookie;
subvol = prev->this;
conf = this->private;
@@ -735,21 +792,21 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
loc = &local->loc;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"lookup of %s on %s (following linkfile) failed (%s)",
local->loc.path, subvol->name, strerror (op_errno));
goto err;
}
if (check_is_dir (inode, stbuf, xattr)) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"lookup of %s on %s (following linkfile) reached dir",
local->loc.path, subvol->name);
goto err;
}
if (check_is_linkfile (inode, stbuf, xattr)) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"lookup of %s on %s (following linkfile) reached link",
local->loc.path, subvol->name);
goto err;
@@ -765,15 +822,14 @@ dht_lookup_linkfile_cbk (call_frame_t *frame, void *cookie,
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"failed to set layout for subvolume %s",
prev->this->name);
op_ret = -1;
op_errno = EINVAL;
- goto out;
}
-out:
+unwind:
WIPE (postparent);
DHT_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, stbuf, xattr,
@@ -783,7 +839,7 @@ out:
err:
dht_lookup_everywhere (frame, this, loc);
-
+out:
return 0;
}
@@ -796,19 +852,20 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc)
dht_conf_t *conf = NULL;
dht_local_t *local = NULL;
+ GF_VALIDATE_OR_GOTO ("dht", frame, out);
+ GF_VALIDATE_OR_GOTO ("dht", this, unwind);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, unwind);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, unwind);
+ GF_VALIDATE_OR_GOTO ("dht", loc, unwind);
+
conf = this->private;
local = frame->local;
- if (!conf)
- goto unwind;
-
call_cnt = conf->subvolume_cnt;
local->call_cnt = call_cnt;
local->layout = dht_layout_new (this, conf->subvolume_cnt);
if (!local->layout) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto unwind;
}
@@ -821,6 +878,7 @@ dht_lookup_directory (call_frame_t *frame, xlator_t *this, loc_t *loc)
return 0;
unwind:
DHT_STACK_UNWIND (lookup, frame, -1, ENOMEM, NULL, NULL, NULL, NULL);
+out:
return 0;
}
@@ -843,9 +901,13 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
uint64_t tmp_layout = 0;
dht_layout_t *parent_layout = NULL;
+ GF_VALIDATE_OR_GOTO ("dht", frame, err);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, out);
+ GF_VALIDATE_OR_GOTO ("dht", this->private, out);
+
conf = this->private;
- if (!conf)
- goto out;
prev = cookie;
local = frame->local;
@@ -858,6 +920,8 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
memcpy (local->gfid, stbuf->ia_gfid, 16);
if (ENTRY_MISSING (op_ret, op_errno)) {
+ gf_log (this->name, GF_LOG_TRACE, "Entry %s missing on subvol"
+ " %s", loc->path, prev->this->name);
if (conf->search_unhashed == GF_DHT_LOOKUP_UNHASHED_ON) {
local->op_errno = ENOENT;
dht_lookup_everywhere (frame, this, loc);
@@ -888,8 +952,12 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
return 0;
}
- if (op_ret == -1)
+ if (op_ret == -1) {
+ gf_log (this->name, GF_LOG_DEBUG, "Lookup of %s for subvolume"
+ " %s failed with error %s", loc->path, prev->this->name,
+ strerror (op_errno));
goto out;
+ }
is_linkfile = check_is_linkfile (inode, stbuf, xattr);
is_dir = check_is_dir (inode, stbuf, xattr);
@@ -904,7 +972,7 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
ret = dht_layout_preset (this, prev->this, inode);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"could not set pre-set layout for subvolume %s",
prev->this->name);
op_ret = -1;
@@ -944,6 +1012,7 @@ out:
DHT_STACK_UNWIND (lookup, frame, op_ret, op_errno, inode, stbuf, xattr,
postparent);
+err:
return 0;
}
@@ -977,8 +1046,6 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
if (!dht_filter_loc_subvol_key (this, loc, &local->loc,
@@ -1066,8 +1133,6 @@ dht_lookup (call_frame_t *frame, xlator_t *this,
conf->subvolume_cnt);
if (!local->layout) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -1103,6 +1168,10 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
call_frame_t *prev = NULL;
+ GF_VALIDATE_OR_GOTO ("dht", frame, err);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, out);
local = frame->local;
prev = cookie;
@@ -1130,12 +1199,12 @@ dht_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
unlock:
UNLOCK (&frame->lock);
-
+out:
this_call_cnt = dht_frame_return (frame);
if (is_last_call (this_call_cnt))
DHT_STACK_UNWIND (truncate, frame, local->op_ret, local->op_errno,
&local->prebuf, &local->stbuf);
-
+err:
return 0;
}
@@ -1149,6 +1218,10 @@ dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
call_frame_t *prev = NULL;
+ GF_VALIDATE_OR_GOTO ("dht", frame, err);
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", frame->local, out);
+ GF_VALIDATE_OR_GOTO ("dht", cookie, out);
local = frame->local;
prev = cookie;
@@ -1171,12 +1244,12 @@ dht_attr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
unlock:
UNLOCK (&frame->lock);
-
+out:
this_call_cnt = dht_frame_return (frame);
if (is_last_call (this_call_cnt))
DHT_STACK_UNWIND (stat, frame, local->op_ret, local->op_errno,
&local->stbuf);
-
+err:
return 0;
}
@@ -1202,8 +1275,6 @@ dht_stat (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -1254,8 +1325,6 @@ dht_fstat (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -1313,8 +1382,6 @@ dht_truncate (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -1359,8 +1426,6 @@ dht_ftruncate (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -1580,8 +1645,6 @@ dht_access (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -1650,8 +1713,6 @@ dht_readlink (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -1877,8 +1938,7 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -1889,23 +1949,20 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
ret = loc_dup (loc, &local->loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
local->key = gf_strdup (key);
if (!local->key) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
local->layout = layout;
@@ -1951,16 +2008,14 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
ret = loc_dup (loc, &local->loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
local->layout = layout;
@@ -2025,8 +2080,7 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
ret = loc_dup (loc, &local->loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -2034,8 +2088,7 @@ dht_getxattr (call_frame_t *frame, xlator_t *this,
local->key = gf_strdup (key);
if (!local->key) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
}
@@ -2086,8 +2139,6 @@ dht_fsetxattr (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -2136,8 +2187,6 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -2231,8 +2280,6 @@ dht_removexattr (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -2324,8 +2371,7 @@ dht_open (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -2333,8 +2379,7 @@ dht_open (call_frame_t *frame, xlator_t *this,
ret = loc_dup (loc, &local->loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -2400,7 +2445,6 @@ dht_readv (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
- gf_log (this->name, GF_LOG_ERROR, "Out of memory");
op_errno = ENOMEM;
goto err;
}
@@ -2471,8 +2515,7 @@ dht_writev (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -2516,8 +2559,7 @@ dht_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -2561,8 +2603,7 @@ dht_fsync (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
local->call_cnt = 1;
@@ -2760,8 +2801,7 @@ dht_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -2769,8 +2809,7 @@ dht_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd)
ret = loc_dup (loc, &local->loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -2833,8 +2872,7 @@ dht_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
entry = gf_dirent_for_name (orig_entry->d_name);
if (!entry) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto unwind;
}
@@ -3024,8 +3062,7 @@ dht_do_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
local = dht_local_init (frame);
if (!local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -3137,8 +3174,7 @@ dht_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int datasync)
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -3266,8 +3302,7 @@ dht_mknod (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -3283,8 +3318,7 @@ dht_mknod (call_frame_t *frame, xlator_t *this,
ret = loc_dup (loc, &local->loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -3347,8 +3381,7 @@ dht_symlink (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -3431,16 +3464,14 @@ dht_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
ret = loc_copy (&local->loc, loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -3569,24 +3600,21 @@ dht_link (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
ret = loc_copy (&local->loc, oldloc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
ret = loc_copy (&local->loc2, newloc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -3707,8 +3735,7 @@ dht_create (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -3727,8 +3754,7 @@ dht_create (call_frame_t *frame, xlator_t *this,
ret = loc_dup (loc, &local->loc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
subvol = dht_subvol_get_hashed (this, loc);
@@ -3960,8 +3986,7 @@ dht_mkdir (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -3982,8 +4007,7 @@ dht_mkdir (call_frame_t *frame, xlator_t *this,
local->mode = mode;
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -3992,8 +4016,7 @@ dht_mkdir (call_frame_t *frame, xlator_t *this,
local->layout = dht_layout_new (this, conf->subvolume_cnt);
if (!local->layout) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -4261,8 +4284,6 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
lookup_frame = copy_frame (frame);
if (!lookup_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of Memory");
/* out of memory, let the rmdir fail
(as non-empty, unfortunately) */
goto err;
@@ -4271,8 +4292,6 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this,
lookup_local = GF_CALLOC (sizeof (*local), 1,
gf_dht_mt_dht_local_t);
if (!lookup_local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of Memory");
goto err;
}
@@ -4409,8 +4428,7 @@ dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
local = dht_local_init (frame);
if (!local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -4420,8 +4438,7 @@ dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
ret = loc_copy (&local->loc, loc);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -4430,8 +4447,7 @@ dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
local->fd = fd_create (local->loc.inode, frame->root->pid);
if (!local->fd) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
op_errno = ENOMEM;
goto err;
}
@@ -4488,8 +4504,7 @@ dht_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -4590,8 +4605,7 @@ dht_inodelk (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -4694,8 +4708,7 @@ dht_entrylk (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -4881,8 +4894,7 @@ dht_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iatt *stbuf,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
goto err;
}
@@ -4955,8 +4967,7 @@ dht_init_subvolumes (xlator_t *this, dht_conf_t *conf)
conf->subvolumes = GF_CALLOC (cnt, sizeof (xlator_t *),
gf_dht_mt_xlator_t);
if (!conf->subvolumes) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
return -1;
}
conf->subvolume_cnt = cnt;
@@ -4968,16 +4979,14 @@ dht_init_subvolumes (xlator_t *this, dht_conf_t *conf)
conf->subvolume_status = GF_CALLOC (cnt, sizeof (char),
gf_dht_mt_char);
if (!conf->subvolume_status) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
return -1;
}
conf->last_event = GF_CALLOC (cnt, sizeof (int),
gf_dht_mt_char);
if (!conf->last_event) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
+
return -1;
}
return 0;
diff --git a/xlators/cluster/dht/src/dht-diskusage.c b/xlators/cluster/dht/src/dht-diskusage.c
index e526d1aec0c..75953781ef7 100644
--- a/xlators/cluster/dht/src/dht-diskusage.c
+++ b/xlators/cluster/dht/src/dht-diskusage.c
@@ -47,8 +47,11 @@ dht_du_info_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
conf = this->private;
prev = cookie;
- if (op_ret == -1)
+ if (op_ret == -1) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to get disk info from %s", prev->this->name);
goto out;
+ }
if (statvfs && statvfs->f_blocks) {
percent = (statvfs->f_bfree * 100) / statvfs->f_blocks;
@@ -92,15 +95,11 @@ dht_get_du_info_for_subvol (xlator_t *this, int subvol_idx)
statfs_frame = create_frame (this, pool);
if (!statfs_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
statfs_local = dht_local_init (statfs_frame);
if (!statfs_local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -139,15 +138,11 @@ dht_get_du_info (call_frame_t *frame, xlator_t *this, loc_t *loc)
statfs_frame = copy_frame (frame);
if (!statfs_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
statfs_local = dht_local_init (statfs_frame);
if (!statfs_local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 00c710f6145..cd57b9ea083 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -57,7 +57,6 @@ dht_itransform (xlator_t *this, xlator_t *subvol, uint64_t x, uint64_t *y_p)
int max = 0;
uint64_t y = 0;
-
if (x == ((uint64_t) -1)) {
y = (uint64_t) -1;
goto out;
@@ -473,8 +472,6 @@ dht_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name)
gf_asprintf ((char **)&child->path, "%s/%s", parent->path, name);
if (!child->path) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -486,8 +483,6 @@ dht_build_child_loc (xlator_t *this, loc_t *child, loc_t *parent, char *name)
child->inode = inode_new (parent->inode->table);
if (!child->inode) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c
index 23cec09d780..16767adb9fa 100644
--- a/xlators/cluster/dht/src/dht-layout.c
+++ b/xlators/cluster/dht/src/dht-layout.c
@@ -47,8 +47,6 @@ dht_layout_new (xlator_t *this, int cnt)
layout = GF_CALLOC (1, layout_size (cnt),
gf_dht_mt_dht_layout_t);
if (!layout) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto out;
}
@@ -175,7 +173,7 @@ dht_layout_search (xlator_t *this, dht_layout_t *layout, const char *name)
ret = dht_hash_compute (layout->type, name, &hash);
if (ret != 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"hash computation failed for type=%d name=%s",
layout->type, name);
goto out;
@@ -190,7 +188,7 @@ dht_layout_search (xlator_t *this, dht_layout_t *layout, const char *name)
}
if (!subvol) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"no subvolume for hash (value) = %u", hash);
}
@@ -236,8 +234,6 @@ dht_layouts_init (xlator_t *this, dht_conf_t *conf)
sizeof (dht_layout_t *),
gf_dht_mt_dht_layout_t);
if (!conf->file_layouts) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto out;
}
@@ -271,8 +267,6 @@ dht_disk_layout_extract (xlator_t *this, dht_layout_t *layout,
disk_layout = GF_CALLOC (5, sizeof (int),
gf_dht_mt_int32_t);
if (!disk_layout) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto out;
}
@@ -306,7 +300,7 @@ dht_disk_layout_merge (xlator_t *this, dht_layout_t *layout,
cnt = ntoh32 (disk_layout[0]);
if (cnt != 1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"disk layout has invalid count %d", cnt);
return -1;
}
@@ -392,7 +386,6 @@ dht_layout_entry_swap (dht_layout_t *layout, int i, int j)
xlator_t *xlator_swap = 0;
int err_swap = 0;
-
start_swap = layout->list[i].start;
stop_swap = layout->list[i].stop;
xlator_swap = layout->list[i].xlator;
@@ -562,7 +555,7 @@ dht_layout_normalize (xlator_t *this, loc_t *loc, dht_layout_t *layout)
ret = dht_layout_sort (layout);
if (ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_WARNING,
"sort failed?! how the ....");
goto out;
}
@@ -645,7 +638,7 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
if (!xattr) {
if (err == 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"%s - xattr dictionary is NULL",
loc->path);
ret = -1;
@@ -658,7 +651,7 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
if (dict_ret < 0) {
if (err == 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"%s - disk layout missing", loc->path);
ret = -1;
}
@@ -669,7 +662,7 @@ dht_layout_dir_mismatch (xlator_t *this, dht_layout_t *layout, xlator_t *subvol,
count = ntoh32 (disk_layout[0]);
if (count != 1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"%s - disk layout has invalid count %d",
loc->path, count);
ret = -1;
@@ -709,7 +702,7 @@ dht_layout_preset (xlator_t *this, xlator_t *subvol, inode_t *inode)
layout = dht_layout_for_subvol (this, subvol);
if (!layout) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"no pre-set layout for subvolume %s",
subvol ? subvol->name : "<nil>");
ret = -1;
diff --git a/xlators/cluster/dht/src/dht-linkfile.c b/xlators/cluster/dht/src/dht-linkfile.c
index 03044421833..9dd487bc87b 100644
--- a/xlators/cluster/dht/src/dht-linkfile.c
+++ b/xlators/cluster/dht/src/dht-linkfile.c
@@ -36,7 +36,6 @@ dht_linkfile_xattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
dht_local_t *local = NULL;
-
local = frame->local;
local->linkfile.linkfile_cbk (frame, cookie, this, op_ret, op_errno,
local->linkfile.inode,
@@ -61,13 +60,15 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
prev = cookie;
- if (op_ret == -1)
+ if (op_ret == -1) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: failed to create link file (%s)",
+ local->linkfile.loc.path, strerror (op_errno));
goto err;
+ }
xattr = get_new_dict ();
if (!xattr) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
op_errno = ENOMEM;
goto err;
}
@@ -77,16 +78,15 @@ dht_linkfile_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
str_data = str_to_data (local->linkfile.srcvol->name);
if (!str_data) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
op_errno = ENOMEM;
goto err;
}
ret = dict_set (xattr, "trusted.glusterfs.dht.linkto", str_data);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to initialize linkfile data");
+ gf_log (this->name, GF_LOG_INFO,
+ "%s: failed to initialize linkfile data",
+ local->linkfile.loc.path);
}
str_data = NULL;
@@ -129,12 +129,13 @@ dht_linkfile_create (call_frame_t *frame, fop_mknod_cbk_t linkfile_cbk,
goto out;
ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);
if (ret)
- gf_log ("dht-linkfile", GF_LOG_DEBUG, "gfid set failed");
+ gf_log ("dht-linkfile", GF_LOG_INFO,
+ "%s: gfid set failed", loc->path);
} else if (local->params) {
dict = dict_ref (local->params);
}
if (!dict)
- gf_log ("", GF_LOG_DEBUG,
+ gf_log (frame->this->name, GF_LOG_INFO,
"dict is NULL, need to make sure gfid's are same");
STACK_WIND (frame, dht_linkfile_create_cbk,
@@ -166,7 +167,7 @@ dht_linkfile_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
subvol = prev->this;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"unlinking linkfile %s on %s failed (%s)",
local->loc.path, subvol->name, strerror (op_errno));
}
@@ -186,15 +187,11 @@ dht_linkfile_unlink (call_frame_t *frame, xlator_t *this,
unlink_frame = copy_frame (frame);
if (!unlink_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
unlink_local = dht_local_init (unlink_frame);
if (!unlink_local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -222,7 +219,6 @@ dht_linkfile_subvol (xlator_t *this, inode_t *inode, struct iatt *stbuf,
void *volname = NULL;
int i = 0, ret = 0;
-
conf = this->private;
if (!xattr)
diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c
index 4366c80ae19..f6ed8769d8d 100644
--- a/xlators/cluster/dht/src/dht-rename.c
+++ b/xlators/cluster/dht/src/dht-rename.c
@@ -41,37 +41,38 @@ dht_rename_dir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int this_call_cnt = 0;
call_frame_t *prev = NULL;
-
local = frame->local;
prev = cookie;
if (op_ret == -1) {
/* TODO: undo the damage */
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"rename %s -> %s on %s failed (%s)",
local->loc.path, local->loc2.path,
prev->this->name, strerror (op_errno));
local->op_ret = op_ret;
local->op_errno = op_errno;
- } else {
- /* TODO: construct proper stbuf for dir */
- /*
- * FIXME: is this the correct way to build stbuf and
- * parent bufs?
- */
- dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
- dht_iatt_merge (this, &local->preoldparent, preoldparent,
- prev->this);
- dht_iatt_merge (this, &local->postoldparent, postoldparent,
- prev->this);
- dht_iatt_merge (this, &local->preparent, prenewparent,
- prev->this);
- dht_iatt_merge (this, &local->postparent, postnewparent,
- prev->this);
+ goto unwind;
}
+ /* TODO: construct proper stbuf for dir */
+ /*
+ * FIXME: is this the correct way to build stbuf and
+ * parent bufs?
+ */
+ dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
+ dht_iatt_merge (this, &local->preoldparent, preoldparent,
+ prev->this);
+ dht_iatt_merge (this, &local->postoldparent, postoldparent,
+ prev->this);
+ dht_iatt_merge (this, &local->preparent, prenewparent,
+ prev->this);
+ dht_iatt_merge (this, &local->postparent, postnewparent,
+ prev->this);
+
+unwind:
this_call_cnt = dht_frame_return (frame);
if (is_last_call (this_call_cnt)) {
local->stbuf.ia_ino = local->loc.inode->ino;
@@ -172,7 +173,7 @@ dht_rename_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
prev = cookie;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"opendir on %s for %s failed (%s)",
prev->this->name, local->loc.path,
strerror (op_errno));
@@ -212,6 +213,9 @@ dht_rename_dir (call_frame_t *frame, xlator_t *this)
for (i = 0; i < conf->subvolume_cnt; i++) {
if (!conf->subvolume_status[i]) {
+ gf_log (this->name, GF_LOG_INFO,
+ "one of the subvolumes down (%s)",
+ conf->subvolumes[i]->name);
op_errno = ENOTCONN;
goto err;
}
@@ -219,8 +223,6 @@ dht_rename_dir (call_frame_t *frame, xlator_t *this)
local->fd = fd_create (local->loc.inode, frame->root->pid);
if (!local->fd) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
op_errno = ENOMEM;
goto err;
}
@@ -269,9 +271,9 @@ dht_rename_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
this_call_cnt = dht_frame_return (frame);
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "unlink on %s failed (%s)",
- prev->this->name, strerror (op_errno));
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: unlink on %s failed (%s)",
+ local->loc.path, prev->this->name, strerror (op_errno));
}
WIPE (&local->preoldparent);
@@ -383,9 +385,9 @@ dht_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
dst_cached = local->dst_cached;
if (op_ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "rename on %s failed (%s)", prev->this->name,
- strerror (op_errno));
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: rename on %s failed (%s)", local->loc.path,
+ prev->this->name, strerror (op_errno));
local->op_ret = op_ret;
local->op_errno = op_errno;
goto cleanup;
@@ -634,7 +636,7 @@ dht_rename (call_frame_t *frame, xlator_t *this,
src_hashed = dht_subvol_get_hashed (this, oldloc);
if (!src_hashed) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"no subvolume in layout for path=%s",
oldloc->path);
op_errno = EINVAL;
@@ -643,7 +645,7 @@ dht_rename (call_frame_t *frame, xlator_t *this,
src_cached = dht_subvol_get_cached (this, oldloc->inode);
if (!src_cached) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"no cached subvolume for path=%s", oldloc->path);
op_errno = EINVAL;
goto err;
@@ -651,7 +653,7 @@ dht_rename (call_frame_t *frame, xlator_t *this,
dst_hashed = dht_subvol_get_hashed (this, newloc);
if (!dst_hashed) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"no subvolume in layout for path=%s",
newloc->path);
op_errno = EINVAL;
@@ -664,24 +666,18 @@ dht_rename (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
ret = loc_copy (&local->loc, oldloc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
ret = loc_copy (&local->loc2, newloc);
if (ret == -1) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c
index f10f9781a5d..ddd043dc8a4 100644
--- a/xlators/cluster/dht/src/dht-selfheal.c
+++ b/xlators/cluster/dht/src/dht-selfheal.c
@@ -33,7 +33,6 @@ dht_selfheal_dir_finish (call_frame_t *frame, xlator_t *this, int ret)
{
dht_local_t *local = NULL;
-
local = frame->local;
local->selfheal.dir_cbk (frame, NULL, frame->this, ret,
local->op_errno);
@@ -97,23 +96,23 @@ dht_selfheal_dir_xattr_persubvol (call_frame_t *frame, loc_t *loc,
xattr = get_new_dict ();
if (!xattr) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
ret = dht_disk_layout_extract (this, layout, i, &disk_layout);
if (ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to extract disk layout");
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: (subvol %s) failed to extract disk layout",
+ loc->path, subvol->name);
goto err;
}
ret = dict_set_bin (xattr, "trusted.glusterfs.dht",
disk_layout, 4 * 4);
if (ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
- "failed to set xattr dictionary");
+ gf_log (this->name, GF_LOG_WARNING,
+ "%s: (subvol %s) failed to set xattr dictionary",
+ loc->path, subvol->name);
goto err;
}
disk_layout = NULL;
@@ -163,6 +162,7 @@ dht_selfheal_dir_xattr (call_frame_t *frame, loc_t *loc, dht_layout_t *layout)
* or the directory is itself non existant.
* !layout->list[i].stop would mean layout absent
*/
+
continue;
}
missing_xattr++;
@@ -239,7 +239,7 @@ dht_selfheal_dir_setattr (call_frame_t *frame, loc_t *loc, struct iatt *stbuf,
for (i = 0; i < layout->cnt; i++) {
if (layout->list[i].err == -1) {
gf_log (this->name, GF_LOG_TRACE,
- "setattr %s on subvol %s",
+ "setattr for %s on subvol %s",
loc->path, layout->list[i].xlator->name);
STACK_WIND (frame, dht_selfheal_dir_setattr_cbk,
@@ -280,9 +280,13 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
- if (op_ret)
+ if (op_ret) {
+ gf_log (this->name, ((op_errno == EEXIST) ? GF_LOG_DEBUG :
+ GF_LOG_WARNING),
+ "selfhealing directory %s failed: %s",
+ local->loc.path, strerror (op_errno));
goto out;
-
+ }
dht_iatt_merge (this, &local->stbuf, stbuf, prev->this);
if (prev->this == local->hashed_subvol)
@@ -335,7 +339,7 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc,
ret = dict_set_static_bin (dict, "gfid-req", local->gfid, 16);
if (ret)
gf_log (this->name, GF_LOG_INFO,
- "failed to set gfid in dict");
+ "%s: failed to set gfid in dict", loc->path);
} else if (local->params) {
/* Send the dictionary from higher layers directly */
dict = dict_ref (local->params);
@@ -347,7 +351,7 @@ dht_selfheal_dir_mkdir (call_frame_t *frame, loc_t *loc,
for (i = 0; i < layout->cnt; i++) {
if (layout->list[i].err == ENOENT || force) {
- gf_log (this->name, GF_LOG_TRACE,
+ gf_log (this->name, GF_LOG_DEBUG,
"creating directory %s on subvol %s",
loc->path, layout->list[i].xlator->name);
@@ -561,14 +565,14 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
local->selfheal.layout = dht_layout_ref (this, layout);
if (down) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"%d subvolumes down -- not fixing", down);
ret = 0;
goto sorry_no_fix;
}
if (misc) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"%d subvolumes have unrecoverable errors", misc);
ret = 0;
goto sorry_no_fix;
@@ -578,7 +582,7 @@ dht_selfheal_directory (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
ret = dht_selfheal_dir_getafix (frame, loc, layout);
if (ret == -1) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"not able to form layout for the directory");
goto sorry_no_fix;
}
@@ -602,7 +606,6 @@ dht_selfheal_restore (call_frame_t *frame, dht_selfheal_dir_cbk_t dir_cbk,
int ret = 0;
dht_local_t *local = NULL;
-
local = frame->local;
local->selfheal.dir_cbk = dir_cbk;
diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c
index fc500b61a2e..61c43a8d604 100644
--- a/xlators/cluster/dht/src/dht.c
+++ b/xlators/cluster/dht/src/dht.c
@@ -43,8 +43,8 @@ dht_layout_dump (dht_layout_t *layout, const char *prefix)
char key[GF_DUMP_MAX_BUF_LEN];
int i = 0;
- if (!layout)
- return;
+ GF_VALIDATE_OR_GOTO ("dht", layout, out);
+ GF_VALIDATE_OR_GOTO ("dht", prefix, out);
gf_proc_dump_build_key(key, prefix, "cnt");
gf_proc_dump_write(key, "%d", layout->cnt);
@@ -73,6 +73,9 @@ dht_layout_dump (dht_layout_t *layout, const char *prefix)
layout->list[i].xlator->name);
}
}
+
+out:
+ return;
}
@@ -83,10 +86,9 @@ dht_priv_dump (xlator_t *this)
char key[GF_DUMP_MAX_BUF_LEN];
int i = 0;
dht_conf_t *conf = NULL;
- int ret = 0;
+ int ret = -1;
- if (!this)
- return -1;
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
conf = this->private;
@@ -160,7 +162,8 @@ dht_priv_dump (xlator_t *this)
UNLOCK(&conf->subvolume_lock);
- return 0;
+out:
+ return ret;
}
int32_t
@@ -171,8 +174,8 @@ dht_inodectx_dump (xlator_t *this, inode_t *inode)
dht_layout_t *layout = NULL;
uint64_t tmp_layout = 0;
- if (!inode)
- return -1;
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", inode, out);
ret = inode_ctx_get (inode, this, &tmp_layout);
@@ -188,7 +191,8 @@ dht_inodectx_dump (xlator_t *this, inode_t *inode)
"%s.inode.%ld", this->name, inode->ino);
dht_layout_dump(layout, key_prefix);
- return 0;
+out:
+ return ret;
}
int
@@ -196,8 +200,11 @@ notify (xlator_t *this, int event, void *data, ...)
{
int ret = -1;
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+
ret = dht_notify (this, event, data);
+out:
return ret;
}
@@ -207,6 +214,8 @@ fini (xlator_t *this)
int i = 0;
dht_conf_t *conf = NULL;
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+
conf = this->private;
this->private = NULL;
if (conf) {
@@ -228,7 +237,7 @@ fini (xlator_t *this)
GF_FREE (conf);
}
-
+out:
return;
}
@@ -237,8 +246,7 @@ mem_acct_init (xlator_t *this)
{
int ret = -1;
- if (!this)
- return ret;
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
ret = xlator_mem_acct_init (this, gf_dht_mt_end + 1);
@@ -247,7 +255,7 @@ mem_acct_init (xlator_t *this)
"failed");
return ret;
}
-
+out:
return ret;
}
int
@@ -257,9 +265,8 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
gf_boolean_t search_unhashed;
int ret = 0;
-
-
-
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", options, out);
if (dict_get_str (options, "lookup-unhashed", &temp_str) == 0) {
if (strcasecmp (temp_str, "auto")) {
@@ -267,12 +274,10 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
gf_log(this->name, GF_LOG_DEBUG, "Validated"
" lookup-unahashed (%s)",
temp_str);
- }
- else {
+ } else {
gf_log(this->name, GF_LOG_ERROR, "Validation:"
" lookup-unahashed should be boolean,"
- " not (%s)",
- temp_str);
+ " not (%s)", temp_str);
*op_errstr = gf_strdup ("Error, lookup-"
"unhashed be boolean");
ret = -1;
@@ -282,10 +287,6 @@ validate_options (xlator_t *this, dict_t *options, char **op_errstr)
}
}
-
-
-
-
out:
return ret;
}
@@ -297,8 +298,10 @@ reconfigure (xlator_t *this, dict_t *options)
char *temp_str = NULL;
gf_boolean_t search_unhashed;
uint32_t temp_free_disk = 0;
- int ret = 0;
+ int ret = -1;
+ GF_VALIDATE_OR_GOTO ("dht", this, out);
+ GF_VALIDATE_OR_GOTO ("dht", options, out);
conf = this->private;
if (!conf)
@@ -312,8 +315,7 @@ reconfigure (xlator_t *this, dict_t *options)
" lookup-unahashed reconfigured (%s)",
temp_str);
conf->search_unhashed = search_unhashed;
- }
- else {
+ } else {
gf_log(this->name, GF_LOG_ERROR, "Reconfigure:"
" lookup-unahashed should be boolean,"
" not (%s), defaulting to (%d)",
@@ -322,9 +324,7 @@ reconfigure (xlator_t *this, dict_t *options)
ret = -1;
goto out;
}
-
- }
- else {
+ } else {
gf_log(this->name, GF_LOG_DEBUG, "Reconfigure:"
" lookup-unahashed reconfigured auto ");
conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_AUTO;
@@ -349,7 +349,7 @@ reconfigure (xlator_t *this, dict_t *options)
" min-free-disk reconfigured to %s",
temp_str);
}
-
+ ret = 0;
out:
return ret;
}
@@ -363,6 +363,7 @@ init (xlator_t *this)
int i = 0;
uint32_t temp_free_disk = 0;
+ GF_VALIDATE_OR_GOTO ("dht", this, err);
if (!this->children) {
gf_log (this->name, GF_LOG_CRITICAL,
@@ -377,8 +378,6 @@ init (xlator_t *this)
conf = GF_CALLOC (1, sizeof (*conf), gf_dht_mt_dht_conf_t);
if (!conf) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -437,8 +436,6 @@ init (xlator_t *this)
conf->du_stats = GF_CALLOC (conf->subvolume_cnt, sizeof (dht_du_t),
gf_dht_mt_dht_du_t);
if (!conf->du_stats) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
diff --git a/xlators/cluster/dht/src/nufa.c b/xlators/cluster/dht/src/nufa.c
index 6f81269d6b1..6f14362f49f 100644
--- a/xlators/cluster/dht/src/nufa.c
+++ b/xlators/cluster/dht/src/nufa.c
@@ -98,8 +98,6 @@ nufa_local_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (!local->layout) {
op_ret = -1;
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_DEBUG,
- "memory allocation failed :(");
goto err;
}
@@ -178,8 +176,6 @@ nufa_lookup (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -336,8 +332,6 @@ nufa_create (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -361,8 +355,6 @@ nufa_create (call_frame_t *frame, xlator_t *this,
/* create a link file instead of actual file */
ret = loc_copy (&local->loc, loc);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
op_errno = ENOMEM;
goto err;
}
@@ -447,8 +439,6 @@ nufa_mknod (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -473,8 +463,6 @@ nufa_mknod (call_frame_t *frame, xlator_t *this,
/* Create linkfile first */
ret = loc_copy (&local->loc, loc);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
op_errno = ENOMEM;
goto err;
}
@@ -575,8 +563,6 @@ init (xlator_t *this)
conf = GF_CALLOC (1, sizeof (*conf),
gf_dht_mt_dht_conf_t);
if (!conf) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -663,8 +649,6 @@ init (xlator_t *this)
conf->du_stats = GF_CALLOC (conf->subvolume_cnt, sizeof (dht_du_t),
gf_dht_mt_dht_du_t);
if (!conf->du_stats) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
diff --git a/xlators/cluster/dht/src/switch.c b/xlators/cluster/dht/src/switch.c
index e48e369a4d4..20356e24eb4 100644
--- a/xlators/cluster/dht/src/switch.c
+++ b/xlators/cluster/dht/src/switch.c
@@ -252,8 +252,6 @@ switch_lookup (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -351,8 +349,6 @@ switch_lookup (call_frame_t *frame, xlator_t *this,
conf->subvolume_cnt);
if (!local->layout) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -439,8 +435,6 @@ switch_create (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -463,8 +457,6 @@ switch_create (call_frame_t *frame, xlator_t *this,
/* create a link file instead of actual file */
ret = loc_copy (&local->loc, loc);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
op_errno = ENOMEM;
goto err;
}
@@ -545,8 +537,6 @@ switch_mknod (call_frame_t *frame, xlator_t *this,
local = dht_local_init (frame);
if (!local) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -570,8 +560,6 @@ switch_mknod (call_frame_t *frame, xlator_t *this,
/* Create linkfile first */
ret = loc_copy (&local->loc, loc);
if (ret == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
op_errno = ENOMEM;
goto err;
}
@@ -898,8 +886,6 @@ init (xlator_t *this)
conf = GF_CALLOC (1, sizeof (*conf), gf_switch_mt_dht_conf_t);
if (!conf) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}
@@ -967,8 +953,6 @@ init (xlator_t *this)
conf->du_stats = GF_CALLOC (conf->subvolume_cnt, sizeof (dht_du_t),
gf_switch_mt_dht_du_t);
if (!conf->du_stats) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
goto err;
}