aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/inode.c
diff options
context:
space:
mode:
authorYan, Zheng <zheng.z.yan@intel.com>2013-07-21 08:25:26 -0400
committerSage Weil <sage@inktank.com>2013-08-09 20:54:33 -0400
commit85ce127a9adf5ab9e9d57ddf64c858927d5e546d (patch)
tree81d6d0bc74477cfafa5e249a7d96dee558f3a428 /fs/ceph/inode.c
parentad88f23f42a9b34a0b29a5b19d37251ccb7dd776 (diff)
ceph: wake up writer if vmtruncate work get blocked
To write data, the writer first acquires the i_mutex, then try getting caps. The writer may sleep while holding the i_mutex. If the MDS revokes Fb cap in this case, vmtruncate work can't do its job because i_mutex is locked. We should wake up the writer and let it truncate the pages. Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com> Reviewed-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'fs/ceph/inode.c')
-rw-r--r--fs/ceph/inode.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index 4906ada4a97c..55aaddb4047e 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1465,7 +1465,14 @@ static void ceph_vmtruncate_work(struct work_struct *work)
1465 struct inode *inode = &ci->vfs_inode; 1465 struct inode *inode = &ci->vfs_inode;
1466 1466
1467 dout("vmtruncate_work %p\n", inode); 1467 dout("vmtruncate_work %p\n", inode);
1468 mutex_lock(&inode->i_mutex); 1468 if (!mutex_trylock(&inode->i_mutex)) {
1469 /*
1470 * the i_mutex can be hold by a writer who is waiting for
1471 * caps. wake up waiters, they will do pending vmtruncate.
1472 */
1473 wake_up_all(&ci->i_cap_wq);
1474 mutex_lock(&inode->i_mutex);
1475 }
1469 __ceph_do_pending_vmtruncate(inode); 1476 __ceph_do_pending_vmtruncate(inode);
1470 mutex_unlock(&inode->i_mutex); 1477 mutex_unlock(&inode->i_mutex);
1471 iput(inode); 1478 iput(inode);