Received: by 2002:a25:86ce:0:0:0:0:0 with SMTP id y14csp11682ybm; Mon, 20 May 2019 10:59:23 -0700 (PDT) X-Google-Smtp-Source: APXvYqzLR6eaukd3tW6YlqeqPTsaqiwgblvuvqiJ/jtxDIrPX/BUFTw7rCp+dJU2fmPENbLJXWDT X-Received: by 2002:a63:1119:: with SMTP id g25mr40852701pgl.380.1558375163038; Mon, 20 May 2019 10:59:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558375163; cv=none; d=google.com; s=arc-20160816; b=W0zHrYSOSaPrBVOYLRR7hY7MeV7hZ+WrfMR4scEiGR3OEA457qow55/xJ7+Mr7UTTS 1FRftY6zc1zZW6QCe/w37zHrEH5noBan9l96S/XSpLpGELXirHQIJmN1GESAhK7fP5AT M+iYxyT4ayxHS13hE5RythPY/n6Z7+HmRBz5k3I5o5ueciQwTOj2ytQD2tXlSGRqPaBr fbER7J6fScZjjvEsu5OkMnv+v94ciLusDWqY/SBQSXhfeh2DIx0cJ07cFzXqYF4OK6Sz QyoU9VPjRQJHmVqySI8agBnY94TkqznX+pYbR9C0UMr+UcESvBtNCW3Oosimmin3xpTD SxnA== 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; bh=jO8Sx9HhuxfAxChPgJ4gUjB104838uFLuUqhiNuHJJ0=; b=AFRgcMcvGZxAxPG5Y4F8nH7ijS8bGHE0Qb6CAP1jHF4tnVfWUgtx7YrajPeW7rDkl0 Cv3u+82+P7meekhDn49IKuvWAxT0TSjDNKBGgryJvo6g/0xKdneTK2BR9YQ8rh3BgOKV nko/fOvpqyRcEcB6M1IjQclW2B83YdRdFDX4gPE0CIzaXznM5I76ZpSc4KQ3GHZl2tBm qv9dz2CIEfYgFRaCK0K7frS0NYTE20qlqkHNgUaKq+UrvV21jKgjSBYd52CvJZobgMNw 7z3NCVF8Tr6QcAq+yudHbhQqq/AS3vRE1uNflgFgDLM1h5Byg43u9gU4biWMG0axYI21 vAsw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b32si18883173pla.294.2019.05.20.10.59.08; Mon, 20 May 2019 10:59:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388161AbfETMyH (ORCPT + 99 others); Mon, 20 May 2019 08:54:07 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57330 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731662AbfETMyF (ORCPT ); Mon, 20 May 2019 08:54:05 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5D89D3091782; Mon, 20 May 2019 12:54:00 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.29]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6BBDB6085B; Mon, 20 May 2019 12:53:56 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 06ECD220386; Mon, 20 May 2019 08:53:56 -0400 (EDT) Date: Mon, 20 May 2019 08:53:55 -0400 From: Vivek Goyal To: Eric Ren Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, linux-nvdimm@lists.01.org, miklos@szeredi.hu, stefanha@redhat.com, dgilbert@redhat.com, swhiteho@redhat.com Subject: Re: [PATCH v2 26/30] fuse: Add logic to free up a memory range Message-ID: <20190520125355.GA28008@redhat.com> References: <20190515192715.18000-1-vgoyal@redhat.com> <20190515192715.18000-27-vgoyal@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.3 (2019-02-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 20 May 2019 12:54:05 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 19, 2019 at 03:48:05PM +0800, Eric Ren wrote: > Hi, > > @@ -1784,8 +1822,23 @@ static int fuse_iomap_begin(struct inode *inode, > > loff_t pos, loff_t length, > > if (pos >= i_size_read(inode)) > > goto iomap_hole; > > > > - alloc_dmap = alloc_dax_mapping(fc); > > - if (!alloc_dmap) > > + /* Can't do reclaim in fault path yet due to lock ordering. > > + * Read path takes shared inode lock and that's not > > sufficient > > + * for inline range reclaim. Caller needs to drop lock, > > wait > > + * and retry. > > + */ > > + if (flags & IOMAP_FAULT || !(flags & IOMAP_WRITE)) { > > + alloc_dmap = alloc_dax_mapping(fc); > > + if (!alloc_dmap) > > + return -ENOSPC; > > + } else { > > + alloc_dmap = alloc_dax_mapping_reclaim(fc, inode); > > > > alloc_dmap could be NULL as follows: > > alloc_dax_mapping_reclaim > -->fuse_dax_reclaim_first_mapping > -->fuse_dax_reclaim_first_mapping_locked > --> fuse_dax_interval_tree_iter_first ==> return NULL > and > > IS_ERR(NULL) is false, so we may miss that error case. Hi Eric, Good catch. I will fix it next version. Thanks Vivek