[Linux-cachefs] [PATCH] ceph: Add FScache support

David Howells dhowells at redhat.com
Tue Jul 9 10:33:44 UTC 2013


Milosz Tanski <milosz at adfin.com> 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.

David




More information about the Linux-cachefs mailing list