]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Fh ref count will leak if readahead does not need to do read from osd 5427/head
authorZhi Zhang <zhangz.david@outlook.com>
Wed, 22 Jul 2015 02:54:53 +0000 (10:54 +0800)
committerLoic Dachary <ldachary@redhat.com>
Thu, 30 Jul 2015 20:15:34 +0000 (22:15 +0200)
The 3c8cdeacf46ae4031189d2ef6948aa3b6ab4ae43 backport introduced a leak.

http://tracker.ceph.com/issues/12319 Fixes: #12319

Signed-off-by: Zhi Zhang <zhangz.david@outlook.com>
src/client/Client.cc
src/client/Client.h

index fc3b52a254273bb60f2c0982dd0609b47687c726..446f0d12608896739e68b4f9c0d295e5b07249e7 100644 (file)
@@ -7054,11 +7054,14 @@ Client::C_Readahead::C_Readahead(Client *c, Fh *f) :
     f->get();
 }
 
+Client::C_Readahead::~C_Readahead() {
+  client->_put_fh(f);
+}
+
 void Client::C_Readahead::finish(int r) {
   lgeneric_subdout(client->cct, client, 20) << "client." << client->get_nodeid() << " " << "C_Readahead on " << f->inode << dendl;
   client->put_cap_ref(f->inode, CEPH_CAP_FILE_RD | CEPH_CAP_FILE_CACHE);
   f->readahead.dec_pending();
-  client->_put_fh(f);
 }
 
 int Client::_read_async(Fh *f, uint64_t off, uint64_t len, bufferlist *bl)
index 14f47accae93b2f6cc84eb61804a50d16240b333..b476f5eff8597d7f5bd2b5bbfe1ba29f4ea79f93 100644 (file)
@@ -635,6 +635,7 @@ private:
     Client *client;
     Fh *f;
     C_Readahead(Client *c, Fh *f);
+    ~C_Readahead();
     void finish(int r);
   };