From patchwork Fri Jan 4 11:34:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zheng" X-Patchwork-Id: 1932751 Return-Path: X-Original-To: patchwork-ceph-devel@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 683CC3FDDA for ; Fri, 4 Jan 2013 11:34:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754565Ab3ADLeh (ORCPT ); Fri, 4 Jan 2013 06:34:37 -0500 Received: from mga02.intel.com ([134.134.136.20]:48663 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754555Ab3ADLeh (ORCPT ); Fri, 4 Jan 2013 06:34:37 -0500 Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga101.jf.intel.com with ESMTP; 04 Jan 2013 03:34:36 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.84,409,1355126400"; d="scan'208";a="267278507" Received: from unknown (HELO zyan5-mobl.amr.corp.intel.com) ([10.255.14.107]) by orsmga002.jf.intel.com with ESMTP; 04 Jan 2013 03:34:35 -0800 From: "Yan, Zheng" To: ceph-devel@vger.kernel.org, sage@inktank.com Cc: "Yan, Zheng" Subject: [PATCH 6/6] ceph: don't acquire i_mutex ceph_vmtruncate_work Date: Fri, 4 Jan 2013 19:34:21 +0800 Message-Id: <1357299261-20591-7-git-send-email-zheng.z.yan@intel.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1357299261-20591-1-git-send-email-zheng.z.yan@intel.com> References: <1357299261-20591-1-git-send-email-zheng.z.yan@intel.com> Sender: ceph-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org From: "Yan, Zheng" In commit 22cddde104, ceph_get_caps() was moved into ceph_write_begin(). So ceph_get_caps() can be called while i_mutex is locked. If there is pending vmtruncate, ceph_get_caps() will wait for it to complete, but ceph_vmtruncate_work() is blocked by the locked i_mutex. There are several places that call __ceph_do_pending_vmtruncate() without holding the i_mutex, I think it's OK to not acquire the i_mutex in ceph_vmtruncate_work() Signed-off-by: Yan, Zheng --- fs/ceph/inode.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c index 81613bc..c895c7f 100644 --- a/fs/ceph/inode.c +++ b/fs/ceph/inode.c @@ -1420,7 +1420,7 @@ out: /* - * called by trunc_wq; take i_mutex ourselves + * called by trunc_wq; * * We also truncate in a separate thread as well. */ @@ -1431,9 +1431,7 @@ 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); __ceph_do_pending_vmtruncate(inode); - mutex_unlock(&inode->i_mutex); iput(inode); }