From: David Howells <dhowells@redhat.com>
To: Hongyi Jia <jiayisuse@gmail.com>, milosz@adfin.com
Cc: dhowells@redhat.com, ceph-devel@vger.kernel.org,
sage@inktank.com, zheng.z.yan@intel.com,
linux-cachefs@redhat.com, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/5] new fscache interface to check cache consistency
Date: Wed, 04 Sep 2013 17:24:03 +0100 [thread overview]
Message-ID: <18832.1378311843@warthog.procyon.org.uk> (raw)
In-Reply-To: <306cbe63f85921ad40b00e3c7071be19cb6adf04.1375999914.git.milosz@adfin.com>
Hongyi Jia <jiayisuse@gmail.com> wrote:
> +bool __fscache_check_consistency(struct fscache_cookie *cookie)
> +{
> + struct fscache_object *object;
> +
> + if (cookie->def->type != FSCACHE_COOKIE_TYPE_DATAFILE)
> + return false;
> +
> + if (hlist_empty(&cookie->backing_objects))
> + return false;
> +
> + object = hlist_entry(cookie->backing_objects.first,
> + struct fscache_object, cookie_link);
> +
> + return object->cache->ops->check_consistency(object);
> +}
Hmmm... This isn't actually safe. You have to either:
(1) hold cookie->lock whilst touching the object pointer when coming from the
netfs side, or:
(2) set up an operation to do this (as, say, __fscache_alloc_page() does).
The problem is that you have nothing to defend against the object being
withdrawn by the cache under you.
David
next prev parent reply other threads:[~2013-09-04 16:24 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-21 21:26 [PATCHv4 0/5] ceph: persistent caching with fscache Milosz Tanski
2013-08-21 21:29 ` [PATCH 1/5] new cachefiles interface to check cache consistency Hongyi Jia
2013-08-21 21:29 ` [PATCH 2/5] new fscache " Hongyi Jia
2013-08-21 21:29 ` [PATCH 3/5] ceph: use fscache as a local presisent cache Milosz Tanski
2013-08-27 1:05 ` Sage Weil
2013-08-21 21:30 ` [PATCH 4/5] fscache: netfs function for cleanup post readpages Milosz Tanski
2013-09-03 17:24 ` Milosz Tanski
2013-08-21 21:30 ` [PATCH 5/5] ceph: clean PgPrivate2 on returning from readpages Milosz Tanski
2013-08-22 5:05 ` [PATCHv4 0/5] ceph: persistent caching with fscache Sage Weil
2013-08-22 12:58 ` Milosz Tanski
2013-09-04 15:49 ` David Howells
2013-09-04 15:54 ` Sage Weil
2013-09-04 16:25 ` Sage Weil
2013-09-05 12:34 ` David Howells
2013-09-04 16:24 ` David Howells [this message]
2013-09-04 16:48 ` [PATCH 2/5] new fscache interface to check cache consistency Milosz Tanski
2013-09-04 17:26 ` David Howells
2013-09-04 18:04 ` Milosz Tanski
2013-09-04 18:13 ` David Howells
2013-09-04 19:41 ` Milosz Tanski
2013-09-04 22:02 ` Milosz Tanski
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=18832.1378311843@warthog.procyon.org.uk \
--to=dhowells@redhat.com \
--cc=ceph-devel@vger.kernel.org \
--cc=jiayisuse@gmail.com \
--cc=linux-cachefs@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=milosz@adfin.com \
--cc=sage@inktank.com \
--cc=zheng.z.yan@intel.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
all inboxes | Powered by JetHome®