From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from zeniv.linux.org.uk ([195.92.253.2]:58006 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751015AbeEKT4S (ORCPT ); Fri, 11 May 2018 15:56:18 -0400 Date: Fri, 11 May 2018 20:56:17 +0100 From: Al Viro To: Dave Chinner Cc: linux-fsdevel@vger.kernel.org, Linus Torvalds Subject: Re: [RFC][PATCH] do d_instantiate/unlock_new_inode combinations safely Message-ID: <20180511195616.GD30522@ZenIV.linux.org.uk> References: <20180510182058.GP30522@ZenIV.linux.org.uk> <20180510225607.GU23861@dastard> <20180511003901.GW30522@ZenIV.linux.org.uk> <20180511013208.GV23861@dastard> <20180511021843.GY30522@ZenIV.linux.org.uk> <20180511030029.GW23861@dastard> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180511030029.GW23861@dastard> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, May 11, 2018 at 01:00:29PM +1000, Dave Chinner wrote: > On Fri, May 11, 2018 at 03:18:43AM +0100, Al Viro wrote: > > On Fri, May 11, 2018 at 11:32:08AM +1000, Dave Chinner wrote: > > > > > i.e. we already have code in xfs_setup_inode() that sets the xfs > > > inode ILOCK rwsem dir/non-dir lockdep class before the new inode is > > > unlocked - we could just do the i_rwsem lockdep setup there, too. > > > > ... which would suffice - > > > > if (S_ISDIR(inode->i_mode)) { > > struct file_system_type *type = inode->i_sb->s_type; > > > > /* Set new key only if filesystem hasn't already changed it */ > > if (lockdep_match_class(&inode->i_rwsem, &type->i_mutex_key)) { > > > > in lockdep_annotate_inode_mutex_key() would make sure that ->i_rwsem will be > > left alone by unlock_new_inode(). > > Ok, If you are happy with XFs doing that, I'll put together a patch > and send it out. That should probably go through xfs tree - no impact outside of fs/xfs...