Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 347837
b: refs/heads/master
c: 91c7fbb
h: refs/heads/master
i:
  347835: fad10d9
v: v3
  • Loading branch information
David Howells committed Dec 20, 2012
1 parent 0006687 commit d38ddf7
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 6 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: 1f372dff1da37e2b36ae9085368fa46896398598
refs/heads/master: 91c7fbbf63f33c77d8d28de624834a21888842bb
3 changes: 2 additions & 1 deletion trunk/fs/fscache/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,8 @@ extern int fscache_submit_exclusive_op(struct fscache_object *,
struct fscache_operation *);
extern int fscache_submit_op(struct fscache_object *,
struct fscache_operation *);
extern int fscache_cancel_op(struct fscache_operation *);
extern int fscache_cancel_op(struct fscache_operation *,
void (*)(struct fscache_operation *));
extern void fscache_cancel_all_ops(struct fscache_object *);
extern void fscache_abort_object(struct fscache_object *);
extern void fscache_start_operations(struct fscache_object *);
Expand Down
5 changes: 4 additions & 1 deletion trunk/fs/fscache/operation.c
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,8 @@ void fscache_start_operations(struct fscache_object *object)
/*
* cancel an operation that's pending on an object
*/
int fscache_cancel_op(struct fscache_operation *op)
int fscache_cancel_op(struct fscache_operation *op,
void (*do_cancel)(struct fscache_operation *))
{
struct fscache_object *object = op->object;
int ret;
Expand All @@ -316,6 +317,8 @@ int fscache_cancel_op(struct fscache_operation *op)
ASSERT(!list_empty(&op->pend_link));
fscache_stat(&fscache_n_op_cancelled);
list_del_init(&op->pend_link);
if (do_cancel)
do_cancel(op);
op->state = FSCACHE_OP_ST_CANCELLED;
if (test_bit(FSCACHE_OP_EXCLUSIVE, &op->flags))
object->n_exclusive--;
Expand Down
17 changes: 14 additions & 3 deletions trunk/fs/fscache/page.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ static int fscache_wait_for_deferred_lookup(struct fscache_cookie *cookie)
return 0;
}

/*
* Handle cancellation of a pending retrieval op
*/
static void fscache_do_cancel_retrieval(struct fscache_operation *_op)
{
struct fscache_retrieval *op =
container_of(_op, struct fscache_retrieval, op);

op->n_pages = 0;
}

/*
* wait for an object to become active (or dead)
*/
Expand All @@ -320,7 +331,7 @@ static int fscache_wait_for_retrieval_activation(struct fscache_object *object,
if (wait_on_bit(&op->op.flags, FSCACHE_OP_WAITING,
fscache_wait_bit_interruptible,
TASK_INTERRUPTIBLE) != 0) {
ret = fscache_cancel_op(&op->op);
ret = fscache_cancel_op(&op->op, fscache_do_cancel_retrieval);
if (ret == 0)
return -ERESTARTSYS;

Expand All @@ -338,8 +349,8 @@ static int fscache_wait_for_retrieval_activation(struct fscache_object *object,
return -ENOBUFS;
}
if (unlikely(fscache_object_is_dead(object))) {
pr_err("%s() = -ENOBUFS [obj dead %d]", __func__, op->op.state);
fscache_cancel_op(&op->op);
pr_err("%s() = -ENOBUFS [obj dead %d]\n", __func__, op->op.state);
fscache_cancel_op(&op->op, fscache_do_cancel_retrieval);
fscache_stat(stat_object_dead);
return -ENOBUFS;
}
Expand Down

0 comments on commit d38ddf7

Please sign in to comment.