summaryrefslogtreecommitdiffstats
path: root/fs/fscache/operation.c
diff options
context:
space:
mode:
authorDavid Howells <dhowells@redhat.com>2015-02-25 12:53:57 +0100
committerDavid Howells <dhowells@redhat.com>2015-04-02 15:28:53 +0200
commit6515d1dbf424c5c3b94d44e9c7f581026e7fc0d3 (patch)
treef36db7b4a6e91ff358926ddfdb28fba8349620cf /fs/fscache/operation.c
parentFS-Cache: When submitting an op, cancel it if the target object is dying (diff)
downloadlinux-6515d1dbf424c5c3b94d44e9c7f581026e7fc0d3.tar.xz
linux-6515d1dbf424c5c3b94d44e9c7f581026e7fc0d3.zip
FS-Cache: Handle a new operation submitted against a killed object
Reject new operations that are being submitted against an object if that object has failed its lookup or creation states or has been killed by the cache backend for some other reason, such as having been culled. Signed-off-by: David Howells <dhowells@redhat.com> Reviewed-by: Steve Dickson <steved@redhat.com> Acked-by: Jeff Layton <jeff.layton@primarydata.com>
Diffstat (limited to 'fs/fscache/operation.c')
-rw-r--r--fs/fscache/operation.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/fscache/operation.c b/fs/fscache/operation.c
index dec6defe3be3..18658fffbba1 100644
--- a/fs/fscache/operation.c
+++ b/fs/fscache/operation.c
@@ -176,6 +176,9 @@ int fscache_submit_exclusive_op(struct fscache_object *object,
list_add_tail(&op->pend_link, &object->pending_ops);
fscache_stat(&fscache_n_op_pend);
ret = 0;
+ } else if (flags & BIT(FSCACHE_OBJECT_KILLED_BY_CACHE)) {
+ op->state = FSCACHE_OP_ST_CANCELLED;
+ ret = -ENOBUFS;
} else {
fscache_report_unexpected_submission(object, op, ostate);
op->state = FSCACHE_OP_ST_CANCELLED;
@@ -249,6 +252,9 @@ int fscache_submit_op(struct fscache_object *object,
list_add_tail(&op->pend_link, &object->pending_ops);
fscache_stat(&fscache_n_op_pend);
ret = 0;
+ } else if (flags & BIT(FSCACHE_OBJECT_KILLED_BY_CACHE)) {
+ op->state = FSCACHE_OP_ST_CANCELLED;
+ ret = -ENOBUFS;
} else {
fscache_report_unexpected_submission(object, op, ostate);
ASSERT(!fscache_object_is_active(object));