Only set FLAG_DELETED when the object/bucket is successfully
deleted or ENOENT returned due to race with other s3 gateway.
Signed-off-by: Gui Hecheng <guihecheng@cmss.chinamobile.com>
}
}
- rgw_fh->flags |= RGWFileHandle::FLAG_DELETED;
- fh_cache.remove(rgw_fh->fh.fh_hk.object, rgw_fh,
- RGWFileHandle::FHCache::FLAG_LOCK);
+ /* ENOENT when raced with other s3 gateway */
+ if (! rc || rc == -ENOENT) {
+ rgw_fh->flags |= RGWFileHandle::FLAG_DELETED;
+ fh_cache.remove(rgw_fh->fh.fh_hk.object, rgw_fh,
+ RGWFileHandle::FHCache::FLAG_LOCK);
+ }
if (! rc) {
real_time t = real_clock::now();