From: mark15213 Date: Wed, 4 Aug 2021 13:02:32 +0000 (+0800) Subject: libcephsqlite: fix unconditional success bug in CheckReservedLock X-Git-Tag: v16.2.13~61^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5c423e5533be0ba6c775261c9cd34154b082c90f;p=ceph.git libcephsqlite: fix unconditional success bug in CheckReservedLock we don't want to set result to zero at the end. Otherwise, the if above would be useless and the function cannot be used to check the reserved lock. Fixes: https://tracker.ceph.com/issues/52001 Signed-off-by: Shuai Wang (cherry picked from commit e8162b1e2a048b5007db3653ff1299ea49e458f2) --- diff --git a/src/libcephsqlite.cc b/src/libcephsqlite.cc index a6e8a48833a8..39a61a919480 100644 --- a/src/libcephsqlite.cc +++ b/src/libcephsqlite.cc @@ -254,6 +254,7 @@ static int CheckReservedLock(sqlite3_file *file, int *result) auto f = (cephsqlite_file*)file; auto start = ceph::coarse_mono_clock::now(); df(5) << dendl; + *result = 0; auto& lock = f->lock; if (lock > SQLITE_LOCK_SHARED) { @@ -264,7 +265,6 @@ static int CheckReservedLock(sqlite3_file *file, int *result) f->io.rs->print_lockers(*_dout); *_dout << dendl; - *result = 0; auto end = ceph::coarse_mono_clock::now(); getdata(f->vfs).logger->tinc(P_OPF_CHECKRESERVEDLOCK, end-start); return SQLITE_OK;