summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src/posix.c
diff options
context:
space:
mode:
authorKrutika Dhananjay <kdhananj@redhat.com>2017-01-23 17:40:40 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2017-02-27 03:26:42 -0500
commitb5c26a462caf97bfc5380c81092f5c331ccaf1ae (patch)
tree8828f7bd3d08b6d5294ce915a5592c15bf630c88 /xlators/storage/posix/src/posix.c
parent8aee74f25cfa9dc676e116e9882723254b0509a9 (diff)
storage/posix: Execute syscalls in xattrop under different locks
... and not inode->lock. This is to prevent the epoll thread from *potentially* being blocked on this lock in the worst case for extended period elsewhere in the brick stack, while the syscalls in xattrop are being performed under the same lock by a different thread. This could potentially lead to ping-timeout, if the only available epoll thread is busy waiting on the inode->lock, thereby preventing it from picking up the ping request from the client(s). Also removed some unused functions. Change-Id: I2054a06701ecab11aed1c04e80ee57bbe2e52564 BUG: 1421938 Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com> Reviewed-on: https://review.gluster.org/16462 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/storage/posix/src/posix.c')
-rw-r--r--xlators/storage/posix/src/posix.c36
1 files changed, 23 insertions, 13 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index aa7e7404099..123fa9eb4df 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -108,19 +108,21 @@ out:
int
posix_forget (xlator_t *this, inode_t *inode)
{
- uint64_t tmp_cache = 0;
- int ret = 0;
- char *unlink_path = NULL;
- struct posix_private *priv_posix = NULL;
+ int ret = 0;
+ char *unlink_path = NULL;
+ uint64_t ctx_uint = 0;
+ posix_inode_ctx_t *ctx = NULL;
+ struct posix_private *priv_posix = NULL;
priv_posix = (struct posix_private *) this->private;
- ret = inode_ctx_del (inode, this, &tmp_cache);
- if (ret < 0) {
- ret = 0;
- goto out;
- }
- if (tmp_cache == GF_UNLINK_TRUE) {
+ ret = inode_ctx_del (inode, this, &ctx_uint);
+ if (!ctx_uint)
+ return 0;
+
+ ctx = (posix_inode_ctx_t *)ctx_uint;
+
+ if (ctx->unlink_flag == GF_UNLINK_TRUE) {
POSIX_GET_FILE_UNLINK_PATH(priv_posix->base_path,
inode->gfid, unlink_path);
if (!unlink_path) {
@@ -134,6 +136,8 @@ posix_forget (xlator_t *this, inode_t *inode)
ret = sys_unlink(unlink_path);
}
out:
+ pthread_mutex_destroy (&ctx->xattrop_lock);
+ GF_FREE (ctx);
return ret;
}
@@ -1714,7 +1718,7 @@ posix_add_unlink_to_ctx (inode_t *inode, xlator_t *this, char *unlink_path)
}
ctx = GF_UNLINK_TRUE;
- ret = posix_inode_ctx_set (inode, this, ctx);
+ ret = posix_inode_ctx_set_unlink_flag (inode, this, ctx);
if (ret < 0) {
goto out;
}
@@ -5442,6 +5446,7 @@ _posix_handle_xattr_keyvalue_pair (dict_t *d, char *k, data_t *v,
inode_t *inode = NULL;
xlator_t *this = NULL;
posix_xattr_filler_t *filler = NULL;
+ posix_inode_ctx_t *ctx = NULL;
filler = tmp;
@@ -5464,8 +5469,13 @@ _posix_handle_xattr_keyvalue_pair (dict_t *d, char *k, data_t *v,
}
}
#endif
+ op_ret = posix_inode_ctx_get_all (inode, this, &ctx);
+ if (op_ret < 0) {
+ op_errno = ENOMEM;
+ goto out;
+ }
- LOCK (&inode->lock);
+ pthread_mutex_lock (&ctx->xattrop_lock);
{
if (filler->real_path) {
size = sys_lgetxattr (filler->real_path, k,
@@ -5574,7 +5584,7 @@ _posix_handle_xattr_keyvalue_pair (dict_t *d, char *k, data_t *v,
op_errno = errno;
}
unlock:
- UNLOCK (&inode->lock);
+ pthread_mutex_unlock (&ctx->xattrop_lock);
if (op_ret == -1)
goto out;