From: Sage Weil Date: Wed, 22 Jun 2011 19:45:35 +0000 (-0700) Subject: client: always use get_snap_context() accessor X-Git-Tag: v0.30~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6a1572c78724b510a4ae03a02448ddfae703d856;p=ceph.git client: always use get_snap_context() accessor There were a few places where we were using the member directly and not the accessor, which rebuilds the internal value when needed. This caused inconsistent behavior based on whether debugging was enabled or not, since we used the accessor to print the regenerated value. Passes all snaps workunits with debugging off. Signed-off-by: Sage Weil --- diff --git a/src/client/Client.cc b/src/client/Client.cc index b521d4eecc9..59d3311e1e7 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2055,7 +2055,7 @@ void Client::queue_cap_snap(Inode *in, snapid_t seq) (dirty & CEPH_CAP_ANY_WR)) { in->get(); CapSnap *capsnap = &in->cap_snaps[seq]; - capsnap->context = in->snaprealm->cached_snap_context; + capsnap->context = in->snaprealm->get_snap_context(); capsnap->issued = in->caps_issued(); capsnap->dirty = in->caps_dirty(); // a bit conservative? @@ -2582,7 +2582,7 @@ inodeno_t Client::update_snap_trace(bufferlist& bl, bool flush) while (!p.end()) { Inode *in = *p; ++p; - queue_cap_snap(in, realm->cached_snap_context.seq); + queue_cap_snap(in, realm->get_snap_context().seq); } for (set::iterator p = realm->pchildren.begin(); @@ -2656,7 +2656,7 @@ void Client::handle_snap(MClientSnap *m) dout(10) << " moving " << *in << " from " << *in->snaprealm << dendl; // queue for snap writeback - queue_cap_snap(in, in->snaprealm->cached_snap_context.seq); + queue_cap_snap(in, in->snaprealm->get_snap_context().seq); put_snap_realm(in->snaprealm); in->snaprealm_item.remove_myself(); diff --git a/src/client/Client.h b/src/client/Client.h index 11db91ded17..81af6b4893f 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -302,8 +302,11 @@ struct SnapRealm { SnapRealm *pparent; set pchildren; +private: SnapContext cached_snap_context; // my_snaps + parent snaps + past_parent_snaps + friend ostream& operator<<(ostream& out, const SnapRealm& r); +public: xlist inodes_with_caps; SnapRealm(inodeno_t i) :