diff options
Diffstat (limited to 'drivers/md/bcache/closure.c')
| -rw-r--r-- | drivers/md/bcache/closure.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/md/bcache/closure.c b/drivers/md/bcache/closure.c index bd05a9a8c7cf..9aba2017f0d1 100644 --- a/drivers/md/bcache/closure.c +++ b/drivers/md/bcache/closure.c | |||
| @@ -66,16 +66,18 @@ static inline void closure_put_after_sub(struct closure *cl, int flags) | |||
| 66 | } else { | 66 | } else { |
| 67 | struct closure *parent = cl->parent; | 67 | struct closure *parent = cl->parent; |
| 68 | struct closure_waitlist *wait = closure_waitlist(cl); | 68 | struct closure_waitlist *wait = closure_waitlist(cl); |
| 69 | closure_fn *destructor = cl->fn; | ||
| 69 | 70 | ||
| 70 | closure_debug_destroy(cl); | 71 | closure_debug_destroy(cl); |
| 71 | 72 | ||
| 73 | smp_mb(); | ||
| 72 | atomic_set(&cl->remaining, -1); | 74 | atomic_set(&cl->remaining, -1); |
| 73 | 75 | ||
| 74 | if (wait) | 76 | if (wait) |
| 75 | closure_wake_up(wait); | 77 | closure_wake_up(wait); |
| 76 | 78 | ||
| 77 | if (cl->fn) | 79 | if (destructor) |
| 78 | cl->fn(cl); | 80 | destructor(cl); |
| 79 | 81 | ||
| 80 | if (parent) | 82 | if (parent) |
| 81 | closure_put(parent); | 83 | closure_put(parent); |
