Skip to content

Commit a333e4b

Browse files
sashalevinericvh
authored andcommitted
fs/9p: use fscache mutex rather than spinlock
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>
1 parent 3053600 commit a333e4b

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

fs/9p/cache.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -243,14 +243,14 @@ void v9fs_cache_inode_set_cookie(struct inode *inode, struct file *filp)
243243
if (!v9inode->fscache)
244244
return;
245245

246-
spin_lock(&v9inode->fscache_lock);
246+
mutex_lock(&v9inode->fscache_lock);
247247

248248
if ((filp->f_flags & O_ACCMODE) != O_RDONLY)
249249
v9fs_cache_inode_flush_cookie(inode);
250250
else
251251
v9fs_cache_inode_get_cookie(inode);
252252

253-
spin_unlock(&v9inode->fscache_lock);
253+
mutex_unlock(&v9inode->fscache_lock);
254254
}
255255

256256
void v9fs_cache_inode_reset_cookie(struct inode *inode)
@@ -264,7 +264,7 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
264264

265265
old = v9inode->fscache;
266266

267-
spin_lock(&v9inode->fscache_lock);
267+
mutex_lock(&v9inode->fscache_lock);
268268
fscache_relinquish_cookie(v9inode->fscache, 1);
269269

270270
v9ses = v9fs_inode2v9ses(inode);
@@ -274,7 +274,7 @@ void v9fs_cache_inode_reset_cookie(struct inode *inode)
274274
p9_debug(P9_DEBUG_FSC, "inode %p revalidating cookie old %p new %p\n",
275275
inode, old, v9inode->fscache);
276276

277-
spin_unlock(&v9inode->fscache_lock);
277+
mutex_unlock(&v9inode->fscache_lock);
278278
}
279279

280280
int __v9fs_fscache_release_page(struct page *page, gfp_t gfp)

fs/9p/v9fs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ struct v9fs_session_info {
123123

124124
struct v9fs_inode {
125125
#ifdef CONFIG_9P_FSCACHE
126-
spinlock_t fscache_lock;
126+
struct mutex fscache_lock;
127127
struct fscache_cookie *fscache;
128128
#endif
129129
struct p9_qid qid;

fs/9p/vfs_inode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ struct inode *v9fs_alloc_inode(struct super_block *sb)
244244
return NULL;
245245
#ifdef CONFIG_9P_FSCACHE
246246
v9inode->fscache = NULL;
247-
spin_lock_init(&v9inode->fscache_lock);
247+
mutex_init(&v9inode->fscache_lock);
248248
#endif
249249
v9inode->writeback_fid = NULL;
250250
v9inode->cache_validity = 0;

0 commit comments

Comments
 (0)