}
 
 /*
- * Record the completion of an in-progress operation.
+ * Record the completion or cancellation of an in-progress operation.
  */
-void fscache_op_complete(struct fscache_operation *op)
+void fscache_op_complete(struct fscache_operation *op, bool cancelled)
 {
        struct fscache_object *object = op->object;
 
 
        spin_lock(&object->lock);
 
-       op->state = FSCACHE_OP_ST_COMPLETE;
+       op->state = cancelled ?
+               FSCACHE_OP_ST_CANCELLED : FSCACHE_OP_ST_COMPLETE;
 
        if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
                object->n_exclusive--;
 
                        fscache_abort_object(object);
        }
 
-       fscache_op_complete(op);
+       fscache_op_complete(op, true);
        _leave("");
 }
 
                 * exists, so we should just cancel this write operation.
                 */
                spin_unlock(&object->lock);
-               op->op.state = FSCACHE_OP_ST_CANCELLED;
+               fscache_op_complete(&op->op, false);
                _leave(" [inactive]");
                return;
        }
                 * cancel this write operation.
                 */
                spin_unlock(&object->lock);
-               op->op.state = FSCACHE_OP_ST_CANCELLED;
+               fscache_op_complete(&op->op, false);
                _leave(" [cancel] op{f=%lx s=%u} obj{s=%u f=%lx}",
                       _op->flags, _op->state, object->state, object->flags);
                return;
        fscache_end_page_write(object, page);
        if (ret < 0) {
                fscache_abort_object(object);
-               fscache_op_complete(&op->op);
+               fscache_op_complete(&op->op, true);
        } else {
                fscache_enqueue_operation(&op->op);
        }
        spin_unlock(&cookie->stores_lock);
        clear_bit(FSCACHE_OBJECT_PENDING_WRITE, &object->flags);
        spin_unlock(&object->lock);
-       fscache_op_complete(&op->op);
+       fscache_op_complete(&op->op, true);
        _leave("");
 }
 
 
 extern void fscache_op_work_func(struct work_struct *work);
 
 extern void fscache_enqueue_operation(struct fscache_operation *);
-extern void fscache_op_complete(struct fscache_operation *);
+extern void fscache_op_complete(struct fscache_operation *, bool);
 extern void fscache_put_operation(struct fscache_operation *);
 
 /**
 {
        op->n_pages -= n_pages;
        if (op->n_pages <= 0)
-               fscache_op_complete(&op->op);
+               fscache_op_complete(&op->op, true);
 }
 
 /**