[Ocfs2-devel] [PATCH V4 4/8] Cleancache: VFS hooks for cleancache

Dan Magenheimer dan.magenheimer at oracle.com
Mon Aug 30 17:48:17 PDT 2010


> > +		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. :-)




More information about the Ocfs2-devel mailing list