diff options
author | David Howells <dhowells@redhat.com> | 2012-12-20 16:52:35 -0500 |
---|---|---|
committer | David Howells <dhowells@redhat.com> | 2012-12-20 16:58:25 -0500 |
commit | ef46ed888efb1e8da33be5d33c9b54476289a43b (patch) | |
tree | d538dc01a075162f95da416da1fb5d6fd676445a /fs/fscache/operation.c | |
parent | 37491a1339df26259b06dfa33f30e574e9e52034 (diff) |
FS-Cache: Make cookie relinquishment wait for outstanding reads
Make fscache_relinquish_cookie() log a warning and wait if there are any
outstanding reads left on the cookie it was given.
Signed-off-by: David Howells <dhowells@redhat.com>
Diffstat (limited to 'fs/fscache/operation.c')
-rw-r--r-- | fs/fscache/operation.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c index 30afdfa7aec7..c857ab824d6e 100644 --- a/fs/fscache/operation.c +++ b/fs/fscache/operation.c | |||
@@ -340,8 +340,14 @@ void fscache_put_operation(struct fscache_operation *op) | |||
340 | 340 | ||
341 | object = op->object; | 341 | object = op->object; |
342 | 342 | ||
343 | if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) | 343 | if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) { |
344 | atomic_dec(&object->n_reads); | 344 | if (atomic_dec_and_test(&object->n_reads)) { |
345 | clear_bit(FSCACHE_COOKIE_WAITING_ON_READS, | ||
346 | &object->cookie->flags); | ||
347 | wake_up_bit(&object->cookie->flags, | ||
348 | FSCACHE_COOKIE_WAITING_ON_READS); | ||
349 | } | ||
350 | } | ||
345 | 351 | ||
346 | /* now... we may get called with the object spinlock held, so we | 352 | /* now... we may get called with the object spinlock held, so we |
347 | * complete the cleanup here only if we can immediately acquire the | 353 | * complete the cleanup here only if we can immediately acquire the |