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=-5.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 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 0EB2AC32753 for ; Wed, 14 Aug 2019 21:57:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CE8602133F for ; Wed, 14 Aug 2019 21:57:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728810AbfHNV5n (ORCPT ); Wed, 14 Aug 2019 17:57:43 -0400 Received: from mail104.syd.optusnet.com.au ([211.29.132.246]:57130 "EHLO mail104.syd.optusnet.com.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728745AbfHNV5m (ORCPT ); Wed, 14 Aug 2019 17:57:42 -0400 Received: from dread.disaster.area (pa49-195-190-67.pa.nsw.optusnet.com.au [49.195.190.67]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 800D843DB39; Thu, 15 Aug 2019 07:57:37 +1000 (AEST) Received: from dave by dread.disaster.area with local (Exim 4.92) (envelope-from ) id 1hy1Fu-0006Ca-2B; Thu, 15 Aug 2019 07:56:30 +1000 Date: Thu, 15 Aug 2019 07:56:30 +1000 From: Dave Chinner To: Jeff Layton Cc: ira.weiny@intel.com, Andrew Morton , Jason Gunthorpe , Dan Williams , Matthew Wilcox , Jan Kara , Theodore Ts'o , John Hubbard , Michal Hocko , linux-xfs@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RFC PATCH v2 02/19] fs/locks: Add Exclusive flag to user Layout lease Message-ID: <20190814215630.GQ6129@dread.disaster.area> References: <20190809225833.6657-1-ira.weiny@intel.com> <20190809225833.6657-3-ira.weiny@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=FNpr/6gs c=1 sm=1 tr=0 a=TR82T6zjGmBjdfWdGgpkDw==:117 a=TR82T6zjGmBjdfWdGgpkDw==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=FmdZ9Uzk2mMA:10 a=QyXUC8HyAAAA:8 a=7-415B0cAAAA:8 a=qa3ElbQomqnm_qv8Y-cA:9 a=CjuIK1q_8ugA:10 a=biEYGPWJfzWAr4FL6Ov7:22 Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org On Wed, Aug 14, 2019 at 10:15:06AM -0400, Jeff Layton wrote: > On Fri, 2019-08-09 at 15:58 -0700, ira.weiny@intel.com wrote: > > From: Ira Weiny > > > > Add an exclusive lease flag which indicates that the layout mechanism > > can not be broken. > > > > Exclusive layout leases allow the file system to know that pages may be > > GUP pined and that attempts to change the layout, ie truncate, should be > > failed. > > > > A process which attempts to break it's own exclusive lease gets an > > EDEADLOCK return to help determine that this is likely a programming bug > > vs someone else holding a resource. ..... > > diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h > > index baddd54f3031..88b175ceccbc 100644 > > --- a/include/uapi/asm-generic/fcntl.h > > +++ b/include/uapi/asm-generic/fcntl.h > > @@ -176,6 +176,8 @@ struct f_owner_ex { > > > > #define F_LAYOUT 16 /* layout lease to allow longterm pins such as > > RDMA */ > > +#define F_EXCLUSIVE 32 /* layout lease is exclusive */ > > + /* FIXME or shoudl this be F_EXLCK??? */ > > > > /* operations for bsd flock(), also used by the kernel implementation */ > > #define LOCK_SH 1 /* shared lock */ > > This interface just seems weird to me. The existing F_*LCK values aren't > really set up to be flags, but are enumerated values (even if there are > some gaps on some arches). For instance, on parisc and sparc: I don't think we need to worry about this - the F_WRLCK version of the layout lease should have these exclusive access semantics (i.e other ops fail rather than block waiting for lease recall) and hence the API shouldn't need a new flag to specify them. i.e. the primary difference between F_RDLCK and F_WRLCK layout leases is that the F_RDLCK is a shared, co-operative lease model where only delays in operations will be seen, while F_WRLCK is a "guarantee exclusive access and I don't care what it breaks" model... :) Cheers, Dave. -- Dave Chinner david@fromorbit.com