summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/lkowner.h
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-07-07 16:03:26 +0530
committerRaghavendra G <rgowdapp@redhat.com>2015-07-09 21:08:54 -0700
commit7488acff20ef6ff8df76af07547695e0106f32ca (patch)
tree65e9be1cb74f77a359eed2148387d5310b8991dc /libglusterfs/src/lkowner.h
parent01b82c66155a8d92893a386d7a314c95e0f0702b (diff)
quota/marker: set lk_owner when taking lock on parent in rename
Before doing a rename operation marker takes inode lock on the file parent, here lk_owner is NULL and this can cause accounting problem with multiple rename on the same directory This patch fix the problem by setting lk_owner Change-Id: Ibb789e39b2833e425d0a5fca85282ff1465206cb BUG: 1240598 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/11561 Tested-by: Gluster Build System <jenkins@build.gluster.com> Tested-by: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'libglusterfs/src/lkowner.h')
-rw-r--r--libglusterfs/src/lkowner.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/libglusterfs/src/lkowner.h b/libglusterfs/src/lkowner.h
index 78f54a628d1..c3e16760869 100644
--- a/libglusterfs/src/lkowner.h
+++ b/libglusterfs/src/lkowner.h
@@ -75,4 +75,23 @@ is_same_lkowner (gf_lkowner_t *l1, gf_lkowner_t *l2)
return ((l1->len == l2->len) && !memcmp(l1->data, l2->data, l1->len));
}
+static inline int
+is_lk_owner_null (gf_lkowner_t *lkowner)
+{
+ int is_null = 1;
+ int i = 0;
+
+ if (lkowner == NULL || lkowner->len == 0)
+ goto out;
+
+ for (i = 0; i < lkowner->len; i++) {
+ if (lkowner->data[i] != 0) {
+ is_null = 0;
+ break;
+ }
+ }
+out:
+ return is_null;
+}
+
#endif /* _LK_OWNER_H */