summaryrefslogtreecommitdiffstats
path: root/xlators/features
diff options
context:
space:
mode:
authorJeff Darcy <jdarcy@redhat.com>2014-02-11 14:02:43 +0000
committerJeff Darcy <jdarcy@redhat.com>2014-02-11 14:02:43 +0000
commit0d92798e88c5444fb2cc23663b4ea9a345887756 (patch)
treea71f336115753242e8690547f403405a3373ddf1 /xlators/features
parent33939dcde38389373e7ed8b12c6e9916b39411d0 (diff)
parent408d50a64b7b3a9d6a4899060baa423ff126cc5f (diff)
Merge remote-tracking branch 'upstream/master'
Conflicts: xlators/mgmt/glusterd/src/Makefile.am Change-Id: Ida5ec4aecc358cb2268bdfdb1a8c9bab750f9575
Diffstat (limited to 'xlators/features')
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog-helpers.h2
-rw-r--r--xlators/features/changelog/lib/src/gf-changelog.c3
-rw-r--r--xlators/features/changelog/src/changelog-helpers.h2
-rw-r--r--xlators/features/changelog/src/changelog-notifier.c2
-rw-r--r--xlators/features/index/src/index.c58
-rw-r--r--xlators/features/marker/src/marker.c25
-rw-r--r--xlators/features/qemu-block/src/bdrv-xlator.c1
-rw-r--r--xlators/features/quota/src/quota.c17
8 files changed, 76 insertions, 34 deletions
diff --git a/xlators/features/changelog/lib/src/gf-changelog-helpers.h b/xlators/features/changelog/lib/src/gf-changelog-helpers.h
index f35220c..e4cf506 100644
--- a/xlators/features/changelog/lib/src/gf-changelog-helpers.h
+++ b/xlators/features/changelog/lib/src/gf-changelog-helpers.h
@@ -51,7 +51,7 @@ typedef struct gf_changelog {
/* connection retries */
int gfc_connretries;
- char gfc_sockpath[PATH_MAX];
+ char gfc_sockpath[UNIX_PATH_MAX];
char gfc_brickpath[PATH_MAX];
diff --git a/xlators/features/changelog/lib/src/gf-changelog.c b/xlators/features/changelog/lib/src/gf-changelog.c
index ca8e373..4b2b25a 100644
--- a/xlators/features/changelog/lib/src/gf-changelog.c
+++ b/xlators/features/changelog/lib/src/gf-changelog.c
@@ -173,7 +173,7 @@ gf_changelog_notification_init (xlator_t *this, gf_changelog_t *gfc)
}
CHANGELOG_MAKE_SOCKET_PATH (gfc->gfc_brickpath,
- gfc->gfc_sockpath, PATH_MAX);
+ gfc->gfc_sockpath, UNIX_PATH_MAX);
gf_log (this->name, GF_LOG_INFO,
"connecting to changelog socket: %s (brick: %s)",
gfc->gfc_sockpath, gfc->gfc_brickpath);
@@ -202,6 +202,7 @@ gf_changelog_notification_init (xlator_t *this, gf_changelog_t *gfc)
gf_log (this->name, GF_LOG_ERROR,
"could not connect to changelog socket!"
" bailing out...");
+ close (sockfd);
ret = -1;
} else
gf_log (this->name, GF_LOG_INFO,
diff --git a/xlators/features/changelog/src/changelog-helpers.h b/xlators/features/changelog/src/changelog-helpers.h
index 2412d81..4c3d540 100644
--- a/xlators/features/changelog/src/changelog-helpers.h
+++ b/xlators/features/changelog/src/changelog-helpers.h
@@ -246,7 +246,7 @@ typedef struct changelog_notify {
pthread_t notify_th;
/* unique socket path */
- char sockpath[PATH_MAX];
+ char sockpath[UNIX_PATH_MAX];
int socket_fd;
diff --git a/xlators/features/changelog/src/changelog-notifier.c b/xlators/features/changelog/src/changelog-notifier.c
index 1f8b312..5f3d063 100644
--- a/xlators/features/changelog/src/changelog-notifier.c
+++ b/xlators/features/changelog/src/changelog-notifier.c
@@ -178,7 +178,7 @@ changelog_notifier (void *data)
}
CHANGELOG_MAKE_SOCKET_PATH (priv->changelog_brick,
- cn->sockpath, PATH_MAX);
+ cn->sockpath, UNIX_PATH_MAX);
if (unlink (cn->sockpath) < 0) {
if (errno != ENOENT) {
gf_log (this->name, GF_LOG_ERROR,
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index db59271..5edfeda 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -371,6 +371,7 @@ sync_base_indices (void *index_priv)
char xattrop_directory[PATH_MAX] = {0};
char base_index_path[PATH_MAX] = {0};
char xattrop_index_path[PATH_MAX] = {0};
+ int32_t op_errno = 0;
int ret = 0;
priv = index_priv;
@@ -381,11 +382,14 @@ sync_base_indices (void *index_priv)
XATTROP_SUBDIR);
if ((dir_base_holder = opendir(base_indices_holder)) == NULL) {
+ op_errno = errno;
ret = -1;
goto out;
}
if ((xattrop_dir = opendir (xattrop_directory)) == NULL) {
+ op_errno = errno;
ret = -1;
+ (void) closedir (dir_base_holder);
goto out;
}
@@ -410,20 +414,30 @@ sync_base_indices (void *index_priv)
ret = sys_link (xattrop_index_path, base_index_path);
- if (ret && errno != EEXIST)
+ if (ret && errno != EEXIST) {
+ op_errno = errno;
+ (void) closedir (dir_base_holder);
+ (void) closedir (xattrop_dir);
goto out;
+ }
}
}
ret = closedir (xattrop_dir);
- if (ret)
+ if (ret) {
+ op_errno = errno;
+ (void) closedir (dir_base_holder);
goto out;
+ }
ret = closedir (dir_base_holder);
- if (ret)
+ if (ret) {
+ op_errno = errno;
goto out;
+ }
ret = 0;
out:
+ errno = op_errno;
return ret;
}
@@ -490,8 +504,10 @@ sync_base_indices_from_xattrop (xlator_t *this)
continue;
}
ret = unlink (entry->d_name);
- if (ret)
+ if (ret) {
+ closedir (dir);
goto out;
+ }
}
closedir (dir);
}
@@ -655,22 +671,16 @@ _check_key_is_zero_filled (dict_t *d, char *k, data_t *v,
return 0;
}
-
void
-_xattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr)
+_index_action (xlator_t *this, inode_t *inode, gf_boolean_t zero_xattr)
{
- gf_boolean_t zero_xattr = _gf_true;
+ int ret = 0;
index_inode_ctx_t *ctx = NULL;
- int ret = 0;
-
- ret = dict_foreach (xattr, _check_key_is_zero_filled, NULL);
- if (ret == -1)
- zero_xattr = _gf_false;
ret = index_inode_ctx_get (inode, this, &ctx);
if (ret) {
gf_log (this->name, GF_LOG_ERROR, "Not able to %s %s -> index",
- zero_xattr?"add":"del", uuid_utoa (inode->gfid));
+ zero_xattr?"del":"add", uuid_utoa (inode->gfid));
goto out;
}
if (zero_xattr) {
@@ -691,6 +701,19 @@ out:
}
void
+_xattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr)
+{
+ gf_boolean_t zero_xattr = _gf_true;
+ int ret = 0;
+
+ ret = dict_foreach (xattr, _check_key_is_zero_filled, NULL);
+ if (ret == -1)
+ zero_xattr = _gf_false;
+ _index_action (this, inode, zero_xattr);
+ return;
+}
+
+void
fop_xattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr)
{
_xattrop_index_action (this, inode, xattr);
@@ -868,6 +891,11 @@ int
index_xattrop_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc,
gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata)
{
+ //In wind phase bring the gfid into index. This way if the brick crashes
+ //just after posix performs xattrop before _cbk reaches index xlator
+ //we will still have the gfid in index.
+ _index_action (this, frame->local, _gf_false);
+
STACK_WIND (frame, index_xattrop_cbk, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->xattrop, loc, optype, xattr,
xdata);
@@ -878,6 +906,10 @@ int
index_fxattrop_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd,
gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata)
{
+ //In wind phase bring the gfid into index. This way if the brick crashes
+ //just after posix performs xattrop before _cbk reaches index xlator
+ //we will still have the gfid in index.
+ _index_action (this, frame->local, _gf_false);
STACK_WIND (frame, index_fxattrop_cbk, FIRST_CHILD (this),
FIRST_CHILD (this)->fops->fxattrop, fd, optype, xattr,
xdata);
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index d6b6dd3..4505865 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -1021,7 +1021,7 @@ marker_rename_done (call_frame_t *frame, void *cookie, xlator_t *this,
if (op_ret < 0) {
if (local->err == 0) {
- local->err = op_errno;
+ local->err = op_errno ? op_errno : EINVAL;
}
gf_log (this->name, GF_LOG_WARNING,
@@ -1037,6 +1037,11 @@ marker_rename_done (call_frame_t *frame, void *cookie, xlator_t *this,
} else if (local->err != 0) {
STACK_UNWIND_STRICT (rename, frame, -1, local->err, NULL, NULL,
NULL, NULL, NULL, NULL);
+ } else {
+ gf_log (this->name, GF_LOG_CRITICAL,
+ "continuation stub to unwind the call is absent, hence "
+ "call will be hung (call-stack id = %"PRIu64")",
+ frame->root->unique);
}
mq_reduce_parent_size (this, &oplocal->loc, oplocal->contribution);
@@ -1082,7 +1087,7 @@ marker_rename_release_newp_lock (call_frame_t *frame, void *cookie,
if (op_ret < 0) {
if (local->err == 0) {
- local->err = op_errno;
+ local->err = op_errno ? op_errno : EINVAL;
}
gf_log (this->name, GF_LOG_WARNING,
@@ -1271,7 +1276,7 @@ marker_do_rename (call_frame_t *frame, void *cookie, xlator_t *this,
MARKER_RESET_UID_GID (frame, frame->root, local);
if ((op_ret < 0) && (op_errno != ENOATTR)) {
- local->err = op_errno;
+ local->err = op_errno ? op_errno : EINVAL;
gf_log (this->name, GF_LOG_WARNING,
"fetching contribution values from %s (gfid:%s) "
"failed (%s)", local->loc.path,
@@ -1283,7 +1288,7 @@ marker_do_rename (call_frame_t *frame, void *cookie, xlator_t *this,
if (local->loc.inode != NULL) {
GET_CONTRI_KEY (contri_key, local->loc.parent->gfid, ret);
if (ret < 0) {
- local->err = errno;
+ local->err = errno ? errno : ENOMEM;
goto err;
}
@@ -1323,7 +1328,7 @@ marker_get_newpath_contribution (call_frame_t *frame, void *cookie,
MARKER_RESET_UID_GID (frame, frame->root, local);
if ((op_ret < 0) && (op_errno != ENOATTR)) {
- local->err = op_errno;
+ local->err = op_errno ? op_errno : EINVAL;
gf_log (this->name, GF_LOG_WARNING,
"fetching contribution values from %s (gfid:%s) "
"failed (%s)", oplocal->loc.path,
@@ -1334,7 +1339,7 @@ marker_get_newpath_contribution (call_frame_t *frame, void *cookie,
GET_CONTRI_KEY (contri_key, oplocal->loc.parent->gfid, ret);
if (ret < 0) {
- local->err = errno;
+ local->err = errno ? errno : ENOMEM;
goto err;
}
@@ -1344,7 +1349,7 @@ marker_get_newpath_contribution (call_frame_t *frame, void *cookie,
if (local->loc.inode != NULL) {
GET_CONTRI_KEY (contri_key, local->loc.parent->gfid, ret);
if (ret < 0) {
- local->err = errno;
+ local->err = errno ? errno : ENOMEM;
goto err;
}
@@ -1385,7 +1390,7 @@ marker_get_oldpath_contribution (call_frame_t *frame, void *cookie,
oplocal = local->oplocal;
if (op_ret < 0) {
- local->err = op_errno;
+ local->err = op_errno ? op_errno : EINVAL;
gf_log (this->name, GF_LOG_WARNING,
"cannot hold inodelk on %s (gfid:%s) (%s)",
local->next_lock_on->path,
@@ -1396,7 +1401,7 @@ marker_get_oldpath_contribution (call_frame_t *frame, void *cookie,
GET_CONTRI_KEY (contri_key, oplocal->loc.parent->gfid, ret);
if (ret < 0) {
- local->err = errno;
+ local->err = errno ? errno : ENOMEM;
goto quota_err;
}
@@ -1452,7 +1457,7 @@ marker_rename_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
loc = &local->parent_loc;
}
- local->err = op_errno;
+ local->err = op_errno ? op_errno : EINVAL;
gf_log (this->name, GF_LOG_WARNING,
"cannot hold inodelk on %s (gfid:%s) (%s)",
loc->path, uuid_utoa (loc->inode->gfid),
diff --git a/xlators/features/qemu-block/src/bdrv-xlator.c b/xlators/features/qemu-block/src/bdrv-xlator.c
index aaf028c..1e55b5f 100644
--- a/xlators/features/qemu-block/src/bdrv-xlator.c
+++ b/xlators/features/qemu-block/src/bdrv-xlator.c
@@ -235,7 +235,6 @@ qemu_gluster_co_writev (BlockDriverState *bs, int64_t sector_num, int nb_sectors
iobref = iobref_new ();
if (!iobref) {
- iobuf_unref (iobuf);
goto out;
}
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 2812a2b..bb5dc7a 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -721,7 +721,7 @@ quota_check_limit_continuation (struct list_head *parents, inode_t *inode,
this = THIS;
if ((op_ret < 0) || list_empty (parents)) {
- if (list_empty (parents)) {
+ if (op_ret >= 0) {
gf_log (this->name, GF_LOG_WARNING,
"Couldn't build ancestry for inode (gfid:%s). "
"Without knowing ancestors till root, quota "
@@ -3387,6 +3387,10 @@ quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
if (hard_lim > 0) {
local = quota_local_new ();
+ if (local == NULL) {
+ op_errno = ENOMEM;
+ goto err;
+ }
frame->local = local;
local->loc.inode = inode_ref (fd->inode);
@@ -3561,11 +3565,9 @@ quota_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
buf->f_blocks = blocks;
avail = buf->f_blocks - usage;
- avail = (avail >= 0) ? avail : 0;
+ avail = max (avail, 0);
- if (buf->f_bfree > avail) {
- buf->f_bfree = avail;
- }
+ buf->f_bfree = avail;
/*
* We have to assume that the total assigned quota
* won't cause us to dip into the reserved space,
@@ -4029,6 +4031,7 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
char *path = NULL;
int64_t cur_size = 0;
quota_priv_t *priv = NULL;
+ gf_boolean_t dyn_mem = _gf_true;
priv = this->private;
if ((ctx->soft_lim <= 0) || (timerisset (&ctx->prev_log) &&
@@ -4043,6 +4046,7 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
if (!usage_str) {
snprintf (size_str, sizeof (size_str), "%"PRId64, cur_size);
usage_str = (char*) size_str;
+ dyn_mem = _gf_false;
}
inode_path (inode, NULL, &path);
if (!path)
@@ -4063,7 +4067,8 @@ quota_log_usage (xlator_t *this, quota_inode_ctx_t *ctx, inode_t *inode,
ctx->prev_log = cur_time;
}
- GF_FREE (usage_str);
+ if (dyn_mem)
+ GF_FREE (usage_str);
}
int32_t