]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
objecter: protect linger_op last_error and registered fields 3693/head
authorJosh Durgin <jdurgin@redhat.com>
Wed, 11 Feb 2015 04:04:17 +0000 (20:04 -0800)
committerJosh Durgin <jdurgin@redhat.com>
Wed, 11 Feb 2015 04:19:32 +0000 (20:19 -0800)
These are read and updated in places where using the session lock or
objecter->rwlock wouldn't make sense, so protect them with watch_lock
instead. last_error was already mostly protected by this lock, it was
just missing in tick().

Fixes: #10831
Backport: giant
Signed-off-by: Josh Durgin <jdurgin@redhat.com>
src/osdc/Objecter.cc

index 42edeb1c854367aea6db3d2353bc1fa54070e25b..af90732f72714fbc484db81f1a09f17e064dbafe 100644 (file)
@@ -419,6 +419,7 @@ void Objecter::_send_linger(LingerOp *info)
   vector<OSDOp> opv;
   Context *onack = NULL;
   Context *oncommit = NULL;
+  info->watch_lock.get_read(); // just to read registered status
   if (info->registered && info->is_watch) {
     ldout(cct, 15) << "send_linger " << info->linger_id << " reconnect" << dendl;
     opv.push_back(OSDOp());
@@ -434,6 +435,7 @@ void Objecter::_send_linger(LingerOp *info)
       onack = new C_Linger_Register(this, info);
     oncommit = new C_Linger_Commit(this, info);
   }
+  info->watch_lock.put_read();
   Op *o = new Op(info->target.base_oid, info->target.base_oloc,
                 opv, info->target.flags | CEPH_OSD_FLAG_READ,
                 onack, oncommit,
@@ -478,6 +480,7 @@ void Objecter::_linger_register(LingerOp *info, int r)
 
 void Objecter::_linger_commit(LingerOp *info, int r) 
 {
+  RWLock::WLocker wl(info->watch_lock);
   ldout(cct, 10) << "_linger_commit " << info->linger_id << dendl;
   if (info->on_reg_commit) {
     info->on_reg_commit->complete(r);
@@ -1879,6 +1882,7 @@ void Objecter::tick()
            p != s->linger_ops.end();
            ++p) {
         LingerOp *op = p->second;
+        RWLock::WLocker wl(op->watch_lock);
         assert(op->session);
         ldout(cct, 10) << " pinging osd that serves lingering tid " << p->first << " (osd." << op->session->osd << ")" << dendl;
         toping.insert(op->session);