From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DBC04C47082 for ; Wed, 26 May 2021 15:32:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B9AE8613D3 for ; Wed, 26 May 2021 15:32:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235270AbhEZPeY (ORCPT ); Wed, 26 May 2021 11:34:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:59076 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234615AbhEZPeY (ORCPT ); Wed, 26 May 2021 11:34:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E70560FEB; Wed, 26 May 2021 15:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622043172; bh=V5vCXBefwn7ATI2q09Zc6Pyr3lgUwNBruf3selAP4x4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jbwHAkWFow3o+pBkhghb3kHEKwUgkNydGv3mNOmncX52Qoz1jR2s3vJbxA6JPcd88 tab4+/Gep3cvFcm3cZMlAQxOOmHOWF86MNOlkpXVV0n2emp7yBv++bsf9Zail+czZ/ 4AwrVtxdw45GdYyGip8v1vFDbPEI1l6/GKxPDVKUAz97lejoC/GIypyNOFV2/7orn9 AwoGrXmEstbTzqHVdZQadJZX+Kld/lh1w/YQ+Oi1d9U5EtitGuZAvULQN/GbfIBQkf Lsq/rxD2moQfCmv6WNsXnHOKeGsJ5R+L0/D6492eq6NGD7sDKAYmg4SAWgQZh3H+UD 3oYe04vxFLyHQ== Date: Wed, 26 May 2021 08:32:51 -0700 From: "Darrick J. Wong" To: Jan Kara Cc: linux-fsdevel@vger.kernel.org, Christoph Hellwig , Dave Chinner , ceph-devel@vger.kernel.org, Chao Yu , Damien Le Moal , "Darrick J. Wong" , Jaegeuk Kim , Jeff Layton , Johannes Thumshirn , linux-cifs@vger.kernel.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, linux-mm@kvack.org, linux-xfs@vger.kernel.org, Miklos Szeredi , Steve French , Ted Tso , Matthew Wilcox , Christoph Hellwig Subject: Re: [PATCH 07/13] xfs: Convert to use invalidate_lock Message-ID: <20210526153251.GZ202121@locust> References: <20210525125652.20457-1-jack@suse.cz> <20210525135100.11221-7-jack@suse.cz> <20210525213729.GC202144@locust> <20210526101840.GC30369@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210526101840.GC30369@quack2.suse.cz> Precedence: bulk List-ID: X-Mailing-List: linux-cifs@vger.kernel.org On Wed, May 26, 2021 at 12:18:40PM +0200, Jan Kara wrote: > On Tue 25-05-21 14:37:29, Darrick J. Wong wrote: > > On Tue, May 25, 2021 at 03:50:44PM +0200, Jan Kara wrote: > > > Use invalidate_lock instead of XFS internal i_mmap_lock. The intended > > > purpose of invalidate_lock is exactly the same. Note that the locking in > > > __xfs_filemap_fault() slightly changes as filemap_fault() already takes > > > invalidate_lock. > > > > > > Reviewed-by: Christoph Hellwig > > > CC: > > > CC: "Darrick J. Wong" > > > > It's djwong@kernel.org now. > > OK, updated. > > > > @@ -355,8 +358,11 @@ xfs_isilocked( > > > > > > if (lock_flags & (XFS_MMAPLOCK_EXCL|XFS_MMAPLOCK_SHARED)) { > > > if (!(lock_flags & XFS_MMAPLOCK_SHARED)) > > > - return !!ip->i_mmaplock.mr_writer; > > > - return rwsem_is_locked(&ip->i_mmaplock.mr_lock); > > > + return !debug_locks || > > > + lockdep_is_held_type( > > > + &VFS_I(ip)->i_mapping->invalidate_lock, > > > + 0); > > > + return rwsem_is_locked(&VFS_I(ip)->i_mapping->invalidate_lock); > > > > This doesn't look right... > > > > If lockdep is disabled, we always return true for > > xfs_isilocked(ip, XFS_MMAPLOCK_EXCL) even if nobody holds the lock? > > > > Granted, you probably just copy-pasted from the IOLOCK_SHARED clause > > beneath it. Er... oh right, preichl was messing with all that... > > > > https://lore.kernel.org/linux-xfs/20201016021005.548850-2-preichl@redhat.com/ > > Indeed copy-paste programming ;) It certainly makes the assertions happy > but useless. Should I pull the patch you reference into the series? It > seems to have been uncontroversial and reviewed. Or will you pull the > series to xfs tree so I can just rebase on top? The full conversion series introduced assertion failures because lockdep can't handle some of the ILOCK usage patterns, specifically the fact that a thread sometimes takes the ILOCK but then hands the inode to a workqueue to avoid overflowing the first thread's stack. That's why it never got merged into the xfs tree. However, that kind of switcheroo isn't done with the MMAPLOCK/invalidate_lock, so you could simply pull the patch I linked above into your series. --D > > Honza > -- > Jan Kara > SUSE Labs, CR From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 233ADC47088 for ; Wed, 26 May 2021 15:33:05 +0000 (UTC) Received: from lists.sourceforge.net (lists.sourceforge.net [216.105.38.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D78C560FEB; Wed, 26 May 2021 15:33:04 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D78C560FEB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linux-f2fs-devel-bounces@lists.sourceforge.net Received: from [127.0.0.1] (helo=sfs-ml-4.v29.lw.sourceforge.com) by sfs-ml-4.v29.lw.sourceforge.com with esmtp (Exim 4.90_1) (envelope-from ) id 1llvWn-0001Ve-Bu; Wed, 26 May 2021 15:33:01 +0000 Received: from [172.30.20.202] (helo=mx.sourceforge.net) by sfs-ml-4.v29.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.90_1) (envelope-from ) id 1llvWm-0001VX-Gh for linux-f2fs-devel@lists.sourceforge.net; Wed, 26 May 2021 15:33:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=In-Reply-To:Content-Type:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=BNkDrlewdBn1lE+2W6CNw20hM92axKpKEMjNiP7/mEk=; b=kA5yOe1a7Xl+dqcw3yy7rbs8gv +VJwBY6oCXb8Gr9aB4qmeEr5AdLU+3UQxj/3I+ZB5FHFIzERK0f2+v/tUl8XengkTaO9OOTAt4g6S IBFKA2DxuJi5UjsQOjT4PV5bN5V0RQjYZpHGpFwNkvx95pqC8ECSV9KZTtOcWK9r8aI0=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x ; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To :From:Date:Sender:Reply-To:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=BNkDrlewdBn1lE+2W6CNw20hM92axKpKEMjNiP7/mEk=; b=Ris28Fn26Ag35cR2OMNcYZN6Os KWb7anqG87q2klEAqW0/O5WKmaAy5W2+QVtq0xLlvXztnvgr+4uWgKCKuhErKS04p1xhSQkGVcIKb 7aka7z7MZYS0qo3M/e/vpD57vXnvrfKus2qNwSKIizwxQsi/nL443j4ZczcQ8hj+jk4E=; Received: from mail.kernel.org ([198.145.29.99]) by sfi-mx-1.v28.lw.sourceforge.com with esmtps (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.92.2) id 1llvWj-006gU1-R3 for linux-f2fs-devel@lists.sourceforge.net; Wed, 26 May 2021 15:33:02 +0000 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5E70560FEB; Wed, 26 May 2021 15:32:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1622043172; bh=V5vCXBefwn7ATI2q09Zc6Pyr3lgUwNBruf3selAP4x4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=jbwHAkWFow3o+pBkhghb3kHEKwUgkNydGv3mNOmncX52Qoz1jR2s3vJbxA6JPcd88 tab4+/Gep3cvFcm3cZMlAQxOOmHOWF86MNOlkpXVV0n2emp7yBv++bsf9Zail+czZ/ 4AwrVtxdw45GdYyGip8v1vFDbPEI1l6/GKxPDVKUAz97lejoC/GIypyNOFV2/7orn9 AwoGrXmEstbTzqHVdZQadJZX+Kld/lh1w/YQ+Oi1d9U5EtitGuZAvULQN/GbfIBQkf Lsq/rxD2moQfCmv6WNsXnHOKeGsJ5R+L0/D6492eq6NGD7sDKAYmg4SAWgQZh3H+UD 3oYe04vxFLyHQ== Date: Wed, 26 May 2021 08:32:51 -0700 From: "Darrick J. Wong" To: Jan Kara Message-ID: <20210526153251.GZ202121@locust> References: <20210525125652.20457-1-jack@suse.cz> <20210525135100.11221-7-jack@suse.cz> <20210525213729.GC202144@locust> <20210526101840.GC30369@quack2.suse.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20210526101840.GC30369@quack2.suse.cz> X-Headers-End: 1llvWj-006gU1-R3 Subject: Re: [f2fs-dev] [PATCH 07/13] xfs: Convert to use invalidate_lock X-BeenThere: linux-f2fs-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-cifs@vger.kernel.org, Damien Le Moal , linux-ext4@vger.kernel.org, Ted Tso , "Darrick J. Wong" , Jeff Layton , Steve French , Dave Chinner , Matthew Wilcox , linux-f2fs-devel@lists.sourceforge.net, Christoph Hellwig , linux-mm@kvack.org, Miklos Szeredi , linux-fsdevel@vger.kernel.org, Jaegeuk Kim , ceph-devel@vger.kernel.org, Johannes Thumshirn , Christoph Hellwig , linux-xfs@vger.kernel.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: linux-f2fs-devel-bounces@lists.sourceforge.net On Wed, May 26, 2021 at 12:18:40PM +0200, Jan Kara wrote: > On Tue 25-05-21 14:37:29, Darrick J. Wong wrote: > > On Tue, May 25, 2021 at 03:50:44PM +0200, Jan Kara wrote: > > > Use invalidate_lock instead of XFS internal i_mmap_lock. The intended > > > purpose of invalidate_lock is exactly the same. Note that the locking in > > > __xfs_filemap_fault() slightly changes as filemap_fault() already takes > > > invalidate_lock. > > > > > > Reviewed-by: Christoph Hellwig > > > CC: > > > CC: "Darrick J. Wong" > > > > It's djwong@kernel.org now. > > OK, updated. > > > > @@ -355,8 +358,11 @@ xfs_isilocked( > > > > > > if (lock_flags & (XFS_MMAPLOCK_EXCL|XFS_MMAPLOCK_SHARED)) { > > > if (!(lock_flags & XFS_MMAPLOCK_SHARED)) > > > - return !!ip->i_mmaplock.mr_writer; > > > - return rwsem_is_locked(&ip->i_mmaplock.mr_lock); > > > + return !debug_locks || > > > + lockdep_is_held_type( > > > + &VFS_I(ip)->i_mapping->invalidate_lock, > > > + 0); > > > + return rwsem_is_locked(&VFS_I(ip)->i_mapping->invalidate_lock); > > > > This doesn't look right... > > > > If lockdep is disabled, we always return true for > > xfs_isilocked(ip, XFS_MMAPLOCK_EXCL) even if nobody holds the lock? > > > > Granted, you probably just copy-pasted from the IOLOCK_SHARED clause > > beneath it. Er... oh right, preichl was messing with all that... > > > > https://lore.kernel.org/linux-xfs/20201016021005.548850-2-preichl@redhat.com/ > > Indeed copy-paste programming ;) It certainly makes the assertions happy > but useless. Should I pull the patch you reference into the series? It > seems to have been uncontroversial and reviewed. Or will you pull the > series to xfs tree so I can just rebase on top? The full conversion series introduced assertion failures because lockdep can't handle some of the ILOCK usage patterns, specifically the fact that a thread sometimes takes the ILOCK but then hands the inode to a workqueue to avoid overflowing the first thread's stack. That's why it never got merged into the xfs tree. However, that kind of switcheroo isn't done with the MMAPLOCK/invalidate_lock, so you could simply pull the patch I linked above into your series. --D > > Honza > -- > Jan Kara > SUSE Labs, CR _______________________________________________ Linux-f2fs-devel mailing list Linux-f2fs-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel