summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/posix.c
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2019-04-01 11:14:56 +0530
committerAmar Tumballi <amarts@redhat.com>2019-04-26 06:51:24 +0000
commita9143223c515b82f6382f1372dfbdc0439dba198 (patch)
treed04a656ed522d6ad0e2ddcd4b2ed15beb30cf449 /xlators/features/locks/src/posix.c
parentedeb0d6e616cf4750ea9f6b6245631de8db233cf (diff)
features/locks: error-out {inode,entry}lk fops with all-zero lk-owner
Problem: Sometimes we find that developers forget to assign lk-owner for an inodelk/entrylk/lk before writing code to wind these fops. locks xlator at the moment allows this operation. This leads to multiple threads in the same client being able to get locks on the inode because lk-owner is same and transport is same. So isolation with locks can't be achieved. Fix: Disallow locks with lk-owner zero. fixes bz#1624701 Change-Id: I1aadcfbaaa4d49308f7c819505857e201809b3bc Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Diffstat (limited to 'xlators/features/locks/src/posix.c')
-rw-r--r--xlators/features/locks/src/posix.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 9d7210f1bb5..d2fc82feacb 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -2302,9 +2302,10 @@ __fd_has_locks(pl_inode_t *pl_inode, fd_t *fd)
static posix_lock_t *
lock_dup(posix_lock_t *lock)
{
+ int32_t op_errno = 0;
return new_posix_lock(&lock->user_flock, lock->client, lock->client_pid,
&lock->owner, (fd_t *)lock->fd_num, lock->lk_flags,
- lock->blocking);
+ lock->blocking, &op_errno);
}
static int
@@ -2521,11 +2522,11 @@ pl_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd,
}
reqlock = new_posix_lock(flock, frame->root->client, frame->root->pid,
- &frame->root->lk_owner, fd, lk_flags, can_block);
+ &frame->root->lk_owner, fd, lk_flags, can_block,
+ &op_errno);
if (!reqlock) {
op_ret = -1;
- op_errno = ENOMEM;
goto unwind;
}