]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: fix double lock on unlink bucket 15222/head
authorGui Hecheng <guihecheng@cmss.chinamobile.com>
Thu, 25 May 2017 06:53:09 +0000 (14:53 +0800)
committerGui Hecheng <guihecheng@cmss.chinamobile.com>
Thu, 25 May 2017 09:04:54 +0000 (17:04 +0800)
When stat_buckets with FLAG_LOCKED, we would not want to lock_guard
again to protect time attrs.

Signed-off-by: Gui Hecheng <guihecheng@cmss.chinamobile.com>
src/rgw/rgw_file.cc

index 6f211e77daccde3e792e36306ac064dd151f6e26..6e0142c8bab59fd28f058abc04ae3cac37fee488 100644 (file)
@@ -84,7 +84,9 @@ namespace rgw {
                      RGWFileHandle::FLAG_BUCKET);
       if (get<0>(fhr)) {
        RGWFileHandle* rgw_fh = get<0>(fhr);
-       lock_guard guard(rgw_fh->mtx);
+       if (! (flags & RGWFileHandle::FLAG_LOCKED)) {
+         rgw_fh->mtx.lock();
+       }
        rgw_fh->set_times(req.get_ctime());
        /* restore attributes */
        auto ux_key = req.get_attr(RGW_ATTR_UNIX_KEY1);
@@ -92,6 +94,9 @@ namespace rgw {
        if (ux_key && ux_attrs) {
          rgw_fh->decode_attrs(ux_key, ux_attrs);
        }
+       if (! (flags & RGWFileHandle::FLAG_LOCKED)) {
+         rgw_fh->mtx.unlock();
+       }
       }
     }
     return fhr;