Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp479010pxj; Thu, 27 May 2021 05:02:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY/u5eugV6WBZWzXVQYuCClnjXpjYYourUoCJBs9v08/yT7inPNGVpQXTsyYfJggTPFeT+ X-Received: by 2002:a6b:dc13:: with SMTP id s19mr2573084ioc.14.1622116958478; Thu, 27 May 2021 05:02:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622116958; cv=none; d=google.com; s=arc-20160816; b=ZNw3Nr0/p8HIWUe4c/Kdr3Uv+hf2JIjUtTijNRZbyh8tNhUIN+rw5RCUHQC7/+ZanP vtq8pgpFfXgafuystRWNxYSPgy1utdZMqd7jhZvZ4GuQCxSoolgQDo9suh5FV5kMaHG5 GwJcmEU13k+HBoeCHPk2bIP0/4Zx4yqPAvfs9r/NEjV81cMMvd/53QdFv3JneAkGfSjo eUXJX87qtNqcv7nSxx2sX2E03cfNUIuSbVmxiGXBneNu2s98ykDxmmH/HcdDggMvHdX6 ROWfdFMsPH3Y8f7pSevTG4k/Pvo4meFDMJKBX3UzBvTo+GuncHmSrWnoBaDy/nFgQjJo rCow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature:dkim-signature; bh=dzbVRZmzFuPYI5poJku3auZPHvmkGSaVp1vMN+///aM=; b=QtMLN2m6DH9kW0fqDqRJuYWpnirvjyClbg9QO00b4Os6t8pwo5GTbmqp9+afI0lBpC HZ+jti0R/X4BTULR7lx/e+1G2/VSPy9CPlF0wQkOmZfCvrpqsOWgbPZya205L8wquhoE 1o3CHv9+WVucvWjYEBCw7Smo8vlQGXxYU2/mwQGc5KDNncFEehnUKSXHeLsymsPgKVbL I/uAbJ/nvcK5k60vY31+uIXTUAMrzECXxw63gaIjsJ8WVhV+GIR0xdi09scB05bCZcVV c3pdxMxpQI2nPrxAVAAq5GMVrfnuGy/f1wV/zvlZgsPxZiYPgh/1ytgLbNe+UcR2DJR+ 9t1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=f2cxEqET; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=7ZmMbPHv; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d25si2204800jam.64.2021.05.27.05.02.19; Thu, 27 May 2021 05:02:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=f2cxEqET; dkim=neutral (no key) header.i=@suse.cz header.s=susede2_ed25519 header.b=7ZmMbPHv; spf=pass (google.com: domain of linux-ext4-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234510AbhE0MDX (ORCPT + 99 others); Thu, 27 May 2021 08:03:23 -0400 Received: from mx2.suse.de ([195.135.220.15]:54298 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234562AbhE0MDW (ORCPT ); Thu, 27 May 2021 08:03:22 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1622116908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dzbVRZmzFuPYI5poJku3auZPHvmkGSaVp1vMN+///aM=; b=f2cxEqETTBvEmV4ULoxNaMI1iCVFmFrGue2YsLPhsPaIwuWVWOs+sxiPUa8otMLF+YX0oZ uhov743BXdjHMHq4sEArHqsspS7mHteRQKwa0LzGiZVHpqcufpjvdvGhVbTucTMzS1ouxn le5Tq6JlMjVPTCeShhV6Fk3X7MaBZg0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1622116908; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=dzbVRZmzFuPYI5poJku3auZPHvmkGSaVp1vMN+///aM=; b=7ZmMbPHvotaCLsOpw+GVeU5Zo9oFBCWF89Cqa0I7loV15uebJ80v4o2t67vCmwZ9u62oXn kdu5eoF4IBW9prBQ== Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 1D6CBAD77; Thu, 27 May 2021 12:01:48 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 5A1181F2C9A; Thu, 27 May 2021 14:01:47 +0200 (CEST) Date: Thu, 27 May 2021 14:01:47 +0200 From: Jan Kara To: "Darrick J. Wong" Cc: Jan Kara , 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: <20210527120147.GD24486@quack2.suse.cz> References: <20210525125652.20457-1-jack@suse.cz> <20210525135100.11221-7-jack@suse.cz> <20210525213729.GC202144@locust> <20210526101840.GC30369@quack2.suse.cz> <20210526153251.GZ202121@locust> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210526153251.GZ202121@locust> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Wed 26-05-21 08:32:51, Darrick J. Wong wrote: > 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. I see. Yeah, we do "interesting" dances around lockdep fs-freezing annotations for AIO as well where the freeze protection is inherited from submission to completion context (we effectively generate false release event for lockdep when exiting submit context and false acquire event in the completion context). It can be done but it's ugly and error prone. > 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. OK, will do! Honza -- Jan Kara SUSE Labs, CR