]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #2628 from ceph/wip-client-flock
authorGregory Farnum <greg@inktank.com>
Thu, 16 Oct 2014 13:57:34 +0000 (06:57 -0700)
committerGregory Farnum <greg@inktank.com>
Thu, 16 Oct 2014 13:57:34 +0000 (06:57 -0700)
Wip client flock

Add support for file locking to the userspace client, and improve blocked-lock cancellation so that it doesn't remove locks that succeeded when racing.

Reviewed-by: Greg Farnum <greg@inktank.com>
1  2 
src/mds/flock.cc

index f327a5813e5e50618092ca2bab47a63f8ea33d10,9455a89404018eeb38fffeef38a4e20b3c8663ca..e99435e5d19d7580b9736c405dcea56d4298b6d2
@@@ -139,10 -140,10 +139,10 @@@ void ceph_lock_state_t::remove_lock(cep
           iter = self_overlapping_locks.begin();
         iter != self_overlapping_locks.end();
         ++iter) {
-     dout(15) << "self overlapping lock " << (*iter)->second << dendl;
+     ldout(cct,15) << "self overlapping lock " << (*iter)->second << dendl;
      old_lock = &(*iter)->second;
      bool old_lock_to_end = (0 == old_lock->length);
 -    old_lock_end = old_lock->start + old_lock->length - 1;
 +    uint64_t old_lock_end = old_lock->start + old_lock->length - 1;
      old_lock_client = old_lock->client;
      if (remove_to_end) {
        if (old_lock->start < removal_start) {
@@@ -206,8 -207,10 +206,8 @@@ void ceph_lock_state_t::adjust_locks(li
                    list<multimap<uint64_t, ceph_filelock>::iterator>
                    neighbor_locks)
  {
-   dout(15) << "adjust_locks" << dendl;
+   ldout(cct,15) << "adjust_locks" << dendl;
    bool new_lock_to_end = (0 == new_lock.length);
 -  uint64_t new_lock_start, new_lock_end;
 -  uint64_t old_lock_start, old_lock_end;
    __s64 old_lock_client = 0;
    ceph_filelock *old_lock;
    for (list<multimap<uint64_t, ceph_filelock>::iterator>::iterator
         iter != old_locks.end();
         ++iter) {
      old_lock = &(*iter)->second;
-     dout(15) << "adjusting lock: " << *old_lock << dendl;
+     ldout(cct,15) << "adjusting lock: " << *old_lock << dendl;
      bool old_lock_to_end = (0 == old_lock->length);
 -    old_lock_start = old_lock->start;
 -    old_lock_end = old_lock->start + old_lock->length - 1;
 -    new_lock_start = new_lock.start;
 -    new_lock_end = new_lock.start + new_lock.length - 1;
 +    uint64_t old_lock_start = old_lock->start;
 +    uint64_t old_lock_end = old_lock->start + old_lock->length - 1;
 +    uint64_t new_lock_start = new_lock.start;
 +    uint64_t new_lock_end = new_lock.start + new_lock.length - 1;
      old_lock_client = old_lock->client;
      if (new_lock_to_end || old_lock_to_end) {
        //special code path to deal with a length set at 0