Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753584AbbDVRef (ORCPT ); Wed, 22 Apr 2015 13:34:35 -0400 Received: from g4t3425.houston.hp.com ([15.201.208.53]:22433 "EHLO g4t3425.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752271AbbDVRee (ORCPT ); Wed, 22 Apr 2015 13:34:34 -0400 From: Waiman Long To: Dave Chinner , xfs@oss.sgi.com Cc: linux-kernel@vger.kernel.org, Waiman Long Subject: [PATCH] xfs: call xfs_idestroy_fork() in xfs_ilock() critical section Date: Wed, 22 Apr 2015 13:33:41 -0400 Message-Id: <1429724021-7675-1-git-send-email-Waiman.Long@hp.com> X-Mailer: git-send-email 1.7.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1267 Lines: 40 The commit f7be2d7f594cbc ("xfs: push down inactive transaction mgmt for truncate") refactored the xfs_inactive() function in fs/xfs/xfs_inode.c. However, it also moved the call to xfs_idestroy_fork() from inside the xfs_ilock() critical section to outside. That was causing memory corruption and strange failures like deferencing NULL pointers in some circumstances. This patch moves the xfs_idestroy_fork() call back into an xfs_ilock() critical section to avoid memory corruption problem. Signed-off-by: Waiman Long --- fs/xfs/xfs_inode.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c index 6163767..31850fb 100644 --- a/fs/xfs/xfs_inode.c +++ b/fs/xfs/xfs_inode.c @@ -1900,8 +1900,11 @@ xfs_inactive( return; } - if (ip->i_afp) + if (ip->i_afp) { + xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_idestroy_fork(ip, XFS_ATTR_FORK); + xfs_iunlock(ip, XFS_ILOCK_EXCL); + } ASSERT(ip->i_d.di_anextents == 0); -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/