diff --git a/[refs] b/[refs] index 32ddb78e6b3c..b0f2afe361fc 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 9c04caa81b876faee5f1cc6eaad76dd7021ab8ff +refs/heads/master: 7ef001e937e8b9cbedb2fc1c31dd681ac3b31927 diff --git a/trunk/fs/fscache/page.c b/trunk/fs/fscache/page.c index 5b5d9081c8b2..ef0218f5080d 100644 --- a/trunk/fs/fscache/page.c +++ b/trunk/fs/fscache/page.c @@ -699,9 +699,27 @@ static void fscache_write_op(struct fscache_operation *_op) spin_lock(&object->lock); cookie = object->cookie; - if (!fscache_object_is_active(object) || !cookie) { + if (!fscache_object_is_active(object)) { + /* If we get here, then the on-disk cache object likely longer + * exists, so we should just cancel this write operation. + */ spin_unlock(&object->lock); - _leave(""); + op->op.state = FSCACHE_OP_ST_CANCELLED; + _leave(" [inactive]"); + return; + } + + if (!cookie) { + /* If we get here, then the cookie belonging to the object was + * detached, probably by the cookie being withdrawn due to + * memory pressure, which means that the pages we might write + * to the cache from no longer exist - therefore, we can just + * cancel this write operation. + */ + spin_unlock(&object->lock); + op->op.state = FSCACHE_OP_ST_CANCELLED; + _leave(" [cancel] op{f=%lx s=%u} obj{s=%u f=%lx}", + _op->flags, _op->state, object->state, object->flags); return; }