Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6515d1db authored by David Howells's avatar David Howells
Browse files

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: default avatarDavid Howells <dhowells@redhat.com>
Reviewed-by: default avatarSteve Dickson <steved@redhat.com>
Acked-by: default avatarJeff Layton <jeff.layton@primarydata.com>
parent 30ceec62
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -610,6 +610,8 @@ static const struct fscache_state *fscache_lookup_failure(struct fscache_object
	object->cache->ops->lookup_complete(object);
	object->cache->ops->lookup_complete(object);
	fscache_stat_d(&fscache_n_cop_lookup_complete);
	fscache_stat_d(&fscache_n_cop_lookup_complete);


	set_bit(FSCACHE_OBJECT_KILLED_BY_CACHE, &object->flags);

	cookie = object->cookie;
	cookie = object->cookie;
	set_bit(FSCACHE_COOKIE_UNAVAILABLE, &cookie->flags);
	set_bit(FSCACHE_COOKIE_UNAVAILABLE, &cookie->flags);
	if (test_and_clear_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags))
	if (test_and_clear_bit(FSCACHE_COOKIE_LOOKING_UP, &cookie->flags))
+6 −0
Original line number Original line Diff line number Diff line
@@ -176,6 +176,9 @@ int fscache_submit_exclusive_op(struct fscache_object *object,
		list_add_tail(&op->pend_link, &object->pending_ops);
		list_add_tail(&op->pend_link, &object->pending_ops);
		fscache_stat(&fscache_n_op_pend);
		fscache_stat(&fscache_n_op_pend);
		ret = 0;
		ret = 0;
	} else if (flags & BIT(FSCACHE_OBJECT_KILLED_BY_CACHE)) {
		op->state = FSCACHE_OP_ST_CANCELLED;
		ret = -ENOBUFS;
	} else {
	} else {
		fscache_report_unexpected_submission(object, op, ostate);
		fscache_report_unexpected_submission(object, op, ostate);
		op->state = FSCACHE_OP_ST_CANCELLED;
		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);
		list_add_tail(&op->pend_link, &object->pending_ops);
		fscache_stat(&fscache_n_op_pend);
		fscache_stat(&fscache_n_op_pend);
		ret = 0;
		ret = 0;
	} else if (flags & BIT(FSCACHE_OBJECT_KILLED_BY_CACHE)) {
		op->state = FSCACHE_OP_ST_CANCELLED;
		ret = -ENOBUFS;
	} else {
	} else {
		fscache_report_unexpected_submission(object, op, ostate);
		fscache_report_unexpected_submission(object, op, ostate);
		ASSERT(!fscache_object_is_active(object));
		ASSERT(!fscache_object_is_active(object));