* [PATCH] fs/9p: use fscache mutex rather than spinlock
@ 2015-11-09 21:06 Sasha Levin
2016-01-07 22:49 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Sasha Levin @ 2015-11-09 21:06 UTC (permalink / raw)
To: ericvh, rminnich, lucho; +Cc: v9fs-developer, linux-kernel, Sasha Levin
We may sleep inside a the lock, so use a mutex rather than spinlock.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
---
fs/9p/cache.c | 8 ++++----
fs/9p/v9fs.h | 2 +-
fs/9p/vfs_inode.c | 2 +-
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/fs/9p/cache.c b/fs/9p/cache.c
index a69260f..103ca5e 100644
--- a/fs/9p/cache.c
+++ b/fs/9p/cache.c
@@ -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)
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
index 0923f2c..6877050 100644
--- a/fs/9p/v9fs.h
+++ b/fs/9p/v9fs.h
@@ -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;
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index 699941e..b0358db 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -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;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] fs/9p: use fscache mutex rather than spinlock
2015-11-09 21:06 [PATCH] fs/9p: use fscache mutex rather than spinlock Sasha Levin
@ 2016-01-07 22:49 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2016-01-07 22:49 UTC (permalink / raw)
To: ericvh, rminnich, lucho; +Cc: v9fs-developer, linux-kernel, Al Viro
Ping?
On 11/09/2015 04:06 PM, Sasha Levin wrote:
> We may sleep inside a the lock, so use a mutex rather than spinlock.
>
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> ---
> fs/9p/cache.c | 8 ++++----
> fs/9p/v9fs.h | 2 +-
> fs/9p/vfs_inode.c | 2 +-
> 3 files changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/fs/9p/cache.c b/fs/9p/cache.c
> index a69260f..103ca5e 100644
> --- a/fs/9p/cache.c
> +++ b/fs/9p/cache.c
> @@ -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)
> diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h
> index 0923f2c..6877050 100644
> --- a/fs/9p/v9fs.h
> +++ b/fs/9p/v9fs.h
> @@ -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;
> diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
> index 699941e..b0358db 100644
> --- a/fs/9p/vfs_inode.c
> +++ b/fs/9p/vfs_inode.c
> @@ -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;
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2016-01-07 22:50 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-11-09 21:06 [PATCH] fs/9p: use fscache mutex rather than spinlock Sasha Levin
2016-01-07 22:49 ` Sasha Levin
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.