summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-inode-write.c
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-12-27 18:56:16 +0200
committerAmar Tumballi <amarts@redhat.com>2019-01-29 09:27:22 +0000
commitc7d1aee76d5713d1f337ab1c831c0ed74e4676e1 (patch)
treedac0618f33a560ae1bfbd5c92c5762d42d26797b /xlators/cluster/dht/src/dht-inode-write.c
parentf747d55a7fd364e2b9a74fe40360ab3cb7b11537 (diff)
Multiple files: reduce work while under lock.
Mostly, unlock before logging. In some cases, moved different code that was not needed to be under lock (for example, taking time, or malloc'ing) to be executed before taking the lock. Note: logging might be slightly less accurate in order, since it may not be done now under the lock, so order of logs is racy. I think it's a reasonable compromise. Compile-tested only! updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com> Change-Id: I2438710016afc9f4f62a176ef1a0d3ed793b4f89
Diffstat (limited to 'xlators/cluster/dht/src/dht-inode-write.c')
-rw-r--r--xlators/cluster/dht/src/dht-inode-write.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c
index d0d12fd7658..b26b7058d3e 100644
--- a/xlators/cluster/dht/src/dht-inode-write.c
+++ b/xlators/cluster/dht/src/dht-inode-write.c
@@ -1113,9 +1113,10 @@ dht_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
{
if (op_ret == -1) {
local->op_errno = op_errno;
+ UNLOCK(&frame->lock);
gf_msg_debug(this->name, op_errno, "subvolume %s returned -1",
prev->name);
- goto unlock;
+ goto post_unlock;
}
dht_iatt_merge(this, &local->prebuf, statpre);
@@ -1124,9 +1125,8 @@ dht_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this, int op_ret,
local->op_ret = 0;
local->op_errno = 0;
}
-unlock:
UNLOCK(&frame->lock);
-
+post_unlock:
this_call_cnt = dht_frame_return(frame);
if (is_last_call(this_call_cnt)) {
if (local->op_ret == 0)
@@ -1151,24 +1151,22 @@ dht_non_mds_setattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
local = frame->local;
prev = cookie;
+ if (op_ret == -1) {
+ gf_msg(this->name, op_errno, 0, 0, "subvolume %s returned -1",
+ prev->name);
+ goto post_unlock;
+ }
+
LOCK(&frame->lock);
{
- if (op_ret == -1) {
- gf_msg(this->name, op_errno, 0, 0, "subvolume %s returned -1",
- prev->name);
-
- goto unlock;
- }
-
dht_iatt_merge(this, &local->prebuf, statpre);
dht_iatt_merge(this, &local->stbuf, statpost);
local->op_ret = 0;
local->op_errno = 0;
}
-unlock:
UNLOCK(&frame->lock);
-
+post_unlock:
this_call_cnt = dht_frame_return(frame);
if (is_last_call(this_call_cnt)) {
dht_inode_ctx_time_set(local->loc.inode, this, &local->stbuf);