diff options
-rw-r--r-- | fs/fscache/object.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/fscache/object.c b/fs/fscache/object.c index 9b79fc9a1464..40049f7505f0 100644 --- a/fs/fscache/object.c +++ b/fs/fscache/object.c | |||
@@ -328,6 +328,17 @@ void fscache_object_init(struct fscache_object *object, | |||
328 | EXPORT_SYMBOL(fscache_object_init); | 328 | EXPORT_SYMBOL(fscache_object_init); |
329 | 329 | ||
330 | /* | 330 | /* |
331 | * Mark the object as no longer being live, making sure that we synchronise | ||
332 | * against op submission. | ||
333 | */ | ||
334 | static inline void fscache_mark_object_dead(struct fscache_object *object) | ||
335 | { | ||
336 | spin_lock(&object->lock); | ||
337 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); | ||
338 | spin_unlock(&object->lock); | ||
339 | } | ||
340 | |||
341 | /* | ||
331 | * Abort object initialisation before we start it. | 342 | * Abort object initialisation before we start it. |
332 | */ | 343 | */ |
333 | static const struct fscache_state *fscache_abort_initialisation(struct fscache_object *object, | 344 | static const struct fscache_state *fscache_abort_initialisation(struct fscache_object *object, |
@@ -631,7 +642,7 @@ static const struct fscache_state *fscache_kill_object(struct fscache_object *ob | |||
631 | _enter("{OBJ%x,%d,%d},%d", | 642 | _enter("{OBJ%x,%d,%d},%d", |
632 | object->debug_id, object->n_ops, object->n_children, event); | 643 | object->debug_id, object->n_ops, object->n_children, event); |
633 | 644 | ||
634 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); | 645 | fscache_mark_object_dead(object); |
635 | object->oob_event_mask = 0; | 646 | object->oob_event_mask = 0; |
636 | 647 | ||
637 | if (list_empty(&object->dependents) && | 648 | if (list_empty(&object->dependents) && |
@@ -976,13 +987,13 @@ static const struct fscache_state *_fscache_invalidate_object(struct fscache_obj | |||
976 | return transit_to(UPDATE_OBJECT); | 987 | return transit_to(UPDATE_OBJECT); |
977 | 988 | ||
978 | nomem: | 989 | nomem: |
979 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); | 990 | fscache_mark_object_dead(object); |
980 | fscache_unuse_cookie(object); | 991 | fscache_unuse_cookie(object); |
981 | _leave(" [ENOMEM]"); | 992 | _leave(" [ENOMEM]"); |
982 | return transit_to(KILL_OBJECT); | 993 | return transit_to(KILL_OBJECT); |
983 | 994 | ||
984 | submit_op_failed: | 995 | submit_op_failed: |
985 | clear_bit(FSCACHE_OBJECT_IS_LIVE, &object->flags); | 996 | fscache_mark_object_dead(object); |
986 | spin_unlock(&cookie->lock); | 997 | spin_unlock(&cookie->lock); |
987 | fscache_unuse_cookie(object); | 998 | fscache_unuse_cookie(object); |
988 | kfree(op); | 999 | kfree(op); |