summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/entrylk.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/locks/src/entrylk.c')
-rw-r--r--xlators/features/locks/src/entrylk.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c
index ced5eca2749..9d6a4c93057 100644
--- a/xlators/features/locks/src/entrylk.c
+++ b/xlators/features/locks/src/entrylk.c
@@ -39,13 +39,20 @@ __pl_entrylk_ref(pl_entry_lock_t *lock)
static pl_entry_lock_t *
new_entrylk_lock(pl_inode_t *pinode, const char *basename, entrylk_type type,
- const char *domain, call_frame_t *frame, char *conn_id)
+ const char *domain, call_frame_t *frame, char *conn_id,
+ int32_t *op_errno)
{
pl_entry_lock_t *newlock = NULL;
+ if (!pl_is_lk_owner_valid(&frame->root->lk_owner, frame->root->client)) {
+ *op_errno = EINVAL;
+ goto out;
+ }
+
newlock = GF_CALLOC(1, sizeof(pl_entry_lock_t),
gf_locks_mt_pl_entry_lock_t);
if (!newlock) {
+ *op_errno = ENOMEM;
goto out;
}
@@ -793,10 +800,9 @@ pl_common_entrylk(call_frame_t *frame, xlator_t *this, const char *volume,
entrylk_trace_in(this, frame, volume, fd, loc, basename, cmd, type);
reqlock = new_entrylk_lock(pinode, basename, type, dom->domain, frame,
- conn_id);
+ conn_id, &op_errno);
if (!reqlock) {
op_ret = -1;
- op_errno = ENOMEM;
goto unwind;
}