Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2547942pxj; Mon, 17 May 2021 04:22:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwlEY6eFpcryfLK7ApkwVxOr2OZmTe64yfRUUOiIgSMAwlZf9Jl0Jq5zbaUNUEdh4DE1z3J X-Received: by 2002:a17:906:6c8a:: with SMTP id s10mr15072906ejr.276.1621250532757; Mon, 17 May 2021 04:22:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621250532; cv=none; d=google.com; s=arc-20160816; b=p0zOaJ5ylxQpxTuOiw0Sk0k/LU/AZsaQfNuEYdvFONQM0jD4XULkBzH2QNpiZRp0lI N3vIGmoov23nxNsvY/vmT2PUsW8dKVGfIbgn/fZYwuW1t32pQ38nMZXy4JjGTNJZSxVY t4m9eSdyiUiG4+A+8ZdHjnEpMjmAswJtyh3zHs3yiult8rSXta54A3GYCFxZd0zVYdPa JySnc7Apq9Sk4D3tb8ckgAathgb0HI36+RHpj5SKj4qGtwys3VA0kH6qA7JhKtCfedrJ RfUvKLLNTCJRy/bv61xD97/eetrSAgnZjlhzffKo7W/i04IcSMSN4K0ZKw0I5x1h1Gwa D1GA== 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; bh=QP4OjDET8BQ5uApdcIrdgvHNn5bel6y9WRlouuY+4gw=; b=jOSpVLdeXUz8t6TQdkrgykLSxlG1vO2WdHOKKoQCxjAm8uupEyr3/lp7ZZWVb5fzmV ndRrLotpiH2vtJfm4TAlRE2MyQfUfTT//IuaE3rqufzS9BCefQjeB8uzNL/6+zZ7tzfl y7wDygO+Q4wB8oZQHx2RVN3qwhAIhE9H6qERLZ/DtDez1hRkskzKhWhp4M9tdnVSs3iR YqQlZCtJ0SmU7cniFSVQiLmI8kN4SjY8hf7H/YaGC03b633JHOb5D0koCPm1slyXN7cp O6gCzhfJ40fMGg6TCiBQYJ/h9HKa39BH49zNrQRncSCoHa+obY+BIZJbCTsJEA20UC7r i9oQ== ARC-Authentication-Results: i=1; mx.google.com; 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 j16si18127601edj.357.2021.05.17.04.21.45; Mon, 17 May 2021 04:22:12 -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; 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 S236650AbhEQLWe (ORCPT + 99 others); Mon, 17 May 2021 07:22:34 -0400 Received: from mx2.suse.de ([195.135.220.15]:42102 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236528AbhEQLWd (ORCPT ); Mon, 17 May 2021 07:22:33 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D7294AED7; Mon, 17 May 2021 11:21:15 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id 56F6D1F2CA4; Mon, 17 May 2021 13:21:15 +0200 (CEST) Date: Mon, 17 May 2021 13:21:15 +0200 From: Jan Kara To: "Darrick J. Wong" Cc: Dave Chinner , Jan Kara , linux-fsdevel@vger.kernel.org, Christoph Hellwig , 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 Subject: Re: [PATCH 03/11] mm: Protect operations adding pages to page cache with invalidate_lock Message-ID: <20210517112115.GC31755@quack2.suse.cz> References: <20210512101639.22278-1-jack@suse.cz> <20210512134631.4053-3-jack@suse.cz> <20210512152345.GE8606@magnolia> <20210513174459.GH2734@quack2.suse.cz> <20210513185252.GB9675@magnolia> <20210513231945.GD2893@dread.disaster.area> <20210514161730.GL9675@magnolia> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210514161730.GL9675@magnolia> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Fri 14-05-21 09:17:30, Darrick J. Wong wrote: > On Fri, May 14, 2021 at 09:19:45AM +1000, Dave Chinner wrote: > > We've been down this path before more than a decade ago when the > > powers that be decreed that inode locking order is to be "by > > structure address" rather than inode number, because "inode number > > is not unique across multiple superblocks". > > > > I'm not sure that there is anywhere that locks multiple inodes > > across different superblocks, but here we are again.... > > Hm. Are there situations where one would want to lock multiple > /mappings/ across different superblocks? The remapping code doesn't > allow cross-super operations, so ... pipes and splice, maybe? I don't > remember that code well enough to say for sure. Splice and friends work one file at a time. I.e., first they fill a pipe from the file with ->read_iter, then they flush the pipe to the target file with ->write_iter. So file locking doesn't get coupled there. > I've been operating under the assumption that as long as one takes all > the same class of lock at the same time (e.g. all the IOLOCKs, then all > the MMAPLOCKs, then all the ILOCKs, like reflink does) that the > incongruency in locking order rules within a class shouldn't be a > problem. That's my understanding as well. > > > It might simply be time to convert all > > > three XFS inode locks to use the same ordering rules. > > > > Careful, there lie dragons along that path because of things like > > how the inode cluster buffer operations work - they all assume > > ascending inode number traversal within and across inode cluster > > buffers and hence we do have locking order constraints based on > > inode number... > > Fair enough, I'll leave the ILOCK alone. :) OK, so should I change the order for invalidate_lock or shall we just leave that alone as it is not a practical problem AFAICT. Honza -- Jan Kara SUSE Labs, CR