]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw_file: fix flags set on unsuccessful unlink
authorGui Hecheng <guihecheng@cmss.chinamobile.com>
Thu, 25 May 2017 05:57:56 +0000 (13:57 +0800)
committerGui Hecheng <guihecheng@cmss.chinamobile.com>
Thu, 25 May 2017 09:04:51 +0000 (17:04 +0800)
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>
src/rgw/rgw_file.cc

index cd497480f47440f06cab5b38db23e378c4685f4a..6f211e77daccde3e792e36306ac064dd151f6e26 100644 (file)
@@ -347,9 +347,12 @@ namespace rgw {
       }
     }
 
-    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();