]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
client: fix file cache cap leak which can stall async read call
authorDhairya Parmar <dparmar@redhat.com>
Thu, 11 Jan 2024 10:51:33 +0000 (16:21 +0530)
committerDhairya Parmar <dparmar@redhat.com>
Thu, 11 Jul 2024 22:01:11 +0000 (03:31 +0530)
commit9a7645e9d6f90789aa7726a506c211cf66ed3d4c
tree4c9694a4fbfd1b86be2e9b0c622ec07f62892f95
parent3163be345c18c4d5abc3f461d372b8f8a11a2d78
client: fix file cache cap leak which can stall async read call

We need the `Fc` cap ref when ObjectCacher::file_read returns zero bytes; then
wait for the I/O to finish; then do readahead but this cap ref needs to be put
down as well at the right place. The problem with the current implementation is
that it is difficult to decide whether to revoke the `Fc` cap ref in
Client::C_Read_Async_Finisher::finish or not since the destructor cannot
differenciate between the cases as it is fed with the bytes that are read after
waiting for the I/O to be finished.

Therefore provide `Fc` cap ref to the inode before making a call to
ObjectCacher::file_read in Client::_read_async and handle revoking it:
- if async read then in Client::C_Read_Async_Finisher::finish
- else if sync read then within Client::_read_async right before calling
  Client::do_readahead.

Fixes: https://tracker.ceph.com/issues/63896
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
src/client/Client.cc