mirror of
https://github.com/ceph/ceph
synced 2024-12-18 17:37:38 +00:00
Merge pull request #15246 from linuxbox2/wip-unlink-safe
rgw_file: release rgw_fh lock and ref on ENOTEMPTY
This commit is contained in:
commit
9f8f0d75e8
@ -273,7 +273,9 @@ namespace rgw {
|
||||
/* a bucket may have an object storing Unix attributes, check
|
||||
* for and delete it */
|
||||
LookupFHResult fhr;
|
||||
fhr = stat_bucket(parent, name, bs, RGWFileHandle::FLAG_LOCKED);
|
||||
fhr = stat_bucket(parent, name, bs, (rgw_fh) ?
|
||||
RGWFileHandle::FLAG_LOCKED :
|
||||
RGWFileHandle::FLAG_NONE);
|
||||
bkt_fh = get<0>(fhr);
|
||||
if (unlikely(! bkt_fh)) {
|
||||
/* implies !rgw_fh, so also !LOCKED */
|
||||
@ -281,7 +283,14 @@ namespace rgw {
|
||||
}
|
||||
|
||||
if (bs.num_entries > 1) {
|
||||
unref(bkt_fh); /* return extra ref */
|
||||
unref(bkt_fh); /* return stat_bucket ref */
|
||||
if (likely(!! rgw_fh)) { /* return lock and ref from
|
||||
* lookup_fh (or caller in the
|
||||
* special case of
|
||||
* RGWFileHandle::FLAG_UNLINK_THIS) */
|
||||
rgw_fh->mtx.unlock();
|
||||
unref(rgw_fh);
|
||||
}
|
||||
return -ENOTEMPTY;
|
||||
} else {
|
||||
/* delete object w/key "<bucket>/" (uxattrs), if any */
|
||||
|
Loading…
Reference in New Issue
Block a user