Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp8491595ybi; Thu, 6 Jun 2019 13:18:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqyU0CD3JIdvrqEsuEf9Vdj0oobtds+wuqJ3iygKvteiaRWfX0haxmmCLKPJCG2hxSvHLFn6 X-Received: by 2002:a63:fc61:: with SMTP id r33mr325514pgk.294.1559852303095; Thu, 06 Jun 2019 13:18:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559852303; cv=none; d=google.com; s=arc-20160816; b=gMMu1C0IjHfihRXlEJPkjXIo5sJOh/VH8OYq/rE3WBD+DGCjo4GdHuP/8cn9yZfN2m Ntlz2UEzkARrRRx4GEAAtolLEniMxbUaMMkt/INtybjp8Dq+6R47vc6J5/hZi5FNGcyC udhHbosqG+85RwxHj1aMYkJIfibW+E1RUFrAup8GYLYNU5/CS6HkxGRsU1Kn4Lov0+5X 31DyvvRqOPvu+KN1uOszFkPvd45r/tPXZUi1KY+EEwLcb6sCeSP/3bt9fAbI0h/2+jiz QaQdCVF96umiQ30tU7DklIIx/lnESw0rZCIIkWfEcDvlVSVMKP5Nz19rpWCRghQflkrP LjSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=fVbv7ZkCU0XRJ9jD+fxd4ieH6waXD3NIwch6tKZrfLk=; b=CNRiu30pPeZpHVTotBcXZxhyStS8+d+Ohr/E1hTrUmL7aprfwkpO2+AKufQmnxzgLa I1WZhheqEtbAlrFRK4VHg6V+dFJhxz5OLmsIalUQ1oj9qqKCE7WostJQu/LrSycYxIka G5hlNULpKK8LStCSyu6I9zg2h6V5ZDwYIQt9AzBD1sUMkL5709cwhnEoksw0H6pfLd6R K11v72BUpGPykhbOs+8kk5lVnel1oBHQUSOGc+y2djC/Z50vq4RtWY+yddbSa8UdoW3J 3CYgcKVETKHJJzn6lJkJQPdGvULh+3lS8VnBwMASORvQBbzHVeZwulTy/f78ah2qAVCi YOFg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="JK8En4/C"; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 9si60034pgu.189.2019.06.06.13.18.08; Thu, 06 Jun 2019 13:18:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b="JK8En4/C"; spf=pass (google.com: best guess record for domain of linux-ext4-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-ext4-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727495AbfFFTvR (ORCPT + 99 others); Thu, 6 Jun 2019 15:51:17 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:36792 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727061AbfFFTvR (ORCPT ); Thu, 6 Jun 2019 15:51:17 -0400 Received: by mail-qk1-f195.google.com with SMTP id g18so2283767qkl.3 for ; Thu, 06 Jun 2019 12:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=fVbv7ZkCU0XRJ9jD+fxd4ieH6waXD3NIwch6tKZrfLk=; b=JK8En4/CLh0QaNpMzjO2iMeOMpfrAAx/gr5SgNV/sb4SY2gHe/v8MOPkfC/9wPWIZ9 ZL8QsvlzUZu3/QV2sR8DriCxzBeBuTLKUUPKPgdfpcAKVXgCaQb7rGQ3TRW8g1PxMby9 +wxeHaZK6IN3egjgnP9IJZ+w011avGG0F3y8TTnoGrINoPzy0TddWA78C+1Q+KMGIdzz 92AxUAVNZWhAkEVYstL8INWhYQ829J/YpWO2ZbVyA8ZS8ksWZ7LFyB1R04yWWmr5UAZu N8V2QVFH6XXSPdpk/99Edhk0JJ7bEpSx2FL6IQyeiD+YQVzMZEgvotOVmE8xHx4nh57Z Aq3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=fVbv7ZkCU0XRJ9jD+fxd4ieH6waXD3NIwch6tKZrfLk=; b=SbhrQS+jgus+H2lYG10rPlTJ8KxpWyld9FtBV1r8Jsq115V6AjiRRcTKi2J4b4WR5u dALDXpgLRtUcqukKMlcD9dAtjIpimSqzBcmRDB7HitQBa+tm2psYzHoTjshNaIZNrHZT YomzkVCP4s4ayzyZsFPWd0FMCiY+CFVZcx5MIgPXDIwAG2sawsAWeLh0eaVKdabvZXc4 99gBnZbyr712c6ubFu3Zxy3ag40Phqo9ZKO5OzaAXkcHYzUU262Y4SfJT7GTz8u5D0zz Oukf5vuTZCEQ0VaTQ9V3rP29nHTAASxsOmGGnXDk62O2lIX2heLOxz1iULgQka+p0LAX F1Sg== X-Gm-Message-State: APjAAAXkKgudihmeLZHml07RXHx1rNxU1JQCNIVrBzsUsZNsWdGlodSJ FsZ6xbX7WD1Mp8nnOC4p7r7obg== X-Received: by 2002:a37:a9c3:: with SMTP id s186mr41012233qke.190.1559850676118; Thu, 06 Jun 2019 12:51:16 -0700 (PDT) Received: from ziepe.ca (hlfxns017vw-156-34-55-100.dhcp-dynamic.fibreop.ns.bellaliant.net. [156.34.55.100]) by smtp.gmail.com with ESMTPSA id t197sm1415555qke.2.2019.06.06.12.51.15 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 06 Jun 2019 12:51:15 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1hYyPr-00081O-0q; Thu, 06 Jun 2019 16:51:15 -0300 Date: Thu, 6 Jun 2019 16:51:15 -0300 From: Jason Gunthorpe To: Jan Kara Cc: ira.weiny@intel.com, Dan Williams , Theodore Ts'o , Jeff Layton , Dave Chinner , Matthew Wilcox , linux-xfs@vger.kernel.org, Andrew Morton , John Hubbard , =?utf-8?B?SsOpcsO0bWU=?= Glisse , linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, linux-ext4@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH RFC 00/10] RDMA/FS DAX truncate proposal Message-ID: <20190606195114.GA30714@ziepe.ca> References: <20190606014544.8339-1-ira.weiny@intel.com> <20190606104203.GF7433@quack2.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190606104203.GF7433@quack2.suse.cz> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org On Thu, Jun 06, 2019 at 12:42:03PM +0200, Jan Kara wrote: > So I'd like to actually mandate that you *must* hold the file lease until > you unpin all pages in the given range (not just that you have an option to > hold a lease). And I believe the kernel should actually enforce this. That > way we maintain a sane state that if someone uses a physical location of > logical file offset on disk, he has a layout lease. Also once this is done, > sysadmin has a reasonably easy way to discover run-away RDMA application > and kill it if he wishes so. > > The question is on how to exactly enforce that lease is taken until all > pages are unpinned. I belive it could be done by tracking number of > long-term pinned pages within a lease. Gup_longterm could easily increment > the count when verifying the lease exists, gup_longterm users will somehow > need to propagate corresponding 'filp' (struct file pointer) to > put_user_pages_longterm() callsites so that they can look up appropriate > lease to drop reference - probably I'd just transition all gup_longterm() > users to a saner API similar to the one we have in mm/frame_vector.c where > we don't hand out page pointers but an encapsulating structure that does > all the necessary tracking. Removing a lease would need to block until all > pins are released - this is probably the most hairy part since we need to > handle a case if application just closes the file descriptor which > would I think if you are going to do this then the 'struct filp' that represents the lease should be held in the kernel (ie inside the RDMA umem) until the kernel is done with it. Actually does someone have a pointer to this userspace lease API, I'm not at all familiar with it, thanks And yes, a better output format from GUP would be great.. > Maybe we could block only on explicit lease unlock and just drop the layout > lease on file close and if there are still pinned pages, send SIGKILL to an > application as a reminder it did something stupid... Which process would you SIGKILL? At least for the rdma case a FD is holding the GUP, so to do the put_user_pages() the kernel needs to close the FD. I guess it would have to kill every process that has the FD open? Seems complicated... Regards, Jason