Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1199507ybl; Wed, 21 Aug 2019 11:35:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqz2g5CW2XFjD2hb2IsxBJIU1sztOBMBu5mo6wVhXvOnkOKIeLAItY5uSVaLjGHCPROK/10s X-Received: by 2002:a17:90a:de05:: with SMTP id m5mr1407770pjv.48.1566412516595; Wed, 21 Aug 2019 11:35:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566412516; cv=none; d=google.com; s=arc-20160816; b=iMnff1BASK6qVL2ogyGvWNAqu2pXJa4fheoLUUfpujBhzh0aa8luq0nCoLFUYQigws WUaK6G8+2Nz3Y7u+c8FlP/SopknGvgujt7+EO/ZUdYBqT2jGxDwbGT9tZ6/dOMYGqFr5 TXKpQyaG8yzYBnC+fLsOHRCAB98B3K0z+62qD2uagmGOvZI60YzULdl81uIL2idU1wqC 30eJsJ7Lghong/5UOsPtuC8J0g7YZ+tnIsD0kWWnGIO/E2yATka/wyUCrNG5ZqfQcFHt 2T2FxFSSR/P0UALx3HiHC2zl5dXA9st3x2zrVrcqSJqQRtSFlSnqtbScjpUxk8pCD0di /E9w== 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=bHHnCAoSSDpRzr3ZJCedqeeuFCaqygWmcbOwu0GqMSA=; b=sBHgSvU69PsUHuj6Odb4INbHIDtU0vGjWoe8bZPQ9tYFeOLTZpKarUbjXy6Kc1L6HI X/6V7cE40QuwiOU7ShL74dkzWCDlhmd6IvnqcyKQk0QpoCeXns5AiK6DAlkUIo9Jsqm6 85XHNlbABpk6LHJZFHT0W41LOh0D0vWzmmjNJkiwX2Elvk6iOSvteNBC6gfkl1BMYdiP PsGY+XkmUmXWZVQ2xl18HgJsoXJP2+LyvaLS9fEBRL696fzBnO7HL4IUV/hzabHZi4n9 PRID+T0pDZbeDyJqi4HtJj+In8FMjNSniAAxc3it0Rzb5FobI+TIWdcp0KJ8lQw0zu4s dX9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ziepe.ca header.s=google header.b=Qgcco7IZ; 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 c1si16310041pfo.68.2019.08.21.11.34.57; Wed, 21 Aug 2019 11:35:16 -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=Qgcco7IZ; 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 S1728470AbfHUSNq (ORCPT + 99 others); Wed, 21 Aug 2019 14:13:46 -0400 Received: from mail-qk1-f194.google.com ([209.85.222.194]:39080 "EHLO mail-qk1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728423AbfHUSNq (ORCPT ); Wed, 21 Aug 2019 14:13:46 -0400 Received: by mail-qk1-f194.google.com with SMTP id 125so2673289qkl.6 for ; Wed, 21 Aug 2019 11:13:45 -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=bHHnCAoSSDpRzr3ZJCedqeeuFCaqygWmcbOwu0GqMSA=; b=Qgcco7IZqTKFGWri3OFKIxQs50TLEE0TiNlti7iAsNa2YxoUtIEC/kmkG4mqzWd5vx dAEYm1l8akW6Dx6gkXMeyTYrYWzVvqqhXLc9Wi33WF5eexaQlMNP9I1tANW4BWLO9X4m U690GPIOS3FTXncPXRbHujnFKeyts2lwK8TpavTJeLIZzmMHBBQrWrIx6R4/RpLjsB+K jyh5fH82OUkzUtaCjFCtqAj5ocmtqZyIW2+9FMIJs00RrZvm58Azy/ZF7FnMOgpINn2B bTnaW1HjV9dtBuNXocm8W2Z0TEVmpnYHF+UdRfnviC/aqKSI5dij5v+64SWvwnRCwj6y /eyg== 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=bHHnCAoSSDpRzr3ZJCedqeeuFCaqygWmcbOwu0GqMSA=; b=Qx+cOpKaj1fHWj5dnCRn1TWuoq9V3YisGnqcyjOuryx1F3+Zq484EF0mPuf3fdJkgB gcj8yd6XTY4cOu3fhj5lO2t+5gssQQ2IDMZDe4Y4K/9FtitPPJTmj+7OOIVZEBRHYZIU nQgBLlTeMARBF1tqY7gRsKNwxGPyiEaBDavWiCIQTLrW28KY0vkb+sL/ZGmmqYUiTjTd MZ3va9AJg5h0nQUtIioZJ5xKADXxD4RIS3RTcrY4FVvgutqZmSzAZsO2B37rc7Od4Nif JVy7gQuKG2lW4gNDSQKdbOaa+nz3czXVg/oM1hcw1f3GP8cCHl7LPaKJScVHoFRCtGet 5JfA== X-Gm-Message-State: APjAAAWwBGYYQ0ZsNVvl6AaskzjaTO1ggiBTPLdhZyHIsubozLCkziEA svDpVkH6heEuE9QEhEJq/SwzAA== X-Received: by 2002:a05:620a:15c4:: with SMTP id o4mr26683337qkm.326.1566411224893; Wed, 21 Aug 2019 11:13:44 -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 i8sm10205025qkm.46.2019.08.21.11.13.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 21 Aug 2019 11:13:44 -0700 (PDT) Received: from jgg by mlx.ziepe.ca with local (Exim 4.90_1) (envelope-from ) id 1i0V79-00076J-Vz; Wed, 21 Aug 2019 15:13:43 -0300 Date: Wed, 21 Aug 2019 15:13:43 -0300 From: Jason Gunthorpe To: Ira Weiny Cc: Dave Chinner , Jan Kara , Andrew Morton , Dan Williams , Matthew Wilcox , 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 00/19] RDMA/FS DAX truncate proposal V1,000,002 ;-) Message-ID: <20190821181343.GH8653@ziepe.ca> References: <20190814180848.GB31490@iweiny-DESK2.sc.intel.com> <20190815130558.GF14313@quack2.suse.cz> <20190816190528.GB371@iweiny-DESK2.sc.intel.com> <20190817022603.GW6129@dread.disaster.area> <20190819063412.GA20455@quack2.suse.cz> <20190819092409.GM7777@dread.disaster.area> <20190819123841.GC5058@ziepe.ca> <20190820011210.GP7777@dread.disaster.area> <20190820115515.GA29246@ziepe.ca> <20190821180200.GA5965@iweiny-DESK2.sc.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190821180200.GA5965@iweiny-DESK2.sc.intel.com> 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 Wed, Aug 21, 2019 at 11:02:00AM -0700, Ira Weiny wrote: > On Tue, Aug 20, 2019 at 08:55:15AM -0300, Jason Gunthorpe wrote: > > On Tue, Aug 20, 2019 at 11:12:10AM +1000, Dave Chinner wrote: > > > On Mon, Aug 19, 2019 at 09:38:41AM -0300, Jason Gunthorpe wrote: > > > > On Mon, Aug 19, 2019 at 07:24:09PM +1000, Dave Chinner wrote: > > > > > > > > > So that leaves just the normal close() syscall exit case, where the > > > > > application has full control of the order in which resources are > > > > > released. We've already established that we can block in this > > > > > context. Blocking in an interruptible state will allow fatal signal > > > > > delivery to wake us, and then we fall into the > > > > > fatal_signal_pending() case if we get a SIGKILL while blocking. > > > > > > > > The major problem with RDMA is that it doesn't always wait on close() for the > > > > MR holding the page pins to be destoyed. This is done to avoid a > > > > deadlock of the form: > > > > > > > > uverbs_destroy_ufile_hw() > > > > mutex_lock() > > > > [..] > > > > mmput() > > > > exit_mmap() > > > > remove_vma() > > > > fput(); > > > > file_operations->release() > > > > > > I think this is wrong, and I'm pretty sure it's an example of why > > > the final __fput() call is moved out of line. > > > > Yes, I think so too, all I can say is this *used* to happen, as we > > have special code avoiding it, which is the code that is messing up > > Ira's lifetime model. > > > > Ira, you could try unraveling the special locking, that solves your > > lifetime issues? > > Yes I will try to prove this out... But I'm still not sure this fully solves > the problem. > > This only ensures that the process which has the RDMA context (RDMA FD) is safe > with regard to hanging the close for the "data file FD" (the file which has > pinned pages) in that _same_ process. But what about the scenario. Oh, I didn't think we were talking about that. Hanging the close of the datafile fd contingent on some other FD's closure is a recipe for deadlock.. IMHO the pin refcnt is held by the driver char dev FD, that is the object you need to make it visible against. Why not just have a single table someplace of all the layout leases with the file they are held on and the FD/socket/etc that is holding the pin? Make it independent of processes and FDs? Jason