Re: [PATCH v2 62/67] nfs: Convert to new fscache volume/cookie API

From: David Howells
Date: Sat Dec 11 2021 - 08:38:04 EST


David Wysochanski <dwysocha@xxxxxxxxxx> wrote:

> > (4) fscache_enable/disable_cookie() have been removed.
> >
> > Call fscache_use_cookie() and fscache_unuse_cookie() when a file is
> > opened or closed to prevent a cache file from being culled and to keep
> > resources to hand that are needed to do I/O.
> >
> > Unuse the cookie when a file is opened for writing. This is gated by
> > the NFS_INO_FSCACHE flag on the nfs_inode.
> >
> > A better way might be to invalidate it with FSCACHE_INVAL_DIO_WRITE
> > which will keep it unused until all open files are closed.
> >
>
> It looks like the comment doesn't match what was actually done inside
> nfs_fscache_open_file(). Is the code right and the comment just out of date?

The comment is out of date. NFS_INO_FSCACHE isn't used now.

> I'm getting that kasan UAF firing periodically in this code path, and so it
> looks related to this change,though I don't have great info on it so far and
> it's hard to reproduce.

Can you copy the kasan UAF text into a reply?

David