[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANP1eJFKGD_h6rcWMWpxp3yOD+rz6p2P0B+2CTcy1taDwM9rdg@mail.gmail.com>
Date: Wed, 4 Sep 2013 12:48:44 -0400
From: Milosz Tanski <milosz@...in.com>
To: David Howells <dhowells@...hat.com>
Cc: Hongyi Jia <jiayisuse@...il.com>,
ceph-devel <ceph-devel@...r.kernel.org>,
Sage Weil <sage@...tank.com>,
"Yan, Zheng" <zheng.z.yan@...el.com>,
"linux-cachefs@...hat.com" <linux-cachefs@...hat.com>,
"linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 2/5] new fscache interface to check cache consistency
David,
If the cache is withdrawn and we're starting anew I would consider
that to okay. I would consider an empty page cache for a cookie to be
consistent since there's nothing stale that I can read. Unless there's
another synchronization issue that I'm missing in fscache.
Thanks,
- Milosz
On Wed, Sep 4, 2013 at 12:24 PM, David Howells <dhowells@...hat.com> wrote:
> Hongyi Jia <jiayisuse@...il.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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists