diff options
author | Atin Mukherjee <amukherj@redhat.com> | 2019-04-16 22:14:47 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2019-04-17 08:17:29 +0000 |
commit | 785f3276d2e325a991b64aed66a326ea95fffef3 (patch) | |
tree | 0ccd327225b01e4d3eba2d26051dfe6ff7f335df /xlators | |
parent | b922793588ad23a9b12ce65abd29e8f45ac87998 (diff) | |
download | glusterfs-785f3276d2e325a991b64aed66a326ea95fffef3.tar.gz glusterfs-785f3276d2e325a991b64aed66a326ea95fffef3.tar.xz glusterfs-785f3276d2e325a991b64aed66a326ea95fffef3.zip |
Revert "features/locks: error-out {inode,entry}lk fops with all-zero lk-owner"
This reverts commit 3883887427a7f2dc458a9773e05f7c8ce8e62301 as it has
broken sdfs-sanity.t.
Updates: bz#1624701
Change-Id: Icb2b0d6bfcce4d556f1cd0f11695c03ffc138736
Signed-off-by: Atin Mukherjee <amukherj@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/locks/src/common.c | 28 | ||||
-rw-r--r-- | xlators/features/locks/src/common.h | 5 | ||||
-rw-r--r-- | xlators/features/locks/src/entrylk.c | 12 | ||||
-rw-r--r-- | xlators/features/locks/src/inodelk.c | 16 | ||||
-rw-r--r-- | xlators/features/locks/src/posix.c | 7 |
5 files changed, 15 insertions, 53 deletions
diff --git a/xlators/features/locks/src/common.c b/xlators/features/locks/src/common.c index ccb23e2250..6e7fb4b2f6 100644 --- a/xlators/features/locks/src/common.c +++ b/xlators/features/locks/src/common.c @@ -493,8 +493,7 @@ unlock: /* Create a new posix_lock_t */ posix_lock_t * new_posix_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, - gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, int blocking, - int32_t *op_errno) + gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, int blocking) { posix_lock_t *lock = NULL; @@ -502,14 +501,8 @@ new_posix_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, GF_VALIDATE_OR_GOTO("posix-locks", client, out); GF_VALIDATE_OR_GOTO("posix-locks", fd, out); - if (!pl_is_lk_owner_valid(owner, client)) { - *op_errno = EINVAL; - goto out; - } - lock = GF_CALLOC(1, sizeof(posix_lock_t), gf_locks_mt_posix_lock_t); if (!lock) { - *op_errno = ENOMEM; goto out; } @@ -527,7 +520,6 @@ new_posix_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, if (lock->client_uid == NULL) { GF_FREE(lock); lock = NULL; - *op_errno = ENOMEM; goto out; } @@ -996,7 +988,6 @@ pl_send_prelock_unlock(xlator_t *this, pl_inode_t *pl_inode, 0, }; posix_lock_t *unlock_lock = NULL; - int32_t op_errno = 0; struct list_head granted_list; posix_lock_t *tmp = NULL; @@ -1014,7 +1005,7 @@ pl_send_prelock_unlock(xlator_t *this, pl_inode_t *pl_inode, unlock_lock = new_posix_lock(&flock, old_lock->client, old_lock->client_pid, &old_lock->owner, old_lock->fd, - old_lock->lk_flags, 0, &op_errno); + old_lock->lk_flags, 0); GF_VALIDATE_OR_GOTO(this->name, unlock_lock, out); ret = 0; @@ -1281,17 +1272,4 @@ pl_local_init(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd) } return 0; -} - -gf_boolean_t -pl_is_lk_owner_valid(gf_lkowner_t *owner, client_t *client) -{ - if (client && (client->opversion < GD_OP_VERSION_7_0)) { - return _gf_true; - } - - if (is_lk_owner_null(owner)) { - return _gf_false; - } - return _gf_true; -} +}
\ No newline at end of file diff --git a/xlators/features/locks/src/common.h b/xlators/features/locks/src/common.h index 55603ef9c4..3a7496758a 100644 --- a/xlators/features/locks/src/common.h +++ b/xlators/features/locks/src/common.h @@ -51,8 +51,7 @@ posix_lock_t * new_posix_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, - gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, int blocking, - int32_t *op_errno); + gf_lkowner_t *owner, fd_t *fd, uint32_t lk_flags, int can_block); pl_inode_t * pl_inode_get(xlator_t *this, inode_t *inode, pl_local_t *local); @@ -213,6 +212,4 @@ pl_clean_local(pl_local_t *local); int pl_local_init(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd); -gf_boolean_t -pl_is_lk_owner_valid(gf_lkowner_t *owner, client_t *client); #endif /* __COMMON_H__ */ diff --git a/xlators/features/locks/src/entrylk.c b/xlators/features/locks/src/entrylk.c index 9d6a4c9305..ced5eca274 100644 --- a/xlators/features/locks/src/entrylk.c +++ b/xlators/features/locks/src/entrylk.c @@ -39,20 +39,13 @@ __pl_entrylk_ref(pl_entry_lock_t *lock) static pl_entry_lock_t * new_entrylk_lock(pl_inode_t *pinode, const char *basename, entrylk_type type, - const char *domain, call_frame_t *frame, char *conn_id, - int32_t *op_errno) + const char *domain, call_frame_t *frame, char *conn_id) { pl_entry_lock_t *newlock = NULL; - if (!pl_is_lk_owner_valid(&frame->root->lk_owner, frame->root->client)) { - *op_errno = EINVAL; - goto out; - } - newlock = GF_CALLOC(1, sizeof(pl_entry_lock_t), gf_locks_mt_pl_entry_lock_t); if (!newlock) { - *op_errno = ENOMEM; goto out; } @@ -800,9 +793,10 @@ pl_common_entrylk(call_frame_t *frame, xlator_t *this, const char *volume, entrylk_trace_in(this, frame, volume, fd, loc, basename, cmd, type); reqlock = new_entrylk_lock(pinode, basename, type, dom->domain, frame, - conn_id, &op_errno); + conn_id); if (!reqlock) { op_ret = -1; + op_errno = ENOMEM; goto unwind; } diff --git a/xlators/features/locks/src/inodelk.c b/xlators/features/locks/src/inodelk.c index 95afc902ff..df00ede242 100644 --- a/xlators/features/locks/src/inodelk.c +++ b/xlators/features/locks/src/inodelk.c @@ -873,23 +873,17 @@ pl_inode_setlk(xlator_t *this, pl_ctx_t *ctx, pl_inode_t *pl_inode, } /* Create a new inode_lock_t */ -static pl_inode_lock_t * +pl_inode_lock_t * new_inode_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, call_frame_t *frame, xlator_t *this, const char *volume, - char *conn_id, int32_t *op_errno) + char *conn_id) { pl_inode_lock_t *lock = NULL; - if (!pl_is_lk_owner_valid(&frame->root->lk_owner, frame->root->client)) { - *op_errno = EINVAL; - goto out; - } - lock = GF_CALLOC(1, sizeof(*lock), gf_locks_mt_pl_inode_lock_t); if (!lock) { - *op_errno = ENOMEM; - goto out; + return NULL; } lock->fl_start = flock->l_start; @@ -917,7 +911,6 @@ new_inode_lock(struct gf_flock *flock, client_t *client, pid_t client_pid, INIT_LIST_HEAD(&lock->contend); __pl_inodelk_ref(lock); -out: return lock; } @@ -1012,10 +1005,11 @@ pl_common_inodelk(call_frame_t *frame, xlator_t *this, const char *volume, } reqlock = new_inode_lock(flock, frame->root->client, frame->root->pid, - frame, this, dom->domain, conn_id, &op_errno); + frame, this, dom->domain, conn_id); if (!reqlock) { op_ret = -1; + op_errno = ENOMEM; goto unwind; } diff --git a/xlators/features/locks/src/posix.c b/xlators/features/locks/src/posix.c index 6a1f429e8e..3f1c7a733f 100644 --- a/xlators/features/locks/src/posix.c +++ b/xlators/features/locks/src/posix.c @@ -2297,10 +2297,9 @@ __fd_has_locks(pl_inode_t *pl_inode, fd_t *fd) static posix_lock_t * lock_dup(posix_lock_t *lock) { - int32_t op_errno = 0; return new_posix_lock(&lock->user_flock, lock->client, lock->client_pid, &lock->owner, (fd_t *)lock->fd_num, lock->lk_flags, - lock->blocking, &op_errno); + lock->blocking); } static int @@ -2517,11 +2516,11 @@ pl_lk(call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, } reqlock = new_posix_lock(flock, frame->root->client, frame->root->pid, - &frame->root->lk_owner, fd, lk_flags, can_block, - &op_errno); + &frame->root->lk_owner, fd, lk_flags, can_block); if (!reqlock) { op_ret = -1; + op_errno = ENOMEM; goto unwind; } |