]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - fs/fscache/object.c
Merge tag 'armsoc-dt64' of git://git.kernel.org/pub/scm/linux/kernel/git/arm/arm-soc
[karo-tx-linux.git] / fs / fscache / object.c
index 9b79fc9a1464a1522d45a203bcfc7f10261ea62a..9e792e30f4db47b38c6db644487c440a2e12febb 100644 (file)
@@ -327,6 +327,17 @@ void fscache_object_init(struct fscache_object *object,
 }
 EXPORT_SYMBOL(fscache_object_init);
 
+/*
+ * Mark the object as no longer being live, making sure that we synchronise
+ * against op submission.
+ */
+static inline void fscache_mark_object_dead(struct fscache_object *object)
+{
+       spin_lock(&object->lock);
+       clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags);
+       spin_unlock(&object->lock);
+}
+
 /*
  * Abort object initialisation before we start it.
  */
@@ -631,7 +642,7 @@ static const struct fscache_state *fscache_kill_object(struct fscache_object *ob
        _enter("{OBJ%x,%d,%d},%d",
               object->debug_id, object->n_ops, object->n_children, event);
 
-       clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags);
+       fscache_mark_object_dead(object);
        object->oob_event_mask = 0;
 
        if (list_empty(&object->dependents) &&
@@ -950,7 +961,8 @@ static const struct fscache_state *_fscache_invalidate_object(struct fscache_obj
        if (!op)
                goto nomem;
 
-       fscache_operation_init(op, object->cache->ops->invalidate_object, NULL);
+       fscache_operation_init(op, object->cache->ops->invalidate_object,
+                              NULL, NULL);
        op->flags = FSCACHE_OP_ASYNC |
                (1 << FSCACHE_OP_EXCLUSIVE) |
                (1 << FSCACHE_OP_UNUSE_COOKIE);
@@ -976,13 +988,13 @@ static const struct fscache_state *_fscache_invalidate_object(struct fscache_obj
        return transit_to(UPDATE_OBJECT);
 
 nomem:
-       clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags);
+       fscache_mark_object_dead(object);
        fscache_unuse_cookie(object);
        _leave(" [ENOMEM]");
        return transit_to(KILL_OBJECT);
 
 submit_op_failed:
-       clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags);
+       fscache_mark_object_dead(object);
        spin_unlock(&cookie->lock);
        fscache_unuse_cookie(object);
        kfree(op);