summaryrefslogtreecommitdiffstats
path: root/xlators/features/leases/src/leases.h
diff options
context:
space:
mode:
authorPoornima G <pgurusid@redhat.com>2016-05-19 05:04:13 -0400
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-06-01 00:33:08 -0700
commitb06a77f3446d622f8159f08508f4d5063ec50339 (patch)
treeafbb15743ba9ebb3e2381cfeb71ab5321fea2215 /xlators/features/leases/src/leases.h
parente341d2827800e32997f888668597785178a40626 (diff)
leases: Fix the recall code path
1. Replace frame->op usage with frame->root->op, as frame->op is not filled with appropriate value in all cases 2. Add few log messages 3. Fix boolean assignment Change-Id: I340f2200c1fcc4f4ce5a139b0fd22508cb8ac1e3 BUG: 1319992 Signed-off-by: Poornima G <pgurusid@redhat.com> Reviewed-on: http://review.gluster.org/14434 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra Talur <rtalur@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features/leases/src/leases.h')
-rw-r--r--xlators/features/leases/src/leases.h16
1 files changed, 11 insertions, 5 deletions
diff --git a/xlators/features/leases/src/leases.h b/xlators/features/leases/src/leases.h
index 77818b2053f..df5e8beb85c 100644
--- a/xlators/features/leases/src/leases.h
+++ b/xlators/features/leases/src/leases.h
@@ -57,7 +57,7 @@
#define GET_FLAGS(fop, fd_flags) \
do { \
- if (fd_flags & (O_WRONLY | O_RDWR) && fop == GF_FOP_OPEN) \
+ if ((fd_flags & (O_WRONLY | O_RDWR)) && fop == GF_FOP_OPEN) \
fop_flags = DATA_MODIFY_FOP; \
\
if (fop == GF_FOP_UNLINK || fop == GF_FOP_RENAME || \
@@ -69,7 +69,7 @@ do { \
fop == GF_FOP_LINK) \
fop_flags = DATA_MODIFY_FOP; \
\
- if (fd_flags & (O_NONBLOCK | O_NDELAY)) \
+ if (!(fd_flags & (O_NONBLOCK | O_NDELAY))) \
fop_flags |= BLOCKING_FOP; \
\
} while (0) \
@@ -99,13 +99,19 @@ do { \
__stub = fop_##fop_name##_stub (frame, default_##fop_name##_resume, \
params); \
if (!__stub) { \
+ gf_msg (this->name, GF_LOG_WARNING, ENOMEM, \
+ LEASE_MSG_NO_MEM, \
+ "Unable to create stub"); \
ret = -ENOMEM; \
goto __out; \
} \
\
blk_fop = GF_CALLOC (1, sizeof (*blk_fop), \
gf_leases_mt_fop_stub_t); \
- if (blk_fop) { \
+ if (!blk_fop) { \
+ gf_msg (this->name, GF_LOG_WARNING, ENOMEM, \
+ LEASE_MSG_NO_MEM, \
+ "Unable to create lease fop stub"); \
ret = -ENOMEM; \
goto __out; \
} \
@@ -119,6 +125,7 @@ do { \
goto __out; \
} \
\
+ blk_fop->stub = __stub; \
pthread_mutex_lock (&lease_ctx->lock); \
{ \
/*TODO: If the lease is unlocked btw check lease conflict and \
@@ -132,8 +139,7 @@ __out: \
if (ret < 0) { \
gf_msg (this->name, GF_LOG_WARNING, ENOMEM, LEASE_MSG_NO_MEM, \
"Unable to create stub for blocking the fop:%s (%s)", \
- gf_fop_list[frame->op], strerror(ENOMEM)); \
- default_##fop_name##_failure_cbk (frame, -__ret); \
+ gf_fop_list[frame->root->op], strerror(ENOMEM)); \
if (__stub != NULL) { \
call_stub_destroy (__stub); \
} \