fs/9p: use fscache mutex rather than spinlock
authorSasha Levin <sasha.levin@oracle.com>
Mon, 9 Nov 2015 21:06:53 +0000 (16:06 -0500)
committerEric Van Hensbergen <ericvh@gmail.com>
Fri, 8 Jan 2016 16:34:17 +0000 (10:34 -0600)
We may sleep inside a the lock, so use a mutex rather than spinlock.

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
fs/9p/cache.c
fs/9p/v9fs.h
fs/9p/vfs_inode.c

index a69260f27555df85894618dc1647422971914dc4..103ca5e1267beb2229999e0711e50ba83f4c0abb 100644 (file)
@@ -243,14 +243,14 @@ void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp)
        if (!v9inode->fscache)
                return;
 
-       spin_lock(&v9inode->fscache_lock);
+       mutex_lock(&v9inode->fscache_lock);
 
        if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
                v9fs_cache_inode_flush_cookie(inode);
        else
                v9fs_cache_inode_get_cookie(inode);
 
-       spin_unlock(&v9inode->fscache_lock);
+       mutex_unlock(&v9inode->fscache_lock);
 }
 
 void v9fs_cache_inode_reset_cookie(struct inode *inode)
@@ -264,7 +264,7 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
 
        old = v9inode->fscache;
 
-       spin_lock(&v9inode->fscache_lock);
+       mutex_lock(&v9inode->fscache_lock);
        fscache_relinquish_cookie(v9inode->fscache, 1);
 
        v9ses = v9fs_inode2v9ses(inode);
@@ -274,7 +274,7 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
        p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
                 inode, old, v9inode->fscache);
 
-       spin_unlock(&v9inode->fscache_lock);
+       mutex_unlock(&v9inode->fscache_lock);
 }
 
 int __v9fs_fscache_release_page(struct page *page, gfp_t gfp)
index 0923f2cf3c80aa2fb95a7385276de6f497ea46fe..6877050384a1407d438576bd24a642dc7baf842d 100644 (file)
@@ -123,7 +123,7 @@ struct v9fs_session_info {
 
 struct v9fs_inode {
 #ifdef CONFIG_9P_FSCACHE
-       spinlock_t fscache_lock;
+       struct mutex fscache_lock;
        struct fscache_cookie *fscache;
 #endif
        struct p9_qid qid;
index 699941e906672b87eb1b5199f7966e29528e0116..b0358db2f47281d61bd4b403f17911e57ee3dece 100644 (file)
@@ -244,7 +244,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb)
                return NULL;
 #ifdef CONFIG_9P_FSCACHE
        v9inode->fscache = NULL;
-       spin_lock_init(&v9inode->fscache_lock);
+       mutex_init(&v9inode->fscache_lock);
 #endif
        v9inode->writeback_fid = NULL;
        v9inode->cache_validity = 0;