- if (server.vm_enabled) {
- if (val->storage == REDIS_VM_MEMORY ||
- val->storage == REDIS_VM_SWAPPING)
- {
- /* If we were swapping the object out, cancel the operation */
- if (val->storage == REDIS_VM_SWAPPING)
- vmCancelThreadedIOJob(val);
- /* Update the access time for the aging algorithm. */
- val->lru = server.lruclock;
- } else {
- int notify = (val->storage == REDIS_VM_LOADING);
-
- /* Our value was swapped on disk. Bring it at home. */
- redisAssert(val->type == REDIS_VMPOINTER);
- val = vmLoadObject(val);
- dictGetEntryVal(de) = val;
-
- /* Clients blocked by the VM subsystem may be waiting for
- * this key... */
- if (notify) handleClientsBlockedOnSwappedKey(db,key);
- }
+ /* Update the access time for the aging algorithm.
+ * Don't do it if we have a saving child, as this will trigger
+ * a copy on write madness. */
+ if (server.bgsavechildpid == -1 && server.bgrewritechildpid == -1)
+ val->lru = server.lruclock;
+
+ if (server.ds_enabled && val->storage == REDIS_DS_SAVING) {
+ /* FIXME: change this code to just wait for our object to
+ * get out of the IO Job. */
+ waitEmptyIOJobsQueue();
+ redisAssert(val->storage != REDIS_DS_SAVING);