Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347819
b: refs/heads/master
c: ef46ed8
h: refs/heads/master
i:
  347817: 8285f2d
  347815: 0bfcf03
v: v3
  • Loading branch information
David Howells committed Dec 20, 2012
1 parent 2b4d0ff commit 43948b5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 37491a1339df26259b06dfa33f30e574e9e52034
refs/heads/master: ef46ed888efb1e8da33be5d33c9b54476289a43b
18 changes: 14 additions & 4 deletions trunk/fs/fscache/cookie.c
Original file line number Diff line number Diff line change
Expand Up @@ -442,22 +442,32 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)

event = retire ? FSCACHE_OBJECT_EV_RETIRE : FSCACHE_OBJECT_EV_RELEASE;

try_again:
spin_lock(&cookie->lock);

/* break links with all the active objects */
while (!hlist_empty(&cookie->backing_objects)) {
int n_reads;
object = hlist_entry(cookie->backing_objects.first,
struct fscache_object,
cookie_link);

_debug("RELEASE OBJ%x", object->debug_id);

if (atomic_read(&object->n_reads)) {
set_bit(FSCACHE_COOKIE_WAITING_ON_READS, &cookie->flags);
n_reads = atomic_read(&object->n_reads);
if (n_reads) {
int n_ops = object->n_ops;
int n_in_progress = object->n_in_progress;
spin_unlock(&cookie->lock);
printk(KERN_ERR "FS-Cache:"
" Cookie '%s' still has %d outstanding reads\n",
cookie->def->name, atomic_read(&object->n_reads));
BUG();
" Cookie '%s' still has %d outstanding reads (%d,%d)\n",
cookie->def->name,
n_reads, n_ops, n_in_progress);
wait_on_bit(&cookie->flags, FSCACHE_COOKIE_WAITING_ON_READS,
fscache_wait_bit, TASK_UNINTERRUPTIBLE);
printk("Wait finished\n");
goto try_again;
}

/* detach each cache object from the object cookie */
Expand Down
10 changes: 8 additions & 2 deletions trunk/fs/fscache/operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,8 +340,14 @@ void fscache_put_operation(struct fscache_operation *op)

object = op->object;

if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags))
atomic_dec(&object->n_reads);
if (test_bit(FSCACHE_OP_DEC_READ_CNT, &op->flags)) {
if (atomic_dec_and_test(&object->n_reads)) {
clear_bit(FSCACHE_COOKIE_WAITING_ON_READS,
&object->cookie->flags);
wake_up_bit(&object->cookie->flags,
FSCACHE_COOKIE_WAITING_ON_READS);
}
}

/* now... we may get called with the object spinlock held, so we
* complete the cleanup here only if we can immediately acquire the
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/fscache-cache.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ struct fscache_cookie {
#define FSCACHE_COOKIE_PENDING_FILL 3 /* T if pending initial fill on object */
#define FSCACHE_COOKIE_FILLING 4 /* T if filling object incrementally */
#define FSCACHE_COOKIE_UNAVAILABLE 5 /* T if cookie is unavailable (error, etc) */
#define FSCACHE_COOKIE_WAITING_ON_READS 6 /* T if cookie is waiting on reads */
};

extern struct fscache_cookie fscache_fsdef_index;
Expand Down

0 comments on commit 43948b5

Please sign in to comment.