summaryrefslogtreecommitdiffstats
path: root/xlators/features/locks/src
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/features/locks/src')
-rw-r--r--xlators/features/locks/src/common.h4
-rw-r--r--xlators/features/locks/src/locks.h8
-rw-r--r--xlators/features/locks/src/posix.c104
3 files changed, 14 insertions, 102 deletions
diff --git a/xlators/features/locks/src/common.h b/xlators/features/locks/src/common.h
index 0916c299e84..4006062606e 100644
--- a/xlators/features/locks/src/common.h
+++ b/xlators/features/locks/src/common.h
@@ -44,10 +44,6 @@
fd_unref(__local->fd); \
if (__local->inode) \
inode_unref(__local->inode); \
- if (__local->xdata) { \
- dict_unref(__local->xdata); \
- __local->xdata = NULL; \
- } \
mem_put(__local); \
} \
} while (0)
diff --git a/xlators/features/locks/src/locks.h b/xlators/features/locks/src/locks.h
index 3305350afb1..0ab2aa6cbae 100644
--- a/xlators/features/locks/src/locks.h
+++ b/xlators/features/locks/src/locks.h
@@ -240,7 +240,6 @@ typedef struct {
gf_boolean_t inodelk_count_req;
gf_boolean_t posixlk_count_req;
gf_boolean_t parent_entrylk_req;
- gf_boolean_t multiple_dom_lk_requests;
int update_mlock_enforced_flag;
} pl_local_t;
@@ -262,13 +261,6 @@ typedef struct _locks_ctx {
struct list_head metalk_list;
} pl_ctx_t;
-typedef struct _multi_dom_lk_data {
- xlator_t *this;
- inode_t *inode;
- dict_t *xdata_rsp;
- gf_boolean_t keep_max;
-} multi_dom_lk_data;
-
typedef enum { DECREMENT, INCREMENT } pl_count_op_t;
pl_ctx_t *
diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c
index e03a6063128..d2f5db5116b 100644
--- a/xlators/features/locks/src/posix.c
+++ b/xlators/features/locks/src/posix.c
@@ -151,20 +151,13 @@ fetch_pathinfo(xlator_t *, inode_t *, int32_t *, char **);
gf_boolean_t
pl_has_xdata_requests(dict_t *xdata)
{
- static char *reqs[] = {GLUSTERFS_ENTRYLK_COUNT,
- GLUSTERFS_INODELK_COUNT,
- GLUSTERFS_INODELK_DOM_COUNT,
- GLUSTERFS_POSIXLK_COUNT,
- GLUSTERFS_PARENT_ENTRYLK,
- GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS,
- NULL};
- static int reqs_size[] = {SLEN(GLUSTERFS_ENTRYLK_COUNT),
- SLEN(GLUSTERFS_INODELK_COUNT),
- SLEN(GLUSTERFS_INODELK_DOM_COUNT),
- SLEN(GLUSTERFS_POSIXLK_COUNT),
- SLEN(GLUSTERFS_PARENT_ENTRYLK),
- SLEN(GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS),
- 0};
+ static char *reqs[] = {GLUSTERFS_ENTRYLK_COUNT, GLUSTERFS_INODELK_COUNT,
+ GLUSTERFS_INODELK_DOM_COUNT, GLUSTERFS_POSIXLK_COUNT,
+ GLUSTERFS_PARENT_ENTRYLK, NULL};
+ static int reqs_size[] = {
+ SLEN(GLUSTERFS_ENTRYLK_COUNT), SLEN(GLUSTERFS_INODELK_COUNT),
+ SLEN(GLUSTERFS_INODELK_DOM_COUNT), SLEN(GLUSTERFS_POSIXLK_COUNT),
+ SLEN(GLUSTERFS_PARENT_ENTRYLK), 0};
int i = 0;
if (!xdata)
@@ -183,9 +176,6 @@ pl_get_xdata_requests(pl_local_t *local, dict_t *xdata)
if (!local || !xdata)
return;
- GF_ASSERT(local->xdata == NULL);
- local->xdata = dict_ref(xdata);
-
if (dict_get_sizen(xdata, GLUSTERFS_ENTRYLK_COUNT)) {
local->entrylk_count_req = 1;
dict_del_sizen(xdata, GLUSTERFS_ENTRYLK_COUNT);
@@ -194,10 +184,6 @@ pl_get_xdata_requests(pl_local_t *local, dict_t *xdata)
local->inodelk_count_req = 1;
dict_del_sizen(xdata, GLUSTERFS_INODELK_COUNT);
}
- if (dict_get_sizen(xdata, GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS)) {
- local->multiple_dom_lk_requests = 1;
- dict_del_sizen(xdata, GLUSTERFS_MULTIPLE_DOM_LK_CNT_REQUESTS);
- }
local->inodelk_dom_count_req = dict_get_sizen(xdata,
GLUSTERFS_INODELK_DOM_COUNT);
@@ -225,7 +211,7 @@ pl_needs_xdata_response(pl_local_t *local)
if (local->parent_entrylk_req || local->entrylk_count_req ||
local->inodelk_dom_count_req || local->inodelk_count_req ||
- local->posixlk_count_req || local->multiple_dom_lk_requests)
+ local->posixlk_count_req)
return _gf_true;
return _gf_false;
@@ -425,71 +411,6 @@ pl_posixlk_xattr_fill(xlator_t *this, inode_t *inode, dict_t *dict,
}
void
-pl_inodelk_xattr_fill_each(xlator_t *this, inode_t *inode, dict_t *dict,
- char *domname, gf_boolean_t keep_max, char *key)
-{
- int32_t count = 0;
- int32_t maxcount = -1;
- int ret = -1;
-
- if (keep_max) {
- ret = dict_get_int32(dict, key, &maxcount);
- if (ret < 0)
- gf_msg_debug(this->name, 0, " Failed to fetch the value for key %s",
- GLUSTERFS_INODELK_COUNT);
- }
- count = get_inodelk_count(this, inode, domname);
- if (maxcount >= count)
- return;
-
- ret = dict_set_int32(dict, key, count);
- if (ret < 0) {
- gf_msg_debug(this->name, 0,
- "Failed to set count for "
- "key %s",
- key);
- }
-
- return;
-}
-
-static int
-pl_inodelk_xattr_fill_multiple(dict_t *this, char *key, data_t *value,
- void *data)
-{
- multi_dom_lk_data *d = data;
- char *tmp_key = NULL;
- char *save_ptr = NULL;
-
- tmp_key = gf_strdup(key);
- strtok_r(tmp_key, ":", &save_ptr);
- GF_ASSERT(*save_ptr); // Should contain the domain string.
-
- pl_inodelk_xattr_fill_each(d->this, d->inode, d->xdata_rsp, save_ptr,
- d->keep_max, key);
- if (tmp_key)
- GF_FREE(tmp_key);
-
- return 0;
-}
-
-void
-pl_fill_multiple_dom_lk_requests(xlator_t *this, pl_local_t *local,
- inode_t *inode, dict_t *dict,
- gf_boolean_t keep_max)
-{
- multi_dom_lk_data data;
-
- data.this = this;
- data.inode = inode;
- data.xdata_rsp = dict;
- data.keep_max = keep_max;
-
- dict_foreach_fnmatch(local->xdata, GLUSTERFS_INODELK_DOM_PREFIX "*",
- pl_inodelk_xattr_fill_multiple, &data);
-}
-
-void
pl_set_xdata_response(xlator_t *this, pl_local_t *local, inode_t *parent,
inode_t *inode, char *name, dict_t *xdata,
gf_boolean_t max_lock)
@@ -516,9 +437,6 @@ pl_set_xdata_response(xlator_t *this, pl_local_t *local, inode_t *parent,
if (local->posixlk_count_req)
pl_posixlk_xattr_fill(this, inode, xdata, max_lock);
-
- if (local->multiple_dom_lk_requests)
- pl_fill_multiple_dom_lk_requests(this, local, inode, xdata, max_lock);
}
/* Checks whether the region where fop is acting upon conflicts
@@ -857,6 +775,9 @@ pl_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
{
pl_local_t *local = frame->local;
+ if (local->xdata)
+ dict_unref(local->xdata);
+
pl_track_io_fop_count(local, this, DECREMENT);
if (local->op == GF_FOP_TRUNCATE)
@@ -1014,6 +935,9 @@ unwind:
"ret: %d, error: %s",
op_ret, strerror(op_errno));
+ if (local->xdata)
+ dict_unref(local->xdata);
+
switch (local->op) {
case GF_FOP_TRUNCATE:
PL_STACK_UNWIND(truncate, xdata, frame, op_ret, op_errno, buf,