Re: [PATCH 2/5] new fscache interface to check cache consistency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hongyi Jia <jiayisuse@xxxxxxxxx> 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-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux