On Tue, 2013-07-09 at 11:33 +0100, David Howells wrote:
> Milosz Tanski <[email protected]> wrote:
> 
> > It looks like both the cifs and NFS code do not bother with any
> > locking around cifs_fscache_set_inode_cookie. Is there no concern over
> > multiple open() calls racing to create the cookie in those
> > filesystems?
> 
> Yeah...  That's probably wrong.  AFS obviates the need for special locking by
> doing it in afs_iget().
> 
> Hmmm...  I think I've just spotted what might be the cause of pages getting
> marked PG_fscache whilst belonging to the allocator.
> 
>       void nfs_fscache_set_inode_cookie(struct inode *inode, struct file 
> *filp)
>       {
>               if (NFS_FSCACHE(inode)) {
>                       nfs_fscache_inode_lock(inode);
>                       if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
>                               nfs_fscache_disable_inode_cookie(inode);
>                       else
>                               nfs_fscache_enable_inode_cookie(inode);
>                       nfs_fscache_inode_unlock(inode);
>               }
>       }
> 
> can release the cookie whilst reads are in progress on it when an inode being
> read suddenly changes to an inode being written.  We need some sort of
> synchronisation on that there.

Change fscache_uncache_all_inode_pages to always take the page lock,
check the value of page->mapping, and wait for outstanding writes to
finish before trying to release PG_fscache?

-- 
Trond Myklebust
Linux NFS client maintainer

NetApp
[email protected]
www.netapp.com
N�����r��y����b�X��ǧv�^�)޺{.n�+���z�]z���{ay�ʇڙ�,j��f���h���z��w���
���j:+v���w�j�m��������zZ+�����ݢj"��!�i

Reply via email to