From: David Howells <dhowells@redhat.com>
To: moseleymark@gmail.com, mark@pogo.org.uk, jlayton@redhat.com,
steved@redhat.com
Cc: linux-fsdevel@vger.kernel.org, linux-nfs@vger.kernel.org,
linux-cachefs@redhat.com
Subject: [PATCH 06/13] FS-Cache: Check cookie is still correct in __fscache_read_or_alloc_pages()
Date: Thu, 29 Sep 2011 15:46:48 +0100 [thread overview]
Message-ID: <20110929144648.5812.87254.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <20110929144536.5812.84405.stgit@warthog.procyon.org.uk>
Check the object's cookie pointer is still correct in
__fscache_read_or_alloc_pages(). This may change as a result of the cookie
being released by the netfs before we've finished reading from it.
Signed-off-by: David Howells <dhowells@redhat.com>
---
fs/fscache/page.c | 21 +++++++++++++++++++++
1 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/fs/fscache/page.c b/fs/fscache/page.c
index b8b62f4..aaed5cd 100644
--- a/fs/fscache/page.c
+++ b/fs/fscache/page.c
@@ -496,6 +496,7 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
if (fscache_submit_op(object, &op->op) < 0)
goto nobufs_unlock;
spin_unlock(&cookie->lock);
+ ASSERTCMP(object->cookie, ==, cookie);
fscache_stat(&fscache_n_retrieval_ops);
@@ -513,6 +514,26 @@ int __fscache_read_or_alloc_pages(struct fscache_cookie *cookie,
goto error;
/* ask the cache to honour the operation */
+ if (!object->cookie) {
+ static const char prefix[] = "fs-";
+ printk(KERN_ERR "%sobject: OBJ%x\n",
+ prefix, object->debug_id);
+ printk(KERN_ERR "%sobjstate=%s fl=%lx wbusy=%x ev=%lx[%lx]\n",
+ prefix, fscache_object_states[object->state],
+ object->flags, work_busy(&object->work),
+ object->events,
+ object->event_mask & FSCACHE_OBJECT_EVENTS_MASK);
+ printk(KERN_ERR "%sops=%u inp=%u exc=%u\n",
+ prefix, object->n_ops, object->n_in_progress,
+ object->n_exclusive);
+ printk(KERN_ERR "%sparent=%p\n",
+ prefix, object->parent);
+ printk(KERN_ERR "%scookie=%p [pr=%p nd=%p fl=%lx]\n",
+ prefix, object->cookie,
+ cookie->parent, cookie->netfs_data, cookie->flags);
+ }
+ ASSERTCMP(object->cookie, ==, cookie);
+
if (test_bit(FSCACHE_COOKIE_NO_DATA_YET, &object->cookie->flags)) {
fscache_stat(&fscache_n_cop_allocate_pages);
ret = object->cache->ops->allocate_pages(
next prev parent reply other threads:[~2011-09-29 14:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 14:45 [RFC][PATCH 00/13] Fix FS-Cache problems David Howells
2011-09-29 14:45 ` [PATCH 01/13] Noisefs: A predictable noise producing fs for testing things David Howells
2011-09-29 14:46 ` [PATCH 02/13] CacheFiles: Fix the marking of cached pages David Howells
2011-09-29 14:46 ` [PATCH 03/13] FS-Cache: Validate page mapping pointer value David Howells
2011-09-29 14:46 ` [PATCH 04/13] CacheFiles: Downgrade the requirements passed to the allocator David Howells
2011-09-29 14:46 ` [PATCH 05/13] FS-Cache: Check that there are no read ops when cookie relinquished David Howells
2011-09-29 14:46 ` David Howells [this message]
2011-09-29 14:47 ` [PATCH 07/13] CacheFiles: Make some debugging statements conditional David Howells
2011-09-29 14:47 ` [PATCH 08/13] FS-Cache: Make cookie relinquishment wait for outstanding reads David Howells
2011-09-29 14:47 ` [PATCH 09/13] FS-Cache: Fix operation state management and accounting David Howells
[not found] ` <20110929144536.5812.84405.stgit-S6HVgzuS8uM4Awkfq6JHfwNdhmdF6hFW@public.gmane.org>
2011-09-29 14:47 ` [PATCH 10/13] FS-Cache: Provide proper invalidation David Howells
2011-09-29 14:47 ` [PATCH 11/13] VFS: Make more complete truncate operation available to CacheFiles David Howells
2011-09-29 14:48 ` [PATCH 12/13] CacheFiles: Implement invalidation David Howells
2011-09-29 14:48 ` [PATCH 13/13] NFS: Use FS-Cache invalidation David Howells
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110929144648.5812.87254.stgit@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=jlayton@redhat.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=mark@pogo.org.uk \
--cc=moseleymark@gmail.com \
--cc=steved@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).