Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4509132ybb; Tue, 14 Apr 2020 08:38:48 -0700 (PDT) X-Google-Smtp-Source: APiQypJ+Vs61X0daoz7yGQGcFhj87qnozfATHONoTIKK1zXS9iAvaK7vJbCI+jb1JY/7JCU/CUdW X-Received: by 2002:a17:906:bcec:: with SMTP id op12mr690326ejb.245.1586878728510; Tue, 14 Apr 2020 08:38:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586878728; cv=none; d=google.com; s=arc-20160816; b=rj9voOl2DtyYB20+TNtioWNqePvDh4V72O1Cjk9OeS09K40yfBSjCdS4EkLfYxyY1C BZjdZnu3U3wU7t5NCXeeo4Wkf1V9bnIaM1Fu3sS7GbEBHTf7oZnGEwy+oxplnpj2ge8n XNpQQozvH/x15z+N0qcsD7IWR3wAER4gDPOehR41Y9H75Dn2HmDo/FQYE4cfDGUu195O e0hxx6vcXowWBV7S2AClLBXn9L5C7mSXJQAg68C2MYXqIy+dOLmbHXKFQZ0uR4lTz/at O5VsqEMgfQm7x2QETSZcguCH5Yth2u5bnl5PzCU4elvG8GkvJ0Ip4D80+RVHRHpluc6r BD6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Ccpe52mTDyC9nOe0e/xM0kPaLBd9rNdSI9IJFo2/EN8=; b=JlC4chsSYZHNs9qiwyYc3Bq4xfPXp54y7PqHOEq+bjltpm6u5El/HK9BVrhAJCU4NK Y+/X1xFVTDEFxaWb6dRv3yWgYvmOE03bUetFmbNPE9AaZLMCgY5R4dZM6hV1rHWeB/eR FdkqtOtOZxEdz/4bTDmwJPcsgLnfw4VwmrtnAgoAHwxa7mhCK/TWVOpAqXKrbmPgPP4f Hf6XcYxx6nFTXKwdM3eJVGFnvqUVnbLyhmMJDgghIHPSIaR3oGJaqx4ddOdRyAwb4FfC OhsFKc2nfkfJmARReVbVOOF2SXIyI/xEPyVtgXZZ2Oh9b+mrfIn76yNIHGQnE8aeMSeX qd7A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U6B+tvpR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s7si8326557ejj.248.2020.04.14.08.38.24; Tue, 14 Apr 2020 08:38:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=U6B+tvpR; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2502353AbgDNMya (ORCPT + 99 others); Tue, 14 Apr 2020 08:54:30 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:53684 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2502341AbgDNMyZ (ORCPT ); Tue, 14 Apr 2020 08:54:25 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1586868864; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=Ccpe52mTDyC9nOe0e/xM0kPaLBd9rNdSI9IJFo2/EN8=; b=U6B+tvpRgOIhvhgJ1oTbnVVoE2VQAXaYBM2kIlZS8qxVcMi/1nIVfaPl6oAJBVuVSgAx6U m+WZgWkRVdNjyDSvhOVnJZAI6JyZ8+lQo6RzsTNKMwSLLcIScYKrh1XuAxuXMd0Dg32yap rsUJMW8xRa0v6hE9a5P6viZcpcVjgxU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-78-YVT18TVnP6iwR2Qxc-UDZw-1; Tue, 14 Apr 2020 08:54:22 -0400 X-MC-Unique: YVT18TVnP6iwR2Qxc-UDZw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BF89D8017FF; Tue, 14 Apr 2020 12:54:20 +0000 (UTC) Received: from horse.redhat.com (ovpn-115-133.rdu2.redhat.com [10.10.115.133]) by smtp.corp.redhat.com (Postfix) with ESMTP id B509A10027B3; Tue, 14 Apr 2020 12:54:11 +0000 (UTC) Received: by horse.redhat.com (Postfix, from userid 10451) id 24C16220935; Tue, 14 Apr 2020 08:54:11 -0400 (EDT) Date: Tue, 14 Apr 2020 08:54:11 -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, mst@redhat.com, Miklos Szeredi , Peng Tao Subject: Re: [PATCH 13/20] fuse, dax: Implement dax read/write operations Message-ID: <20200414125411.GA210453@redhat.com> References: <20200304165845.3081-1-vgoyal@redhat.com> <20200304165845.3081-14-vgoyal@redhat.com> <20200404002521.GA125697@rsjd01523.et2sqa> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200404002521.GA125697@rsjd01523.et2sqa> X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Apr 04, 2020 at 08:25:21AM +0800, 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) > > oops, looks like it's still returning -EIO here, %ret should be zero. > Good catch. Will fix it. Vivek