From patchwork Wed Mar 27 13:19:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zheng Liu X-Patchwork-Id: 231679 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 224F42C0095 for ; Thu, 28 Mar 2013 00:03:30 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751827Ab3C0ND3 (ORCPT ); Wed, 27 Mar 2013 09:03:29 -0400 Received: from mail-pb0-f42.google.com ([209.85.160.42]:63320 "EHLO mail-pb0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643Ab3C0ND3 (ORCPT ); Wed, 27 Mar 2013 09:03:29 -0400 Received: by mail-pb0-f42.google.com with SMTP id xb4so5255775pbc.15 for ; Wed, 27 Mar 2013 06:03:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer; bh=wSdxMIvUP8yv4FpVKV7zTkY94cVkDP/bSD86ZXrPnI0=; b=zGIHGLesnFHsyCZhwKQHjYLU3W2K65tznsgViyzQQ2VxgxudYnxOZ+cnyluZSTQH3+ XQSMAlE9x3qKgs2MoFrcRBGvvq9pXPJT/Z7O34dmo1zOiVbkhWc6w20QkfkGLyDdUenW hpSHxIEDge50jKf42EEdCrIwbm5WClSiiwyzG0hflM6pwJanIaSlZ3Y8oN+c6BoEwTA7 yloxnDszz6wPbp6795JHuejy2rMP46djsn7Ye0I5uwMyELgn4ex/cmbGQy09yGv9JwX9 z5u6ran+sXbY3kAVAVZiC+0+rVmDNKW83abHyA3TUHT5XvFLAKkNEDTvfEeRn1IwcxGF 8geg== X-Received: by 10.68.201.194 with SMTP id kc2mr28606436pbc.27.1364389408797; Wed, 27 Mar 2013 06:03:28 -0700 (PDT) Received: from lz-desktop.taobao.ali.com ([182.92.247.2]) by mx.google.com with ESMTPS id jk1sm19581164pbb.14.2013.03.27.06.03.25 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 27 Mar 2013 06:03:28 -0700 (PDT) From: Zheng Liu To: linux-ext4@vger.kernel.org Cc: Zheng Liu Subject: [PATCH] ext4: take i_mutex in ext4_symlink to eliminate a warning from ext4_truncate Date: Wed, 27 Mar 2013 21:19:07 +0800 Message-Id: <1364390347-4360-1-git-send-email-wenqing.lz@taobao.com> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org From: Zheng Liu After applied this commit (8e4061cb), we will get a warning from ext4_truncate when i_mutex isn't taken. Here the assumption is that i_mutex should be taken when we do a truncation. In ext4_symlink we could need to call ext4_truncate to trim some blocks beyond i_size, but the i_mutex isn't taken. Signed-off-by: Zheng Liu --- fs/ext4/namei.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 3825d6a..d75f91a 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -2856,7 +2856,9 @@ retry: ext4_journal_stop(handle); if (err) goto err_drop_inode; + mutex_lock(&inode->i_mutex); err = __page_symlink(inode, symname, l, 1); + mutex_unlock(&inode->i_mutex); if (err) goto err_drop_inode; /*