Skip to content

Commit

Permalink
FSAL_CEPH: don't clobber the return code with the getlk call
Browse files Browse the repository at this point in the history
If a lock is denied, the code will call getlk to get the conflicting lock
info. That action then clobbers the return code and makes the lock appear
to be a success.

Also, no need to check conflicting_lock twice here.

See: nfs-ganesha/nfs-ganesha#205

Change-Id: Ibfc8ca92bec84518573f425131ce969479ae15dd
Signed-off-by: Jeff Layton <jlayton@redhat.com>
(cherry picked from commit d9f0536)

Resolves: rhbz#1500669
  • Loading branch information
jtlayton authored and tserlin committed Oct 16, 2017
1 parent b17e3f7 commit f7f4c7f
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/FSAL/FSAL_CEPH/handle.c
Expand Up @@ -1854,23 +1854,22 @@ fsal_status_t ceph_lock_op2(struct fsal_obj_handle *obj_hdl,
-retval, strerror(-retval));

if (conflicting_lock != NULL) {
int retval2;

/* Get the conflicting lock */
retval = ceph_ll_getlk(export->cmount, my_fd,
retval2 = ceph_ll_getlk(export->cmount, my_fd,
&lock_args, (uint64_t) owner);

if (retval < 0) {
if (retval2 < 0) {
LogCrit(COMPONENT_FSAL,
"After failing a lock request, I couldn't even get the details of who owns the lock, error %d %s",
-retval, strerror(-retval));
-retval2, strerror(-retval2));
goto err;
}

if (conflicting_lock != NULL) {
conflicting_lock->lock_length = lock_args.l_len;
conflicting_lock->lock_start =
lock_args.l_start;
conflicting_lock->lock_type = lock_args.l_type;
}
conflicting_lock->lock_length = lock_args.l_len;
conflicting_lock->lock_start = lock_args.l_start;
conflicting_lock->lock_type = lock_args.l_type;
}

goto err;
Expand Down

0 comments on commit f7f4c7f

Please sign in to comment.