From c327d04eb19ce568bc2020025de234ae21780e26 Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Wed, 26 Mar 2008 11:08:58 -0700 Subject: [PATCH] client: fixed file refcounting --- src/client/Client.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 5c26faa72efb4..d8ec3015d0a3e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2714,9 +2714,10 @@ int Client::_open(const char *path, int flags, mode_t mode, Fh **fhp) assert(in); f->inode = in; f->inode->get(); + if (!dn) + in->add_open(f->mode); // i may have alrady added it above! - in->add_open(f->mode); - dout(10) << " wr " << in->num_open_wr << " rd " << in->num_open_rd + dout(10) << in->inode.ino << " wr " << in->num_open_wr << " rd " << in->num_open_rd << " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << dendl; // caps included? @@ -2778,7 +2779,7 @@ int Client::_open(const char *path, int flags, mode_t mode, Fh **fhp) void Client::close_release(Inode *in) { dout(10) << "close_release on " << in->ino() << dendl; - dout(10) << " wr " << in->num_open_wr << " rd " << in->num_open_rd + dout(10) << in->inode.ino << " wr " << in->num_open_wr << " rd " << in->num_open_rd << " dirty " << in->fc.is_dirty() << " cached " << in->fc.is_cached() << dendl; if (!in->num_open_rd) @@ -2826,6 +2827,8 @@ int Client::_release(Fh *f) in->sub_open(f->mode); int after = in->file_caps_wanted(); + delete f; + // does this change what caps we want? if (before != after && after) update_caps_wanted(in); -- 2.39.5