From: NitzanMordhai Date: Sun, 17 Jul 2022 08:01:30 +0000 (+0000) Subject: cls_lock: expired lock before unlock and start check X-Git-Tag: v17.2.8~112^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F59272%2Fhead;p=ceph.git cls_lock: expired lock before unlock and start check If the lock expired, the stat check shouldn't return -ENOENT, We will change the lock duration to prevent lock expired before the stat check. Fixes: https://tracker.ceph.com/issues/56575 Signed-off-by: Nitzan Mordechai (cherry picked from commit d3457c64b1bdc26a4379197ae206019a615d2ebc) Comment from @idryomov: There is a delta between the original commit and the backport due to #45762 [1] not getting backported to quincy. [1] https://github.com/ceph/ceph/pull/45762 --- diff --git a/src/test/cls_lock/test_cls_lock.cc b/src/test/cls_lock/test_cls_lock.cc index bf09ec592cf..b915de9c236 100644 --- a/src/test/cls_lock/test_cls_lock.cc +++ b/src/test/cls_lock/test_cls_lock.cc @@ -476,7 +476,7 @@ TEST(ClsLock, TestExclusiveEphemeralBasic) { string lock_name2 = "mylock2"; Lock l1(lock_name1); - l1.set_duration(utime_t(5, 0)); + l1.set_duration(utime_t(300, 0)); uint64_t size; time_t mod_time; @@ -491,8 +491,7 @@ TEST(ClsLock, TestExclusiveEphemeralBasic) { // *********************************************** Lock l2(lock_name2); - utime_t lock_duration2(5, 0); - l2.set_duration(utime_t(5, 0)); + l2.set_duration(utime_t(300, 0)); ASSERT_EQ(0, l2.lock_exclusive(&ioctx, oid2)); ASSERT_EQ(0, ioctx.stat(oid2, &size, &mod_time));