diff options
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r-- | fs/ceph/inode.c | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index f3a2abf28a7..98b6e50bde0 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -61,6 +61,14 @@ struct inode *ceph_get_inode(struct super_block *sb, struct ceph_vino vino) return inode; } +struct inode *ceph_lookup_inode(struct super_block *sb, struct ceph_vino vino) +{ + struct inode *inode; + ino_t t = ceph_vino_to_ino(vino); + inode = ilookup5_nowait(sb, t, ceph_ino_compare, &vino); + return inode; +} + /* * get/constuct snapdir inode for a given directory */ @@ -1465,7 +1473,14 @@ static void ceph_vmtruncate_work(struct work_struct *work) struct inode *inode = &ci->vfs_inode; dout("vmtruncate_work %p\n", inode); - mutex_lock(&inode->i_mutex); + if (!mutex_trylock(&inode->i_mutex)) { + /* + * the i_mutex can be hold by a writer who is waiting for + * caps. wake up waiters, they will do pending vmtruncate. + */ + wake_up_all(&ci->i_cap_wq); + mutex_lock(&inode->i_mutex); + } __ceph_do_pending_vmtruncate(inode); mutex_unlock(&inode->i_mutex); iput(inode); |