]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: Fix caps_ref[c]<0 assert
authorKotresh HR <khiremat@redhat.com>
Mon, 30 Sep 2024 07:15:04 +0000 (12:45 +0530)
committerVenky Shankar <vshankar@redhat.com>
Mon, 23 Jun 2025 03:41:19 +0000 (09:11 +0530)
When libcephfs aio tests (src/test/client) are run
with objectcacher disabled (ceph_test_client --client_oc=false),
the TestClient.LlreadvLlwritev fails and core dumps. The client
hits the assert 'caps_ref[c]<0'.

This patch fixes the same. There is no need to give out cap_ref
and take it again between multiple read because of short reads.
In some cases, the get_caps used to fail in C_Read_Sync_NonBlocking::finish
causing cap_ref to go negative when put_cap_ref is done at last in
C_Read_Finish::finish_io

Fixes: https://tracker.ceph.com/issues/68308
Signed-off-by: Kotresh HR <khiremat@redhat.com>
(cherry picked from commit 10c8330f20cd2e93ce036d0ea2c38552d71b62c6)

src/client/Client.cc

index 59456b1c5d710d5a075e1a48f2ef9299fca23f1e..d9889ae69fb8aa339c36f52803fab2aebf28f87f 100644 (file)
@@ -10953,7 +10953,6 @@ void Client::C_Read_Sync_NonBlocking::finish(int r)
         goto success;
     }
 
-    clnt->put_cap_ref(in, CEPH_CAP_FILE_RD);
     // reverify size
     {
       r = clnt->_getattr(in, CEPH_STAT_CAP_SIZE, f->actor_perms);
@@ -10965,14 +10964,6 @@ void Client::C_Read_Sync_NonBlocking::finish(int r)
     if ((uint64_t)pos >= in->size)
       goto success;
 
-    {
-      int have_caps2 = 0;
-      r = clnt->get_caps(f, CEPH_CAP_FILE_RD, have_caps, &have_caps2, -1);
-      if (r < 0) {
-        goto error;
-      }
-    }
-
     wanted = left;
     retry();
     clnt->client_lock.unlock();