]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: add mtime check to object removal if needed
authorYehuda Sadeh <yehuda@redhat.com>
Thu, 2 Apr 2015 00:07:03 +0000 (17:07 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Fri, 12 Feb 2016 00:12:50 +0000 (16:12 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_rados.cc

index 7def00886fbe4521eeb7adc79ef5ed792bb0ec0d..3fe90b7bb9440584485c162958c06a10ffd60478 100644 (file)
@@ -6093,6 +6093,8 @@ int RGWRados::Object::Delete::delete_obj()
   if (r < 0)
     return r;
 
+  ObjectWriteOperation op;
+
   if (params.unmod_since > 0) {
     time_t ctime = state->mtime;
 
@@ -6100,6 +6102,9 @@ int RGWRados::Object::Delete::delete_obj()
     if (ctime > params.unmod_since) {
       return -ERR_PRECONDITION_FAILED;
     }
+
+    /* only delete object if mtime is less than or equal to params.unmod_since */
+    store->cls_obj_check_mtime(op, utime_t(params.unmod_since, 0), CLS_RGW_CHECK_TIME_MTIME_LE);
   }
   uint64_t obj_size = state->size;
 
@@ -6122,8 +6127,6 @@ int RGWRados::Object::Delete::delete_obj()
     }
   }
 
-  ObjectWriteOperation op;
-
   r = target->prepare_atomic_modification(op, false, NULL, NULL, NULL, true);
   if (r < 0)
     return r;