summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/afr/src')
-rw-r--r--xlators/cluster/afr/src/afr-common.c205
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c59
-rw-r--r--xlators/cluster/afr/src/afr-inode-write.c50
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c88
-rw-r--r--xlators/cluster/afr/src/afr-transaction.c34
-rw-r--r--xlators/cluster/afr/src/afr.c19
6 files changed, 139 insertions, 316 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index c432cc49b14..7e54bfe5bd1 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -123,7 +123,13 @@ afr_set_split_brain (xlator_t *this, inode_t *inode, gf_boolean_t set)
} else {
ctx = (~AFR_ICTX_SPLIT_BRAIN_MASK & ctx);
}
- __inode_ctx_put (inode, this, ctx);
+
+ ret = __inode_ctx_put (inode, this, ctx);
+ if (ret) {
+ gf_log_callingfn (this->name, GF_LOG_INFO,
+ "failed to set the inode ctx (%s)",
+ uuid_utoa (inode->gfid));
+ }
}
UNLOCK (&inode->lock);
out:
@@ -134,8 +140,7 @@ out:
uint64_t
afr_is_opendir_done (xlator_t *this, inode_t *inode)
{
- int ret = 0;
-
+ int ret = 0;
uint64_t ctx = 0;
uint64_t opendir_done = 0;
@@ -177,7 +182,12 @@ afr_set_opendir_done (xlator_t *this, inode_t *inode)
ctx = (~AFR_ICTX_OPENDIR_DONE_MASK & ctx)
| (0xFFFFFFFFFFFFFFFFULL & AFR_ICTX_OPENDIR_DONE_MASK);
- __inode_ctx_put (inode, this, ctx);
+ ret = __inode_ctx_put (inode, this, ctx);
+ if (ret) {
+ gf_log_callingfn (this->name, GF_LOG_INFO,
+ "failed to set the inode ctx (%s)",
+ uuid_utoa (inode->gfid));
+ }
}
UNLOCK (&inode->lock);
out:
@@ -231,7 +241,12 @@ afr_set_read_child (xlator_t *this, inode_t *inode, int32_t read_child)
ctx = (~AFR_ICTX_READ_CHILD_MASK & ctx)
| (AFR_ICTX_READ_CHILD_MASK & read_child);
- __inode_ctx_put (inode, this, ctx);
+ ret = __inode_ctx_put (inode, this, ctx);
+ if (ret) {
+ gf_log_callingfn (this->name, GF_LOG_INFO,
+ "failed to set the inode ctx (%s)",
+ uuid_utoa (inode->gfid));
+ }
}
UNLOCK (&inode->lock);
@@ -348,7 +363,7 @@ afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this)
void
afr_local_cleanup (afr_local_t *local, xlator_t *this)
{
- int i;
+ int i = 0;
afr_private_t * priv = NULL;
if (!local)
@@ -525,7 +540,7 @@ afr_self_heal_lookup_unwind (call_frame_t *frame, xlator_t *this)
local = frame->local;
- if (local->govinda_gOvinda) {
+ if (local->govinda_gOvinda && local->cont.lookup.inode) {
afr_set_split_brain (this, local->cont.lookup.inode, _gf_true);
}
@@ -543,10 +558,9 @@ static void
afr_lookup_collect_xattr (afr_local_t *local, xlator_t *this,
int child_index, dict_t *xattr)
{
- uint32_t inodelk_count = 0;
- uint32_t entrylk_count = 0;
-
- int ret = 0;
+ uint32_t inodelk_count = 0;
+ uint32_t entrylk_count = 0;
+ int ret = 0;
if (afr_sh_has_metadata_pending (xattr, child_index, this)) {
local->self_heal.need_metadata_self_heal = _gf_true;
@@ -557,13 +571,13 @@ afr_lookup_collect_xattr (afr_local_t *local, xlator_t *this,
if (afr_sh_has_entry_pending (xattr, child_index, this)) {
local->self_heal.need_entry_self_heal = _gf_true;
- gf_log(this->name, GF_LOG_DEBUG,
+ gf_log(this->name, GF_LOG_INFO,
"entry self-heal is pending for %s.", local->loc.path);
}
if (afr_sh_has_data_pending (xattr, child_index, this)) {
local->self_heal.need_data_self_heal = _gf_true;
- gf_log(this->name, GF_LOG_DEBUG,
+ gf_log(this->name, GF_LOG_INFO,
"data self-heal is pending for %s.", local->loc.path);
}
@@ -587,7 +601,7 @@ afr_lookup_self_heal_check (xlator_t *this, afr_local_t *local,
/* mismatching filetypes with same name
*/
- gf_log (this->name, GF_LOG_NORMAL,
+ gf_log (this->name, GF_LOG_INFO,
"filetype differs for %s ", local->loc.path);
local->govinda_gOvinda = 1;
@@ -595,7 +609,7 @@ afr_lookup_self_heal_check (xlator_t *this, afr_local_t *local,
if (PERMISSION_DIFFERS (buf, lookup_buf)) {
/* mismatching permissions */
- gf_log (this->name, GF_LOG_NORMAL,
+ gf_log (this->name, GF_LOG_INFO,
"permissions differ for %s ", local->loc.path);
local->self_heal.need_metadata_self_heal = _gf_true;
}
@@ -603,13 +617,13 @@ afr_lookup_self_heal_check (xlator_t *this, afr_local_t *local,
if (OWNERSHIP_DIFFERS (buf, lookup_buf)) {
/* mismatching permissions */
local->self_heal.need_metadata_self_heal = _gf_true;
- gf_log (this->name, GF_LOG_NORMAL,
+ gf_log (this->name, GF_LOG_INFO,
"ownership differs for %s ", local->loc.path);
}
if (SIZE_DIFFERS (buf, lookup_buf)
&& IA_ISREG (buf->ia_type)) {
- gf_log (this->name, GF_LOG_NORMAL,
+ gf_log (this->name, GF_LOG_INFO,
"size differs for %s ", local->loc.path);
local->self_heal.need_data_self_heal = _gf_true;
}
@@ -624,7 +638,6 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct iatt *lookup_buf)
int source = -1;
int up_count = 0;
char sh_type_str[256] = {0,};
-
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
@@ -657,19 +670,18 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct iatt *lookup_buf)
local->self_heal.need_metadata_self_heal = _gf_true;
local->self_heal.need_data_self_heal = _gf_true;
local->self_heal.need_entry_self_heal = _gf_true;
- gf_log(this->name, GF_LOG_NORMAL,
+ gf_log(this->name, GF_LOG_INFO,
"entries are missing in lookup of %s.",
local->loc.path);
}
if (local->success_count) {
/* check for split-brain case in previous lookup */
- if (afr_is_split_brain (this,
- local->cont.lookup.inode)) {
+ if (afr_is_split_brain (this, local->cont.lookup.inode)) {
local->self_heal.need_data_self_heal = _gf_true;
- gf_log(this->name, GF_LOG_NORMAL,
- "split brain detected during lookup of "
- "%s.", local->loc.path);
+ gf_log(this->name, GF_LOG_WARNING,
+ "split brain detected during lookup of %s.",
+ local->loc.path);
}
}
@@ -694,29 +706,30 @@ afr_lookup_done (call_frame_t *frame, xlator_t *this, struct iatt *lookup_buf)
source);
}
}
- } else {
- if (!local->cont.lookup.inode->ia_type) {
- /* fix for RT #602 */
- local->cont.lookup.inode->ia_type =
- lookup_buf->ia_type;
- }
+ goto unwind;
+ }
- local->self_heal.background = _gf_true;
- local->self_heal.type = local->cont.lookup.buf.ia_type;
- local->self_heal.unwind = afr_self_heal_lookup_unwind;
+ if (!local->cont.lookup.inode->ia_type) {
+ /* fix for RT #602 */
+ local->cont.lookup.inode->ia_type =
+ lookup_buf->ia_type;
+ }
- unwind = 0;
+ local->self_heal.background = _gf_true;
+ local->self_heal.type = local->cont.lookup.buf.ia_type;
+ local->self_heal.unwind = afr_self_heal_lookup_unwind;
- afr_self_heal_type_str_get(&local->self_heal,
- sh_type_str,
- sizeof(sh_type_str));
+ unwind = 0;
- gf_log (this->name, GF_LOG_NORMAL, "background %s "
- "self-heal triggered. path: %s",
- sh_type_str, local->loc.path);
+ afr_self_heal_type_str_get(&local->self_heal,
+ sh_type_str,
+ sizeof(sh_type_str));
- afr_self_heal (frame, this);
- }
+ gf_log (this->name, GF_LOG_INFO,
+ "background %s self-heal triggered. path: %s",
+ sh_type_str, local->loc.path);
+
+ afr_self_heal (frame, this);
}
unwind:
@@ -766,7 +779,6 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
struct iatt * lookup_buf = NULL;
-
int call_count = -1;
int child_index = -1;
int first_up_child = -1;
@@ -815,7 +827,7 @@ afr_fresh_lookup_cbk (call_frame_t *frame, void *cookie,
local->cont.lookup.postparent = *postparent;
if (priv->first_lookup && inode->ino == 1) {
- gf_log (this->name, GF_LOG_NORMAL,
+ gf_log (this->name, GF_LOG_INFO,
"added root inode");
priv->root_inode = inode_ref (inode);
priv->first_lookup = 0;
@@ -880,7 +892,6 @@ afr_revalidate_lookup_cbk (call_frame_t *frame, void *cookie,
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
struct iatt * lookup_buf = NULL;
-
int call_count = -1;
int child_index = -1;
int first_up_child = -1;
@@ -993,18 +1004,14 @@ int
afr_lookup (call_frame_t *frame, xlator_t *this,
loc_t *loc, dict_t *xattr_req)
{
- afr_private_t *priv = NULL;
- afr_local_t *local = NULL;
- int ret = -1;
- int i = 0;
-
- fop_lookup_cbk_t callback;
-
- int call_count = 0;
-
- uint64_t ctx;
-
- int32_t op_errno = 0;
+ afr_private_t *priv = NULL;
+ afr_local_t *local = NULL;
+ int ret = -1;
+ int i = 0;
+ fop_lookup_cbk_t callback = NULL;
+ int call_count = 0;
+ uint64_t ctx = 0;
+ int32_t op_errno = 0;
priv = this->private;
@@ -1073,20 +1080,23 @@ afr_lookup (call_frame_t *frame, xlator_t *this,
3 * sizeof(int32_t));
if (ret < 0)
gf_log (this->name, GF_LOG_WARNING,
- "Unable to set dict value.");
+ "%s: Unable to set dict value for %s",
+ loc->path, priv->pending_key[i]);
/* 3 = data+metadata+entry */
}
ret = dict_set_uint64 (local->xattr_req, GLUSTERFS_INODELK_COUNT, 0);
if (ret < 0) {
gf_log (this->name, GF_LOG_WARNING,
- "Unable to set dict value.");
+ "%s: Unable to set dict value for %s",
+ loc->path, GLUSTERFS_INODELK_COUNT);
}
ret = dict_set_uint64 (local->xattr_req, GLUSTERFS_ENTRYLK_COUNT, 0);
if (ret < 0) {
gf_log (this->name, GF_LOG_WARNING,
- "Unable to set dict value.");
+ "%s: Unable to set dict value for %s",
+ loc->path, GLUSTERFS_ENTRYLK_COUNT);
}
for (i = 0; i < priv->child_count; i++) {
@@ -1115,12 +1125,10 @@ out:
int
afr_fd_ctx_set (xlator_t *this, fd_t *fd)
{
- afr_private_t * priv = NULL;
-
- int ret = -1;
-
- uint64_t ctx;
- afr_fd_ctx_t * fd_ctx = NULL;
+ afr_private_t * priv = NULL;
+ int ret = -1;
+ uint64_t ctx = 0;
+ afr_fd_ctx_t * fd_ctx = NULL;
VALIDATE_OR_GOTO (this->private, out);
VALIDATE_OR_GOTO (fd, out);
@@ -1137,9 +1145,6 @@ afr_fd_ctx_set (xlator_t *this, fd_t *fd)
fd_ctx = GF_CALLOC (1, sizeof (afr_fd_ctx_t),
gf_afr_mt_afr_fd_ctx_t);
if (!fd_ctx) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
-
ret = -ENOMEM;
goto unlock;
}
@@ -1148,8 +1153,6 @@ afr_fd_ctx_set (xlator_t *this, fd_t *fd)
priv->child_count,
gf_afr_mt_char);
if (!fd_ctx->pre_op_done) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
ret = -ENOMEM;
goto unlock;
}
@@ -1158,8 +1161,6 @@ afr_fd_ctx_set (xlator_t *this, fd_t *fd)
priv->child_count,
gf_afr_mt_char);
if (!fd_ctx->pre_op_piggyback) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
ret = -ENOMEM;
goto unlock;
}
@@ -1168,8 +1169,6 @@ afr_fd_ctx_set (xlator_t *this, fd_t *fd)
priv->child_count,
gf_afr_mt_char);
if (!fd_ctx->opened_on) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
ret = -ENOMEM;
goto unlock;
}
@@ -1181,13 +1180,14 @@ afr_fd_ctx_set (xlator_t *this, fd_t *fd)
priv->child_count,
gf_afr_mt_char);
if (!fd_ctx->locked_on) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
ret = -ENOMEM;
goto unlock;
}
ret = __fd_ctx_set (fd, this, (uint64_t)(long) fd_ctx);
+ if (ret)
+ gf_log (this->name, GF_LOG_DEBUG,
+ "failed to set fd ctx (%p)", fd);
INIT_LIST_HEAD (&fd_ctx->entries);
}
@@ -1230,7 +1230,6 @@ afr_flush_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int child_index = (long) cookie;
int need_unwind = 0;
@@ -1276,7 +1275,6 @@ afr_flush_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int i = 0;
int call_count = -1;
@@ -1329,14 +1327,10 @@ afr_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
{
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
-
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
-
int call_count = 0;
VALIDATE_OR_GOTO (frame, out);
@@ -1358,8 +1352,6 @@ afr_flush (call_frame_t *frame, xlator_t *this, fd_t *fd)
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
op_errno = ENOMEM;
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1403,7 +1395,6 @@ afr_cleanup_fd_ctx (xlator_t *this, fd_t *fd)
int ret = 0;
ret = fd_ctx_get (fd, this, &ctx);
-
if (ret < 0)
goto out;
@@ -1463,9 +1454,7 @@ afr_fsync_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *postbuf)
{
afr_local_t *local = NULL;
-
int call_count = -1;
-
int child_index = (long) cookie;
int read_child = 0;
@@ -1520,9 +1509,7 @@ afr_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -1577,7 +1564,6 @@ afr_fsyncdir_cbk (call_frame_t *frame, void *cookie,
xlator_t *this, int32_t op_ret, int32_t op_errno)
{
afr_local_t *local = NULL;
-
int call_count = -1;
local = frame->local;
@@ -1607,9 +1593,7 @@ afr_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -1661,7 +1645,6 @@ afr_xattrop_cbk (call_frame_t *frame, void *cookie,
dict_t *xattr)
{
afr_local_t *local = NULL;
-
int call_count = -1;
local = frame->local;
@@ -1691,9 +1674,7 @@ afr_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -1775,9 +1756,7 @@ afr_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -1828,7 +1807,6 @@ afr_inodelk_cbk (call_frame_t *frame, void *cookie,
{
afr_local_t *local = NULL;
-
int call_count = -1;
local = frame->local;
@@ -1858,9 +1836,7 @@ afr_inodelk (call_frame_t *frame, xlator_t *this,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -1910,7 +1886,6 @@ afr_finodelk_cbk (call_frame_t *frame, void *cookie,
{
afr_local_t *local = NULL;
-
int call_count = -1;
local = frame->local;
@@ -1940,9 +1915,7 @@ afr_finodelk (call_frame_t *frame, xlator_t *this,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -1992,7 +1965,6 @@ afr_entrylk_cbk (call_frame_t *frame, void *cookie,
{
afr_local_t *local = NULL;
-
int call_count = -1;
local = frame->local;
@@ -2023,9 +1995,7 @@ afr_entrylk (call_frame_t *frame, xlator_t *this,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -2076,7 +2046,6 @@ afr_fentrylk_cbk (call_frame_t *frame, void *cookie,
{
afr_local_t *local = NULL;
-
int call_count = -1;
local = frame->local;
@@ -2107,9 +2076,7 @@ afr_fentrylk (call_frame_t *frame, xlator_t *this,
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int ret = -1;
-
int i = 0;
int32_t call_count = 0;
int32_t op_ret = -1;
@@ -2158,7 +2125,6 @@ afr_statfs_cbk (call_frame_t *frame, void *cookie,
struct statvfs *statvfs)
{
afr_local_t *local = NULL;
-
int call_count = 0;
LOCK (&frame->lock);
@@ -2201,8 +2167,7 @@ afr_statfs (call_frame_t *frame, xlator_t *this,
int child_count = 0;
afr_local_t * local = NULL;
int i = 0;
-
- int ret = -1;
+ int ret = -1;
int call_count = 0;
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -2250,7 +2215,6 @@ afr_lk_unlock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct gf_flock *lock)
{
afr_local_t * local = NULL;
-
int call_count = -1;
local = frame->local;
@@ -2269,8 +2233,7 @@ afr_lk_unlock (call_frame_t *frame, xlator_t *this)
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
- int i;
+ int i = 0;
int call_count = 0;
local = frame->local;
@@ -2312,9 +2275,9 @@ afr_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
+ int child_index = -1;
/* int ret = 0; */
- int child_index = -1;
local = frame->local;
priv = this->private;
@@ -2375,14 +2338,11 @@ afr_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
afr_lk (call_frame_t *frame, xlator_t *this,
- fd_t *fd, int32_t cmd,
- struct gf_flock *flock)
+ fd_t *fd, int32_t cmd, struct gf_flock *flock)
{
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int i = 0;
-
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -2402,7 +2362,6 @@ afr_lk (call_frame_t *frame, xlator_t *this,
gf_afr_mt_char);
if (!local->cont.lk.locked_nodes) {
- gf_log (this->name, GF_LOG_ERROR, "Out of memory");
op_errno = ENOMEM;
goto out;
}
@@ -2490,7 +2449,6 @@ static int
find_child_index (xlator_t *this, xlator_t *child)
{
afr_private_t *priv = NULL;
-
int i = -1;
priv = this->private;
@@ -2509,7 +2467,6 @@ afr_notify (xlator_t *this, int32_t event,
{
afr_private_t * priv = NULL;
unsigned char * child_up = NULL;
-
int i = -1;
int up_children = 0;
int down_children = 0;
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index dceb059bb01..06559ede08e 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -123,12 +123,9 @@ afr_create_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
- uint64_t ctx;
- afr_fd_ctx_t *fd_ctx;
-
+ uint64_t ctx = 0;
+ afr_fd_ctx_t *fd_ctx = NULL;
int ret = 0;
-
int call_count = -1;
int child_index = -1;
@@ -229,7 +226,6 @@ afr_create_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -288,9 +284,7 @@ afr_create (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -302,8 +296,6 @@ afr_create (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -367,7 +359,6 @@ afr_mknod_unwind (call_frame_t *frame, xlator_t *this)
{
call_frame_t *main_frame = NULL;
afr_local_t *local = NULL;
-
struct iatt *unwind_buf = NULL;
local = frame->local;
@@ -412,7 +403,6 @@ afr_mknod_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int child_index = -1;
@@ -484,7 +474,6 @@ afr_mknod_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -538,9 +527,7 @@ afr_mknod (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -552,8 +539,6 @@ afr_mknod (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -617,7 +602,6 @@ afr_mkdir_unwind (call_frame_t *frame, xlator_t *this)
{
call_frame_t *main_frame = NULL;
afr_local_t *local = NULL;
-
struct iatt *unwind_buf = NULL;
local = frame->local;
@@ -662,7 +646,6 @@ afr_mkdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int child_index = -1;
@@ -735,7 +718,6 @@ afr_mkdir_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -790,9 +772,7 @@ afr_mkdir (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -804,8 +784,6 @@ afr_mkdir (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -869,7 +847,6 @@ afr_link_unwind (call_frame_t *frame, xlator_t *this)
{
call_frame_t *main_frame = NULL;
afr_local_t *local = NULL;
-
struct iatt *unwind_buf = NULL;
local = frame->local;
@@ -914,7 +891,6 @@ afr_link_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int child_index = -1;
@@ -975,7 +951,6 @@ afr_link_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1028,9 +1003,7 @@ afr_link (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1042,8 +1015,6 @@ afr_link (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1106,7 +1077,6 @@ afr_symlink_unwind (call_frame_t *frame, xlator_t *this)
{
call_frame_t *main_frame = NULL;
afr_local_t *local = NULL;
-
struct iatt *unwind_buf = NULL;
local = frame->local;
@@ -1151,7 +1121,6 @@ afr_symlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int child_index = -1;
@@ -1222,7 +1191,6 @@ afr_symlink_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1278,9 +1246,7 @@ afr_symlink (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1292,8 +1258,6 @@ afr_symlink (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1355,7 +1319,6 @@ afr_rename_unwind (call_frame_t *frame, xlator_t *this)
{
call_frame_t *main_frame = NULL;
afr_local_t *local = NULL;
-
struct iatt *unwind_buf = NULL;
local = frame->local;
@@ -1403,7 +1366,6 @@ afr_rename_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *prenewparent, struct iatt *postnewparent)
{
afr_local_t * local = NULL;
-
int call_count = -1;
int child_index = -1;
@@ -1457,7 +1419,6 @@ afr_rename_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1510,9 +1471,7 @@ afr_rename (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1524,8 +1483,6 @@ afr_rename (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1619,7 +1576,6 @@ afr_unlink_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int child_index = (long) cookie;
@@ -1671,7 +1627,6 @@ afr_unlink_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1724,9 +1679,7 @@ afr_unlink (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1738,8 +1691,6 @@ afr_unlink (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1825,7 +1776,6 @@ afr_rmdir_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int child_index = (long) cookie;
int read_child = 0;
@@ -1878,7 +1828,6 @@ afr_rmdir_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1931,9 +1880,7 @@ afr_rmdir (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t * transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1945,8 +1892,6 @@ afr_rmdir (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
diff --git a/xlators/cluster/afr/src/afr-inode-write.c b/xlators/cluster/afr/src/afr-inode-write.c
index 669a51d7567..a369da6de1c 100644
--- a/xlators/cluster/afr/src/afr-inode-write.c
+++ b/xlators/cluster/afr/src/afr-inode-write.c
@@ -84,7 +84,6 @@ afr_writev_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
struct iatt *postbuf)
{
afr_local_t * local = NULL;
-
int child_index = (long) cookie;
int call_count = -1;
int read_child = 0;
@@ -135,7 +134,6 @@ afr_writev_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int i = 0;
int call_count = -1;
@@ -195,7 +193,6 @@ afr_do_writev (call_frame_t *frame, xlator_t *this)
{
call_frame_t * transaction_frame = NULL;
afr_local_t * local = NULL;
-
int op_ret = -1;
int op_errno = 0;
@@ -203,8 +200,6 @@ afr_do_writev (call_frame_t *frame, xlator_t *this)
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
op_errno = ENOMEM;
goto out;
}
@@ -251,13 +246,10 @@ afr_writev (call_frame_t *frame, xlator_t *this, fd_t *fd,
{
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
-
- uint64_t ctx;
+ uint64_t ctx = 0;
afr_fd_ctx_t *fd_ctx = NULL;
VALIDATE_OR_GOTO (frame, out);
@@ -349,7 +341,6 @@ afr_truncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int child_index = (long) cookie;
int read_child = 0;
int call_count = -1;
@@ -410,7 +401,6 @@ afr_truncate_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -466,9 +456,7 @@ afr_truncate (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t *transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -480,8 +468,6 @@ afr_truncate (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -565,7 +551,6 @@ afr_ftruncate_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int child_index = (long) cookie;
int call_count = -1;
int need_unwind = 0;
@@ -626,7 +611,6 @@ afr_ftruncate_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -679,7 +663,6 @@ afr_do_ftruncate (call_frame_t *frame, xlator_t *this)
{
call_frame_t * transaction_frame = NULL;
afr_local_t * local = NULL;
-
int op_ret = -1;
int op_errno = 0;
@@ -687,8 +670,6 @@ afr_do_ftruncate (call_frame_t *frame, xlator_t *this)
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -727,13 +708,10 @@ afr_ftruncate (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t *transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
-
- uint64_t ctx;
+ uint64_t ctx = 0;
afr_fd_ctx_t *fd_ctx = NULL;
VALIDATE_OR_GOTO (frame, out);
@@ -823,7 +801,6 @@ afr_setattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int child_index = (long) cookie;
int read_child = 0;
int call_count = -1;
@@ -884,7 +861,6 @@ afr_setattr_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -941,9 +917,7 @@ afr_setattr (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t *transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -955,8 +929,6 @@ afr_setattr (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1041,7 +1013,6 @@ afr_fsetattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int child_index = (long) cookie;
int read_child = 0;
int call_count = -1;
@@ -1102,7 +1073,6 @@ afr_fsetattr_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1159,9 +1129,7 @@ afr_fsetattr (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t *transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1173,8 +1141,6 @@ afr_fsetattr (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1252,7 +1218,6 @@ afr_setxattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int need_unwind = 0;
@@ -1294,7 +1259,6 @@ afr_setxattr_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1348,9 +1312,7 @@ afr_setxattr (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t *transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1370,8 +1332,6 @@ afr_setxattr (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
@@ -1440,7 +1400,6 @@ afr_removexattr_wind_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
{
afr_local_t * local = NULL;
afr_private_t * priv = NULL;
-
int call_count = -1;
int need_unwind = 0;
@@ -1482,7 +1441,6 @@ afr_removexattr_wind (call_frame_t *frame, xlator_t *this)
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = -1;
int i = 0;
@@ -1536,9 +1494,7 @@ afr_removexattr (call_frame_t *frame, xlator_t *this,
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
call_frame_t *transaction_frame = NULL;
-
int ret = -1;
-
int op_ret = -1;
int op_errno = 0;
@@ -1551,8 +1507,6 @@ afr_removexattr (call_frame_t *frame, xlator_t *this,
transaction_frame = copy_frame (frame);
if (!transaction_frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
goto out;
}
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index 632c8b7c424..3371bff865e 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -95,7 +95,6 @@ internal_lock_count (call_frame_t *frame, xlator_t *this,
{
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int32_t call_count = 0;
int i = 0;
@@ -476,7 +475,6 @@ initialize_inodelk_variables (call_frame_t *frame, xlator_t *this)
afr_local_t *local = NULL;
afr_internal_lock_t *int_lock = NULL;
afr_private_t *priv = NULL;
-
int i = 0;
priv = this->private;
@@ -514,7 +512,7 @@ int
afr_locked_nodes_count (unsigned char *locked_nodes, int child_count)
{
- int i;
+ int i = 0;
int call_count = 0;
for (i = 0; i < child_count; i++) {
@@ -556,13 +554,18 @@ static int32_t
afr_unlock_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno)
{
+ afr_local_t *local = NULL;
+
+ local = frame->local;
+
afr_trace_inodelk_out (frame, AFR_INODELK_TRANSACTION,
AFR_UNLOCK_OP, NULL, op_ret,
op_errno, (long) cookie);
if (op_ret < 0 && op_errno != ENOTCONN && op_errno != EBADFD) {
- gf_log (this->name, GF_LOG_TRACE,
- "Unlock failed for some reason");
+ gf_log (this->name, GF_LOG_INFO,
+ "%s: unlock failed %s",
+ local->loc.path, strerror (op_errno));
}
afr_unlock_common_cbk (frame, cookie, this, op_ret, op_errno);
@@ -577,8 +580,7 @@ afr_unlock_inodelk (call_frame_t *frame, xlator_t *this)
afr_internal_lock_t *int_lock = NULL;
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
- struct gf_flock flock;
+ struct gf_flock flock = {0,};
int call_count = 0;
int i = 0;
@@ -663,7 +665,6 @@ afr_unlock_entrylk (call_frame_t *frame, xlator_t *this)
afr_private_t *priv = NULL;
const char *basename = NULL;
loc_t *loc = NULL;
-
int call_count = 0;
int i = -1;
@@ -716,7 +717,6 @@ afr_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_internal_lock_t *int_lock = NULL;
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int done = 0;
int child_index = (long) cookie;
@@ -731,7 +731,7 @@ afr_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* return ENOTSUP */
gf_log (this->name, GF_LOG_ERROR,
"subvolume does not support locking. "
- "please load features/posix-locks xlator on server");
+ "please load features/locks xlator on server");
local->op_ret = op_ret;
int_lock->lock_op_ret = op_ret;
done = 1;
@@ -783,7 +783,6 @@ afr_lock_lower_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
loc_t *higher = NULL;
const char *lower_name = NULL;
const char *higher_name = NULL;
-
int child_index = (long) cookie;
priv = this->private;
@@ -798,7 +797,7 @@ afr_lock_lower_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
gf_log (this->name, GF_LOG_ERROR,
"subvolume does not support locking. "
- "please load features/posix-locks xlator on server");
+ "please load features/locks xlator on server");
local->op_ret = op_ret;
}
@@ -907,9 +906,8 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index)
loc_t *higher = NULL;
const char *lower_name = NULL;
const char *higher_name = NULL;
-
- struct gf_flock flock;
- uint64_t ctx;
+ struct gf_flock flock = {0,};
+ uint64_t ctx = 0;
int ret = 0;
local = frame->local;
@@ -924,7 +922,7 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index)
ret = fd_ctx_get (local->fd, this, &ctx);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"unable to get fd ctx for fd=%p",
local->fd);
@@ -960,7 +958,7 @@ afr_lock_blocking (call_frame_t *frame, xlator_t *this, int child_index)
if ((child_index == priv->child_count) &&
int_lock->lock_count == 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"unable to lock on even one child");
local->op_ret = -1;
@@ -1128,7 +1126,6 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_internal_lock_t *int_lock = NULL;
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = 0;
int child_index = (long) cookie;
@@ -1151,7 +1148,7 @@ afr_nonblocking_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* return ENOTSUP */
gf_log (this->name, GF_LOG_ERROR,
"subvolume does not support locking. "
- "please load features/posix-locks xlator on server");
+ "please load features/locks xlator on server");
local->op_ret = op_ret;
int_lock->lock_op_ret = op_ret;
@@ -1199,10 +1196,9 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
afr_fd_ctx_t *fd_ctx = NULL;
const char *basename = NULL;
loc_t *loc = NULL;
-
int32_t call_count = 0;
int i = 0;
- uint64_t ctx;
+ uint64_t ctx = 0;
int ret = 0;
local = frame->local;
@@ -1219,7 +1215,7 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
ret = fd_ctx_get (local->fd, this, &ctx);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"unable to get fd ctx for fd=%p",
local->fd);
@@ -1237,7 +1233,7 @@ afr_nonblocking_entrylk (call_frame_t *frame, xlator_t *this)
int_lock->lk_call_count = call_count;
if (!call_count) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"fd not open on any subvolumes. aborting.");
afr_unlock (frame, this);
goto out;
@@ -1294,7 +1290,6 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_internal_lock_t *int_lock = NULL;
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
-
int call_count = 0;
int child_index = (long) cookie;
@@ -1317,7 +1312,7 @@ afr_nonblocking_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
/* return ENOTSUP */
gf_log (this->name, GF_LOG_ERROR,
"subvolume does not support locking. "
- "please load features/posix-locks xlator on server");
+ "please load features/locks xlator on server");
local->op_ret = op_ret;
int_lock->lock_op_ret = op_ret;
local->child_up[child_index] = 0;
@@ -1362,12 +1357,11 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
afr_local_t *local = NULL;
afr_private_t *priv = NULL;
afr_fd_ctx_t *fd_ctx = NULL;
-
int32_t call_count = 0;
uint64_t ctx = 0;
int i = 0;
int ret = 0;
- struct gf_flock flock;
+ struct gf_flock flock = {0,};
local = frame->local;
int_lock = &local->internal_lock;
@@ -1383,7 +1377,7 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
ret = fd_ctx_get (local->fd, this, &ctx);
if (ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"unable to get fd ctx for fd=%p",
local->fd);
@@ -1402,7 +1396,7 @@ afr_nonblocking_inodelk (call_frame_t *frame, xlator_t *this)
int_lock->lk_call_count = call_count;
if (!call_count) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"fd not open on any subvolumes. aborting.");
afr_unlock (frame, this);
goto out;
@@ -1461,7 +1455,6 @@ __is_lower_locked (call_frame_t *frame, xlator_t *this)
afr_internal_lock_t *int_lock = NULL;
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int count = 0;
int i = 0;
@@ -1484,7 +1477,6 @@ __is_higher_locked (call_frame_t *frame, xlator_t *this)
afr_internal_lock_t *int_lock = NULL;
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
-
int count = 0;
int i = 0;
@@ -1509,7 +1501,6 @@ afr_unlock_lower_entrylk (call_frame_t *frame, xlator_t *this)
afr_private_t *priv = NULL;
const char *basename = NULL;
loc_t *loc = NULL;
-
int call_count = 0;
int i = -1;
@@ -1709,6 +1700,11 @@ afr_mark_locked_nodes (xlator_t *this, fd_t *fd,
goto out;
ret = fd_ctx_get (fd, this, &tmp);
+ if (ret) {
+ gf_log (this->name, GF_LOG_INFO,
+ "failed to get the fd ctx");
+ goto out;
+ }
fdctx = (afr_fd_ctx_t *) (long) tmp;
GF_ASSERT (fdctx->locked_on);
@@ -1751,8 +1747,6 @@ __afr_save_locked_fd (xlator_t *this, fd_t *fd)
locked_fd = GF_CALLOC (1, sizeof (*locked_fd),
gf_afr_mt_locked_fd);
if (!locked_fd) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
ret = -1;
goto out;
}
@@ -1784,7 +1778,7 @@ afr_save_locked_fd (xlator_t *this, fd_t *fd)
ret = __afr_save_locked_fd (this, fd);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"fd=%p could not be saved", fd);
goto unlock;
}
@@ -1835,12 +1829,10 @@ afr_get_source_lock_recovery (xlator_t *this, fd_t *fd)
for (i = 0; i < priv->child_count; i++) {
if (fdctx->locked_on[i]) {
gf_log (this->name, GF_LOG_DEBUG,
- "Found lock recovery source=%d",
- i);
+ "Found lock recovery source=%d", i);
source_child = i;
break;
}
-
}
out:
@@ -1864,7 +1856,7 @@ afr_recover_lock_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
priv = this->private;
if (op_ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"lock recovery failed");
goto cleanup;
}
@@ -1926,7 +1918,7 @@ afr_get_locks_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int32_t op_ret, int32_t op_errno, struct gf_flock *lock)
{
if (op_ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Failed to get locks on fd");
goto cleanup;
}
@@ -1935,7 +1927,7 @@ afr_get_locks_fd_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
"Got a lock on fd");
if (is_afr_lock_eol (lock)) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Reached EOL on locks on fd");
goto cleanup;
}
@@ -2017,7 +2009,7 @@ afr_lock_recovery_preopen_cbk (call_frame_t *frame, void *cookie, xlator_t *this
int ret = 0;
if (op_ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Reopen during lock-recovery failed");
goto cleanup;
}
@@ -2027,14 +2019,14 @@ afr_lock_recovery_preopen_cbk (call_frame_t *frame, void *cookie, xlator_t *this
ret = afr_lock_recovery (frame, this);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Lock recovery failed");
goto cleanup;
}
ret = afr_mark_fd_opened (this, fd, child_index);
if (ret) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Marking fd open failed");
goto cleanup;
}
@@ -2113,7 +2105,7 @@ afr_attempt_lock_recovery (xlator_t *this, int32_t child_index)
afr_locked_fd_t *locked_fd = NULL;
afr_locked_fd_t *tmp = NULL;
int ret = 0;
- struct list_head locks_list;
+ struct list_head locks_list = {0,};
priv = this->private;
@@ -2123,8 +2115,6 @@ afr_attempt_lock_recovery (xlator_t *this, int32_t child_index)
frame = create_frame (this, this->ctx->pool);
if (!frame) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
ret = -1;
goto out;
}
@@ -2132,16 +2122,12 @@ afr_attempt_lock_recovery (xlator_t *this, int32_t child_index)
local = GF_CALLOC (1, sizeof (*local),
gf_afr_mt_afr_local_t);
if (!local) {
- gf_log (this->name, GF_LOG_DEBUG,
- "Out of memory");
ret = -1;
goto out;
}
AFR_LOCAL_INIT (local, priv);
if (!local) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory");
ret = -1;
goto out;
}
diff --git a/xlators/cluster/afr/src/afr-transaction.c b/xlators/cluster/afr/src/afr-transaction.c
index d1265e7ebed..7652d3d1e35 100644
--- a/xlators/cluster/afr/src/afr-transaction.c
+++ b/xlators/cluster/afr/src/afr-transaction.c
@@ -78,8 +78,8 @@ static void
__mark_all_pending (int32_t *pending[], int child_count,
afr_transaction_type type)
{
- int i;
- int j;
+ int i = 0;
+ int j = 0;
for (i = 0; i < child_count; i++) {
j = afr_index_for_transaction_type (type);
@@ -92,7 +92,7 @@ static void
__mark_child_dead (int32_t *pending[], int child_count, int child,
afr_transaction_type type)
{
- int j;
+ int j = 0;
j = afr_index_for_transaction_type (type);
@@ -158,8 +158,8 @@ static void
__mark_down_children (int32_t *pending[], int child_count,
unsigned char *child_up, afr_transaction_type type)
{
- int i;
- int j;
+ int i = 0;
+ int j = 0;
for (i = 0; i < child_count; i++) {
j = afr_index_for_transaction_type (type);
@@ -251,7 +251,6 @@ __changelog_needed_post_op (call_frame_t *frame, xlator_t *this)
{
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
-
int op_ret = 0;
afr_transaction_type type = -1;
@@ -283,7 +282,7 @@ __changelog_needed_post_op (call_frame_t *frame, xlator_t *this)
static int
afr_set_pending_dict (afr_private_t *priv, dict_t *xattr, int32_t **pending)
{
- int i;
+ int i = 0;
int ret = 0;
for (i = 0; i < priv->child_count; i++) {
@@ -304,7 +303,7 @@ static int
afr_set_piggyback_dict (afr_private_t *priv, dict_t *xattr, int32_t **pending,
afr_transaction_type type)
{
- int i;
+ int i = 0;
int ret = 0;
int *arr = NULL;
int index = 0;
@@ -370,8 +369,7 @@ afr_changelog_post_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_private_t *priv = NULL;
afr_local_t *local = NULL;
int child_index = 0;
-
- int call_count = -1;
+ int call_count = -1;
priv = this->private;
local = frame->local;
@@ -530,7 +528,7 @@ afr_changelog_post_op (call_frame_t *frame, xlator_t *this)
local->pending);
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"failed to set pending entry");
@@ -626,7 +624,7 @@ afr_changelog_post_op (call_frame_t *frame, xlator_t *this)
local->pending);
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"failed to set pending entry");
/* fall through */
@@ -674,7 +672,6 @@ afr_changelog_pre_op_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
afr_local_t * local = NULL;
afr_private_t * priv = this->private;
loc_t * loc = NULL;
-
int call_count = -1;
int child_index = (long) cookie;
@@ -740,7 +737,6 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
int call_count = 0;
dict_t **xattr = NULL;
afr_fd_ctx_t *fdctx = NULL;
-
afr_local_t *local = NULL;
int piggyback = 0;
@@ -788,7 +784,7 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
local->pending);
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"failed to set pending entry");
@@ -890,7 +886,7 @@ afr_changelog_pre_op (call_frame_t *frame, xlator_t *this)
local->pending);
if (ret < 0)
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"failed to set pending entry");
/* fall through */
@@ -945,7 +941,7 @@ afr_post_blocking_inodelk_cbk (call_frame_t *frame, xlator_t *this)
int_lock = &local->internal_lock;
if (int_lock->lock_op_ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Blocking inodelks failed.");
local->transaction.done (frame, this);
} else {
@@ -995,7 +991,7 @@ afr_post_blocking_entrylk_cbk (call_frame_t *frame, xlator_t *this)
int_lock = &local->internal_lock;
if (int_lock->lock_op_ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Blocking entrylks failed.");
local->transaction.done (frame, this);
} else {
@@ -1045,7 +1041,7 @@ afr_post_blocking_rename_cbk (call_frame_t *frame, xlator_t *this)
int_lock = &local->internal_lock;
if (int_lock->lock_op_ret < 0) {
- gf_log (this->name, GF_LOG_DEBUG,
+ gf_log (this->name, GF_LOG_INFO,
"Blocking entrylks failed.");
local->transaction.done (frame, this);
} else {
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index 98d857d6bc0..79753c91b09 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -152,8 +152,7 @@ reconfigure (xlator_t *this, dict_t *options)
self_heal);
}
- dict_ret = dict_get_str (options, "data-self-heal",
- &self_heal);
+ dict_ret = dict_get_str (options, "data-self-heal", &self_heal);
if (dict_ret == 0) {
temp_ret = gf_string2boolean (self_heal, &data_self_heal);
if (temp_ret < 0) {
@@ -224,8 +223,7 @@ reconfigure (xlator_t *this, dict_t *options)
}
- dict_ret = dict_get_str (options, "data-change-log",
- &change_log);
+ dict_ret = dict_get_str (options, "data-change-log", &change_log);
if (dict_ret == 0) {
temp_ret = gf_string2boolean (change_log, &data_change_log);
if (temp_ret < 0) {
@@ -328,12 +326,10 @@ reconfigure (xlator_t *this, dict_t *options)
break;
}
-
trav = trav->next;
}
if (flag == 0 ) {
-
gf_log (this->name, GF_LOG_ERROR,
"Invalid 'option read-subvolume %s', no such subvolume"
, read_subvol);
@@ -341,7 +337,6 @@ reconfigure (xlator_t *this, dict_t *options)
goto out;
}
-
next:
out:
return ret;
@@ -374,7 +369,6 @@ init (xlator_t *this)
int i = 0;
int ret = -1;
int op_errno = 0;
-
char * read_subvol = NULL;
char * fav_child = NULL;
char * self_heal = NULL;
@@ -383,11 +377,9 @@ init (xlator_t *this)
char * strict_readdir = NULL;
char * inodelk_trace = NULL;
char * entrylk_trace = NULL;
-
int32_t background_count = 0;
int32_t lock_server_count = 1;
int32_t window_size = 0;
-
int fav_ret = -1;
int read_ret = -1;
int dict_ret = -1;
@@ -405,7 +397,6 @@ init (xlator_t *this)
"Volume is dangling.");
}
-
ALLOC_OR_GOTO (this->private, afr_private_t, out);
priv = this->private;
@@ -670,8 +661,6 @@ init (xlator_t *this)
priv->child_up = GF_CALLOC (sizeof (unsigned char), child_count,
gf_afr_mt_char);
if (!priv->child_up) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
ret = -ENOMEM;
goto out;
}
@@ -686,8 +675,6 @@ init (xlator_t *this)
priv->children = GF_CALLOC (sizeof (xlator_t *), child_count,
gf_afr_mt_xlator_t);
if (!priv->children) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
ret = -ENOMEM;
goto out;
}
@@ -696,8 +683,6 @@ init (xlator_t *this)
child_count,
gf_afr_mt_char);
if (!priv->pending_key) {
- gf_log (this->name, GF_LOG_ERROR,
- "Out of memory.");
ret = -ENOMEM;
goto out;
}