]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
FS-Cache: Fix cancellation of in-progress operation
authorDavid Howells <dhowells@redhat.com>
Wed, 25 Feb 2015 14:07:25 +0000 (14:07 +0000)
committerDavid Howells <dhowells@redhat.com>
Thu, 2 Apr 2015 13:28:53 +0000 (14:28 +0100)
Cancellation of an in-progress operation needs to update the relevant counters
and start any operations that are pending waiting on this one.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Steve Dickson <steved@redhat.com>
Acked-by: Jeff Layton <jeff.layton@primarydata.com>
fs/fscache/operation.c

index 9761df4fc2ab3ce87404dea97f8d1639ab90312c..b6bf5f399d70edbd3a9dcc651ee7f4ee01c2fd5b 100644 (file)
@@ -365,6 +365,13 @@ int fscache_cancel_op(struct fscache_operation *op,
                        wake_up_bit(&op->flags, FSCACHE_OP_WAITING);
                ret = 0;
        } else if (op->state == FSCACHE_OP_ST_IN_PROGRESS && cancel_in_progress_op) {
+               ASSERTCMP(object->n_in_progress, >, 0);
+               if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
+                       object->n_exclusive--;
+               object->n_in_progress--;
+               if (object->n_in_progress == 0)
+                       fscache_start_operations(object);
+
                fscache_stat(&fscache_n_op_cancelled);
                if (do_cancel)
                        do_cancel(op);