fscache: Allow cancelled operations to be enqueued
authorKiran Kumar Modukuri <kiran.modukuri@gmail.com>
Wed, 25 Jul 2018 13:31:20 +0000 (14:31 +0100)
committerDavid Howells <dhowells@redhat.com>
Wed, 25 Jul 2018 13:31:20 +0000 (14:31 +0100)
Alter the state-check assertion in fscache_enqueue_operation() to allow
cancelled operations to be given processing time so they can be cleaned up.

Also fix a debugging statement that was requiring such operations to have
an object assigned.

Fixes: 9ae326a69004 ("CacheFiles: A cache that backs onto a mounted filesystem")
Reported-by: Kiran Kumar Modukuri <kiran.modukuri@gmail.com>
Signed-off-by: David Howells <dhowells@redhat.com>
fs/fscache/operation.c

index e30c5975ea585e73dd70dcba892c295e3d78e68a..8d265790374cdac651ff3c6c9920d8c9467b7441 100644 (file)
@@ -70,7 +70,8 @@ void fscache_enqueue_operation(struct fscache_operation *op)
        ASSERT(op->processor != NULL);
        ASSERT(fscache_object_is_available(op->object));
        ASSERTCMP(atomic_read(&op->usage), >, 0);
-       ASSERTCMP(op->state, ==, FSCACHE_OP_ST_IN_PROGRESS);
+       ASSERTIFCMP(op->state != FSCACHE_OP_ST_IN_PROGRESS,
+                   op->state, ==,  FSCACHE_OP_ST_CANCELLED);
 
        fscache_stat(&fscache_n_op_enqueue);
        switch (op->flags & FSCACHE_OP_TYPE) {
@@ -499,7 +500,8 @@ void fscache_put_operation(struct fscache_operation *op)
        struct fscache_cache *cache;
 
        _enter("{OBJ%x OP%x,%d}",
-              op->object->debug_id, op->debug_id, atomic_read(&op->usage));
+              op->object ? op->object->debug_id : 0,
+              op->debug_id, atomic_read(&op->usage));
 
        ASSERTCMP(atomic_read(&op->usage), >, 0);