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...