summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2012-05-10 15:48:22 +0530
committerAnand Avati <avati@redhat.com>2012-05-10 15:26:54 -0700
commit72da7808cb0497b4ac6df55c58c9bf34daeee7ac (patch)
tree9640d7373b18428af45ff133e7a418eed5403d1d /xlators/features/locks
parent4789058d916de596720213154cd1e2f73695aa13 (diff)
locks: Set flock.l_type on successful F_UNLCK to signal last unlock on fd.
NLM expects a successful F_UNLCK on an fd to set flock.l_type to F_UNLCK if it were the last unlock else F_RDLCK. Change-Id: Ib304ac6102664abbb13d1fda649b3da63f1ee97e BUG: 800300 Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Reviewed-on: http://review.gluster.com/3306 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishna Srinivas <krishna@gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features/locks')
-rw-r--r--xlators/features/locks/src/posix.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 0bf022a943e..32d37f6abea 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1244,6 +1244,13 @@ pl_lk (call_frame_t *frame, xlator_t *this,
op_ret = -1;
op_errno = EAGAIN;
__destroy_lock (reqlock);
+
+ } else if ((0 == ret) && (F_UNLCK == flock->l_type)) {
+ /* For NLM's last "unlock on fd" detection */
+ if (pl_locks_by_fd (pl_inode, fd))
+ flock->l_type = F_RDLCK;
+ else
+ flock->l_type = F_UNLCK;
}
}
@@ -1251,10 +1258,6 @@ unwind:
pl_trace_out (this, frame, fd, NULL, cmd, flock, op_ret, op_errno, NULL);
pl_update_refkeeper (this, fd->inode);
- if (pl_locks_by_fd(pl_inode, fd))
- flock->l_type = F_RDLCK;
- else
- flock->l_type = F_UNLCK;
STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, flock, xdata);
out: