From: Sage Weil Date: Mon, 15 Feb 2010 21:27:01 +0000 (-0800) Subject: mds: clear cap->issued on flushsnap X-Git-Tag: v0.19~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=01ed8d0aaa4e5213d88969e8aecc93451675fdea;p=ceph.git mds: clear cap->issued on flushsnap This allows _do_cap_update to clear out the client_range. Kill (now) unused/unnecessary 'wanted' arg to _do_cap_update. Also delay cap removal until after _do_cap_update (whcih takes a Capability*). This probably needs further cleanup. --- diff --git a/src/mds/Locker.cc b/src/mds/Locker.cc index 612d857e1fa6..af2f7341f054 100644 --- a/src/mds/Locker.cc +++ b/src/mds/Locker.cc @@ -1676,14 +1676,8 @@ void Locker::handle_client_caps(MClientCaps *m) << " client" << client << " on " << *in << dendl; // this cap now follows a later snap (i.e. the one initiating this flush, or later) cap->client_follows = follows+1; - - if (in->last <= follows) { - dout(10) << " flushsnap releasing cloned cap" << dendl; - in->remove_client_cap(client); - } else { - dout(10) << " flushsnap NOT releasing live cap" << dendl; - } - + cap->confirm_receipt(cap->get_last_sent(), 0); + // we can prepare the ack now, since this FLUSHEDSNAP is independent of any // other cap ops. (except possibly duplicate FLUSHSNAP requests, but worst // case we get a dup response, so whatever.) @@ -1693,11 +1687,19 @@ void Locker::handle_client_caps(MClientCaps *m) ack->set_snap_follows(follows); ack->set_client_tid(m->get_client_tid()); } - if (!_do_cap_update(in, cap, m->get_dirty(), 0, follows, m, ack)) { + if (!_do_cap_update(in, cap, m->get_dirty(), follows, m, ack)) { if (ack) mds->send_message_client(ack, client); eval_cap_gather(in); } + + // remove cap _after_ do_cap_update() (which takes the Capability*) + if (in->last <= follows) { + dout(10) << " flushsnap releasing cloned cap" << dendl; + in->remove_client_cap(client); + } else { + dout(10) << " flushsnap NOT releasing live cap" << dendl; + } } else dout(7) << " not auth, ignoring flushsnap on " << *in << dendl; goto out; @@ -1740,7 +1742,7 @@ void Locker::handle_client_caps(MClientCaps *m) if (m->get_op() == CEPH_CAP_OP_DROP) can_issue = false; - if (_do_cap_update(in, cap, m->get_dirty(), cap->wanted(), follows, m, ack)) { + if (_do_cap_update(in, cap, m->get_dirty(), follows, m, ack)) { // updated, cap msg is delayed cap->inc_suppress(); eval(in, CEPH_CAP_LOCKS); @@ -1853,11 +1855,12 @@ static __u64 calc_bounding(__u64 t) * if we update, return true; otherwise, false (no updated needed). */ bool Locker::_do_cap_update(CInode *in, Capability *cap, - int dirty, int wanted, snapid_t follows, MClientCaps *m, + int dirty, snapid_t follows, MClientCaps *m, MClientCaps *ack) { dout(10) << "_do_cap_update dirty " << ccap_string(dirty) - << " wanted " << ccap_string(wanted) + << " issued " << ccap_string(cap->issued()) + << " wanted " << ccap_string(cap->wanted()) << " on " << *in << dendl; assert(in->is_auth()); client_t client = m->get_source().num(); diff --git a/src/mds/Locker.h b/src/mds/Locker.h index e5280a538697..7afc5d8b3f84 100644 --- a/src/mds/Locker.h +++ b/src/mds/Locker.h @@ -177,7 +177,7 @@ public: protected: void adjust_cap_wanted(Capability *cap, int wanted, int issue_seq); void handle_client_caps(class MClientCaps *m); - bool _do_cap_update(CInode *in, Capability *cap, int had, int wanted, snapid_t follows, MClientCaps *m, + bool _do_cap_update(CInode *in, Capability *cap, int dirty, snapid_t follows, MClientCaps *m, MClientCaps *ack=0); void handle_client_cap_release(class MClientCapRelease *m);