summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src/posix.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-04-17 13:20:43 +0530
committerAnand Avati <avati@redhat.com>2012-04-18 22:20:47 -0700
commitfb9f485db2b4a92c16c0683cf3d5cfcd07054d71 (patch)
tree063a83e8564bc417c27a14183586c56670a2ac09 /xlators/features/locks/src/posix.c
parentc0eec503b78949bd1785e5bf2533db211f3d256c (diff)
features/locks: Find parent-entrylk presence in lookup
Change-Id: I8fc85676827f26b07bf578ea1152d3e251adb4af BUG: 765551 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3177 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/features/locks/src/posix.c')
-rw-r--r--xlators/features/locks/src/posix.c34
1 files changed, 30 insertions, 4 deletions
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index 3e04c18f008..0bf022a943e 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -1508,6 +1508,24 @@ out:
}
void
+pl_parent_entrylk_xattr_fill (xlator_t *this, inode_t *parent,
+ char *basename, dict_t *dict)
+{
+ uint32_t entrylk = 0;
+ int ret = -1;
+
+ if (!parent || !basename || !strlen (basename))
+ goto out;
+ entrylk = check_entrylk_on_basename (this, parent, basename);
+out:
+ ret = dict_set_uint32 (dict, GLUSTERFS_PARENT_ENTRYLK, entrylk);
+ if (ret < 0) {
+ gf_log (this->name, GF_LOG_DEBUG,
+ " dict_set failed on key %s", GLUSTERFS_PARENT_ENTRYLK);
+ }
+}
+
+void
pl_entrylk_xattr_fill (xlator_t *this, inode_t *inode,
dict_t *dict)
{
@@ -1570,12 +1588,14 @@ pl_lookup_cbk (call_frame_t *frame,
GF_VALIDATE_OR_GOTO (this->name, frame->local, out);
- if (op_ret) {
+ if (op_ret)
goto out;
- }
local = frame->local;
+ if (local->parent_entrylk_req)
+ pl_parent_entrylk_xattr_fill (this, local->loc.parent,
+ (char*)local->loc.name, xdata);
if (local->entrylk_count_req)
pl_entrylk_xattr_fill (this, inode, xdata);
if (local->inodelk_count_req)
@@ -1584,12 +1604,15 @@ pl_lookup_cbk (call_frame_t *frame,
pl_posixlk_xattr_fill (this, inode, xdata);
+out:
+ local = frame->local;
frame->local = NULL;
- if (local != NULL)
+ if (local != NULL) {
+ loc_wipe (&local->loc);
mem_put (local);
+ }
-out:
STACK_UNWIND_STRICT (
lookup,
frame,
@@ -1625,9 +1648,12 @@ pl_lookup (call_frame_t *frame,
local->inodelk_count_req = 1;
if (dict_get (xdata, GLUSTERFS_POSIXLK_COUNT))
local->posixlk_count_req = 1;
+ if (dict_get (xdata, GLUSTERFS_PARENT_ENTRYLK))
+ local->parent_entrylk_req = 1;
}
frame->local = local;
+ loc_copy (&local->loc, loc);
STACK_WIND (frame,
pl_lookup_cbk,