Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1030368AbbDWRPN (ORCPT ); Thu, 23 Apr 2015 13:15:13 -0400 Received: from g4t3425.houston.hp.com ([15.201.208.53]:36898 "EHLO g4t3425.houston.hp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030308AbbDWRPJ (ORCPT ); Thu, 23 Apr 2015 13:15:09 -0400 Message-ID: <55392880.30301@hp.com> Date: Thu, 23 Apr 2015 13:14:40 -0400 From: Waiman Long User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130109 Thunderbird/10.0.12 MIME-Version: 1.0 To: Dave Chinner CC: xfs@oss.sgi.com, linux-kernel@vger.kernel.org Subject: Re: [PATCH] xfs: call xfs_idestroy_fork() in xfs_ilock() critical section References: <1429724021-7675-1-git-send-email-Waiman.Long@hp.com> <20150422231758.GQ21261@dastard> In-Reply-To: <20150422231758.GQ21261@dastard> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2287 Lines: 57 On 04/22/2015 07:17 PM, Dave Chinner wrote: > -- > Dave Chinner > david@fromorbit.com > > xfs: xfs_attr_inactive leaves inconsistent attr fork state behind > > From: Dave Chinner > > xfs_attr_inactive() is supposed to clean up the attribute fork when > the inode is being freed. While it removes attribute fork extents, > it completely ignores attributes in local format, which means that > there can still be active attributes on the inode after > xfs_attr_inactive() has run. > > This leads to problems with concurrent inode writeback - the in-core > inode attribute fork is removed without locking on the assumption > that nothing will be attempting to access the attribute fork after a > call to xfs_attr_inactive() because it isn't supposed to exist on > disk any more. > > To fix this, make xfs_attr_inactive() completely remove all traces > of the attribute fork from the inode, regardless of it's state. > Further, also remove the in-core attribute fork structure safely so > that there is nothing further that needs to be done by callers to > clean up the attribute fork. This means we can remove the in-core > and on-disk attribute forks atomically. > > Also, on error simply remove the in-memory attribute fork. There's > nothing that can be done with it once we have failed to remove the > on-disk attribute fork, so we may as well just blow it away here > anyway. > > cc: # 3.12 to 4.0 > Reported-by: Waiman Long > Signed-off-by: Dave Chinner > --- > fs/xfs/libxfs/xfs_attr_leaf.c | 2 +- > fs/xfs/libxfs/xfs_attr_leaf.h | 2 +- > fs/xfs/xfs_attr_inactive.c | 81 ++++++++++++++++++++++++++----------------- > fs/xfs/xfs_inode.c | 12 +++---- > 4 files changed, 55 insertions(+), 42 deletions(-) Thanks for figuring out a better way to fix the underlying problem. I tested it in my test machine and it did fix the errors that I had seen in my test case. Tested-by: Waiman Long Cheers, Longman -- 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/