FS-Cache: Fix operation handling
authorAkshat Aranya <aranya@nec-labs.com>
Fri, 14 Jan 2011 16:00:47 +0000 (16:00 +0000)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 14 Jan 2011 17:23:36 +0000 (09:23 -0800)
fscache_submit_exclusive_op() adds an operation to the pending list if
other operations are pending.  Fix the check for pending ops as n_ops
must be greater than 0 at the point it is checked as it is incremented
immediately before under lock.

Signed-off-by: Akshat Aranya <aranya@nec-labs.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/fscache/operation.c

index b9f34eaede09a95a24723e0a0f79151065c03fb9..48a18f184d5041b9f4909137898fe0fd51bc45d8 100644 (file)
@@ -101,7 +101,7 @@ int fscache_submit_exclusive_op(struct fscache_object *object,
                object->n_ops++;
                object->n_exclusive++;  /* reads and writes must wait */
 
-               if (object->n_ops > 0) {
+               if (object->n_ops > 1) {
                        atomic_inc(&op->usage);
                        list_add_tail(&op->pend_link, &object->pending_ops);
                        fscache_stat(&fscache_n_op_pend);