diff options
author | Anoop C S <anoopcs@redhat.com> | 2016-05-03 17:02:17 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-05-20 04:23:19 -0700 |
commit | deaf8439fc42435988aae6a7b9ab681cc0d36b09 (patch) | |
tree | e76a9b92f9d188308677167e95f5d34a6f6ed71c | |
parent | 6a51464cf4704e7d7fcbce8919a5ef386a9cfd53 (diff) |
core: Honour mandatory lock flags during lock migration
lk_flags from posix_lock_t structure is the primary key used to
differentiate locks as either advisory and mandatory type. During
lock migration this field is not read in getactivelk() call path.
So in order to copy the exact lock state from source to destination
it is necessary to include lk_flags within lock_migration_info_t
structure to maintain accurate state. This change also includes
minor modifications to setactivelk() call to consider lk_flags
during lock migration.
Change-Id: I20a7b6b6a0f3bdac5734cce8a2cd2349eceff195
BUG: 1332501
Signed-off-by: Anoop C S <anoopcs@redhat.com>
Reviewed-on: http://review.gluster.org/14189
Smoke: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Susant Palai <spalai@redhat.com>
Reviewed-by: Poornima G <pgurusid@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
-rw-r--r-- | libglusterfs/src/default-args.c | 4 | ||||
-rw-r--r-- | libglusterfs/src/glusterfs.h | 1 | ||||
-rw-r--r-- | libglusterfs/src/syncop.c | 2 | ||||
-rw-r--r-- | rpc/xdr/src/glusterfs3-xdr.x | 1 | ||||
-rw-r--r-- | xlators/features/locks/src/posix.c | 4 | ||||
-rw-r--r-- | xlators/protocol/client/src/client-helpers.c | 4 | ||||
-rw-r--r-- | xlators/protocol/server/src/server-helpers.c | 4 |
7 files changed, 20 insertions, 0 deletions
diff --git a/libglusterfs/src/default-args.c b/libglusterfs/src/default-args.c index 9f788011ecb..2e51bf21f84 100644 --- a/libglusterfs/src/default-args.c +++ b/libglusterfs/src/default-args.c @@ -1454,6 +1454,8 @@ args_getactivelk_cbk_store (default_args_cbk_t *args, INIT_LIST_HEAD (&stub_entry->list); stub_entry->flock = entry->flock; + stub_entry->lk_flags = entry->lk_flags; + stub_entry->client_uid = gf_strdup (entry->client_uid); if (!stub_entry->client_uid) { GF_FREE (stub_entry); @@ -1490,6 +1492,8 @@ args_setactivelk_store (default_args_t *args, loc_t *loc, INIT_LIST_HEAD (&stub_entry->list); stub_entry->flock = entry->flock; + stub_entry->lk_flags = entry->lk_flags; + stub_entry->client_uid = gf_strdup (entry->client_uid); if (!stub_entry->client_uid) { GF_FREE (stub_entry); diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h index 28d894fb8e1..e8a7b237690 100644 --- a/libglusterfs/src/glusterfs.h +++ b/libglusterfs/src/glusterfs.h @@ -509,6 +509,7 @@ typedef struct lock_migration_info { struct list_head list; struct gf_flock flock; char *client_uid; + uint32_t lk_flags; } lock_migration_info_t; #define GF_MUST_CHECK __attribute__((warn_unused_result)) diff --git a/libglusterfs/src/syncop.c b/libglusterfs/src/syncop.c index e3d48577d2c..00a9b576269 100644 --- a/libglusterfs/src/syncop.c +++ b/libglusterfs/src/syncop.c @@ -3101,6 +3101,8 @@ syncop_getactivelk_cbk (call_frame_t *frame, entry->flock = tmp->flock; + entry->lk_flags = tmp->lk_flags; + entry->client_uid = gf_strdup (tmp->client_uid); list_add_tail (&entry->list, &args->locklist.list); diff --git a/rpc/xdr/src/glusterfs3-xdr.x b/rpc/xdr/src/glusterfs3-xdr.x index dcd10cb23b7..eefad57ce80 100644 --- a/rpc/xdr/src/glusterfs3-xdr.x +++ b/rpc/xdr/src/glusterfs3-xdr.x @@ -966,6 +966,7 @@ struct gfs3_compound_rsp { struct gfs3_locklist { struct gf_proto_flock flock; string client_uid<>; + unsigned int lk_flags; struct gfs3_locklist *nextentry; }; diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index ed07dd4b1a4..f53af6345df 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -2708,6 +2708,8 @@ gf_mig_info_for_lock (posix_lock_t *lock) posix_lock_to_flock (lock, &new->flock); + new->lk_flags = lock->lk_flags; + new->client_uid = gf_strdup (lock->client_uid); out: @@ -3385,6 +3387,8 @@ gf_lkmig_info_to_posix_lock (call_frame_t *frame, lock->client = frame->root->client; + lock->lk_flags = lmi->lk_flags; + lock->client_uid = gf_strdup (lmi->client_uid); if (lock->client_uid == NULL) { GF_FREE (lock); diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c index 351a10be6e6..4bdb364a9a3 100644 --- a/xlators/protocol/client/src/client-helpers.c +++ b/xlators/protocol/client/src/client-helpers.c @@ -1795,6 +1795,8 @@ clnt_unserialize_rsp_locklist (xlator_t *this, struct gfs3_getactivelk_rsp *rsp, gf_proto_flock_to_flock (&trav->flock, &temp->flock); + temp->lk_flags = trav->lk_flags; + temp->client_uid = gf_strdup (trav->client_uid); list_add_tail (&temp->list, &lmi->list); @@ -1861,6 +1863,8 @@ serialize_req_locklist (lock_migration_info_t *locklist, gf_proto_flock_from_flock (&trav->flock, &tmp->flock); + trav->lk_flags = tmp->lk_flags; + trav->client_uid = gf_strdup (tmp->client_uid); if (!trav->client_uid) { gf_msg (THIS->name, GF_LOG_ERROR, 0, 0, diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c index 09183e8a1dd..39fbcbc6763 100644 --- a/xlators/protocol/server/src/server-helpers.c +++ b/xlators/protocol/server/src/server-helpers.c @@ -1025,6 +1025,8 @@ serialize_rsp_locklist (lock_migration_info_t *locklist, gf_proto_flock_from_flock (&trav->flock, &tmp->flock); + trav->lk_flags = tmp->lk_flags; + trav->client_uid = tmp->client_uid; if (prev) @@ -1337,6 +1339,8 @@ unserialize_req_locklist (gfs3_setactivelk_req *req, gf_proto_flock_to_flock (&trav->flock, &temp->flock); + temp->lk_flags = trav->lk_flags; + temp->client_uid = gf_strdup (trav->client_uid); list_add_tail (&temp->list, &lmi->list); |