Commit 7e29b17b authored by Sasha Levin's avatar Sasha Levin Committed by Kleber Sacilotto de Souza

fs/9p: use fscache mutex rather than spinlock

BugLink: https://bugs.launchpad.net/bugs/1822271

commit 8f5fed1e upstream.

We may sleep inside a the lock, so use a mutex rather than spinlock.
Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Cc: Emil Karlson <jkarlson@tuxera.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarJuerg Haefliger <juerg.haefliger@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent 4030a98d
...@@ -243,14 +243,14 @@ void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp) ...@@ -243,14 +243,14 @@ void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp)
if (!v9inode->fscache) if (!v9inode->fscache)
return; return;
spin_lock(&v9inode->fscache_lock); mutex_lock(&v9inode->fscache_lock);
if ((filp->f_flags & O_ACCMODE) != O_RDONLY) if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
v9fs_cache_inode_flush_cookie(inode); v9fs_cache_inode_flush_cookie(inode);
else else
v9fs_cache_inode_get_cookie(inode); 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) void v9fs_cache_inode_reset_cookie(struct inode *inode)
...@@ -264,7 +264,7 @@ 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; old = v9inode->fscache;
spin_lock(&v9inode->fscache_lock); mutex_lock(&v9inode->fscache_lock);
fscache_relinquish_cookie(v9inode->fscache, 1); fscache_relinquish_cookie(v9inode->fscache, 1);
v9ses = v9fs_inode2v9ses(inode); v9ses = v9fs_inode2v9ses(inode);
...@@ -274,7 +274,7 @@ void v9fs_cache_inode_reset_cookie(struct inode *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", p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
inode, old, v9inode->fscache); 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) int __v9fs_fscache_release_page(struct page *page, gfp_t gfp)
......
...@@ -123,7 +123,7 @@ struct v9fs_session_info { ...@@ -123,7 +123,7 @@ struct v9fs_session_info {
struct v9fs_inode { struct v9fs_inode {
#ifdef CONFIG_9P_FSCACHE #ifdef CONFIG_9P_FSCACHE
spinlock_t fscache_lock; struct mutex fscache_lock;
struct fscache_cookie *fscache; struct fscache_cookie *fscache;
#endif #endif
struct p9_qid qid; struct p9_qid qid;
......
...@@ -244,7 +244,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb) ...@@ -244,7 +244,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb)
return NULL; return NULL;
#ifdef CONFIG_9P_FSCACHE #ifdef CONFIG_9P_FSCACHE
v9inode->fscache = NULL; v9inode->fscache = NULL;
spin_lock_init(&v9inode->fscache_lock); mutex_init(&v9inode->fscache_lock);
#endif #endif
v9inode->writeback_fid = NULL; v9inode->writeback_fid = NULL;
v9inode->cache_validity = 0; v9inode->cache_validity = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment