Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1153835ybl; Thu, 22 Aug 2019 10:06:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxC2/nix3NBcdAJr9rSpe+eXBObPUbB75KdZbJUoSOVpD2uRvO4FxUuqOGB4NSCgHexTtMN X-Received: by 2002:a17:90a:b908:: with SMTP id p8mr688330pjr.65.1566493598060; Thu, 22 Aug 2019 10:06:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566493598; cv=none; d=google.com; s=arc-20160816; b=p4KSed269nHCipKjx+2xLt7tkDWtGx+s/BLE8lRqbAY5B8QHZsvcAURyLE3PsfwPVe Jv7qiobZl1i5neM+ZSl99sB/QthEaQR5CiLJD+p05FgtMwvOqb39NauLHHvXsmgaL7fI 3loUiKhUkJ+tQNGscb0pUUTcli8+Cl3EOYl7edmAgTgI0dI4YwqxXsBE5ZXCP567TgDt 5XL7jlzDYQ1Irug1DrxbFcOhK9rkx8YufrLY2H+L0nVwnF5a3/do+Ul5hJkMxnP+kqM2 x8NwM/Z4Xy6aN4QKctzMXscJB/w9PsnLAMsYePTrrqAErr0lxppfu8xM9kJwccve6yEr wlPQ== 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=cwBP49wgv9GpT3lrlMEKCg8L9f9WripwU7CUEp7Kne8=; b=MHn1mrT6jXY4h+yQC8y0CjYEuYCohZecQpYzZdEoOpr8O3FHx2PUn63cADEsvtgDTM QyQujw9auai2PTdI0aswOCF+BpMA3egxLBUW5lVWByYzqtmAvvEgaaYSgbHm07yYO4zo Y42fpFZ+Mshu4Y0WsEqHk3F/NkCrosHlMw5R8oajaeE04mxE2h9I5pxefZjEtDIfxbOx gvKPusDnhj9+V2zwTbCJYBxrG0tBE7n8/LJy1aKXMbhjmubcxehOFzeZ+G+wMTBaxm84 02OmjM+EPTlC1CFouB1OENzYT7wsJUg+CqSyWhRBEu+pGkNVWqpoW5wUijgHX1B3IQn+ vWCQ== 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 h4si150706pfo.131.2019.08.22.10.06.21; Thu, 22 Aug 2019 10:06:38 -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 S2388834AbfHVM7e (ORCPT + 99 others); Thu, 22 Aug 2019 08:59:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48218 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387779AbfHVM7d (ORCPT ); Thu, 22 Aug 2019 08:59:33 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1C3EE18C4261; Thu, 22 Aug 2019 12:59:33 +0000 (UTC) Received: from horse.redhat.com (unknown [10.18.25.158]) by smtp.corp.redhat.com (Postfix) with ESMTP id 406585D772; Thu, 22 Aug 2019 12:59:28 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id C5CFA223CFC; Thu, 22 Aug 2019 08:59:27 -0400 (EDT) Date: Thu, 22 Aug 2019 08:59:27 -0400 From: Vivek Goyal To: Liu Bo Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, linux-nvdimm@lists.01.org, virtio-fs@redhat.com, miklos@szeredi.hu, stefanha@redhat.com, dgilbert@redhat.com, Miklos Szeredi , Peng Tao Subject: Re: [PATCH 11/19] fuse, dax: Implement dax read/write operations Message-ID: <20190822125927.GA8999@redhat.com> References: <20190821175720.25901-1-vgoyal@redhat.com> <20190821175720.25901-12-vgoyal@redhat.com> <20190821194934.rqswgc52juisunl2@US-160370MP2.local> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190821194934.rqswgc52juisunl2@US-160370MP2.local> User-Agent: Mutt/1.12.0 (2019-05-25) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.62]); Thu, 22 Aug 2019 12:59:33 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 21, 2019 at 12:49:34PM -0700, Liu Bo wrote: [..] > > +static int iomap_begin_upgrade_mapping(struct inode *inode, loff_t pos, > > + loff_t length, unsigned flags, > > + struct iomap *iomap) > > +{ > > + struct fuse_inode *fi = get_fuse_inode(inode); > > + struct fuse_dax_mapping *dmap; > > + int ret; > > + > > + /* > > + * Take exclusive lock so that only one caller can try to setup > > + * mapping and others wait. > > + */ > > + down_write(&fi->i_dmap_sem); > > + dmap = fuse_dax_interval_tree_iter_first(&fi->dmap_tree, pos, pos); > > + > > + /* We are holding either inode lock or i_mmap_sem, and that should > > + * ensure that dmap can't reclaimed or truncated and it should still > > + * be there in tree despite the fact we dropped and re-acquired the > > + * lock. > > + */ > > + ret = -EIO; > > + if (WARN_ON(!dmap)) > > + goto out_err; > > + > > + /* Maybe another thread already upgraded mapping while we were not > > + * holding lock. > > + */ > > + if (dmap->writable) > > + goto out_fill_iomap; > > @ret needs to be reset here. > Good catch. Will fix it. Vivek