]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: clear cap->issued on flushsnap
authorSage Weil <sage@newdream.net>
Mon, 15 Feb 2010 21:27:01 +0000 (13:27 -0800)
committerSage Weil <sage@newdream.net>
Mon, 15 Feb 2010 21:27:01 +0000 (13:27 -0800)
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.

src/mds/Locker.cc
src/mds/Locker.h

index 612d857e1fa6e31c89fee73ccc13a175e601cfaa..af2f7341f054cb3cf9dd3c955e26eee7e6f4219a 100644 (file)
@@ -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();
index e5280a538697cfc1c7141df0cdb6ab4cc8eb8cf5..7afc5d8b3f84009d097cce83e6b6d162bad769c5 100644 (file)
@@ -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);