From: Gui Hecheng Date: Thu, 25 May 2017 06:53:09 +0000 (+0800) Subject: rgw_file: fix double lock on unlink bucket X-Git-Tag: ses5-milestone6~9^2~48^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6d80995a1b494bb6570d23cf08ae404d9ec0a58b;p=ceph.git rgw_file: fix double lock on unlink bucket When stat_buckets with FLAG_LOCKED, we would not want to lock_guard again to protect time attrs. Signed-off-by: Gui Hecheng --- diff --git a/src/rgw/rgw_file.cc b/src/rgw/rgw_file.cc index 6f211e77dac..6e0142c8bab 100644 --- a/src/rgw/rgw_file.cc +++ b/src/rgw/rgw_file.cc @@ -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;