RE: [PATCH V4 4/8] Cleancache: VFS hooks for cleancache

From: Dan Magenheimer
Date: Mon Aug 30 2010 - 20:51:16 EST


> > + if (s->cleancache_poolid >= 0) {
> > + int cleancache_poolid = s->cleancache_poolid;
>
> That's a lot of characters for a local in a 3-line scope.

:-) OK.

> > + s->cleancache_poolid = -1; /* avoid races */
>
> Races with what? Something else sneaking something into the pool after
> the flush? Is the filesystem dead at this stage or not?

If there are any inodes in the page cache that point to
this superblock, a cleancache_put_page may happen asynchronously
that grabs from page->...->i_sb->cleancache_poolid.
If the cleancache_flush_fs races with it and another
cleancache_init_fs happens after the cleancache_put_page
gets the poolid, the poolid could be stale.

Highly unlikely, but I thought it best to be safe.

> > + /* 99% of the time, we don't need to flush the cleancache on the
> bdev.
> > + * But, for the strange corners, lets be cautious
> > + */
>
> This comment-style is... unconventional for the kernel.

Yeah, I decided to defer to Chris Mason's wisdom and left it. :-)

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/