Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp324444ybv; Wed, 19 Feb 2020 00:06:52 -0800 (PST) X-Google-Smtp-Source: APXvYqzA1yrX67GAzP0AIRK+SvnwX9MxMo9/U2nNjicPWNif7MUQdmrqOh+ggd/CtJwIsEAttNZ7 X-Received: by 2002:a05:6830:22d8:: with SMTP id q24mr3937316otc.0.1582099612343; Wed, 19 Feb 2020 00:06:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582099612; cv=none; d=google.com; s=arc-20160816; b=itDs69eNy5uMSZSmZBQlFPdvjZYa+tp0N3wGiK4BckMWFJuetCnweQBSMkN9Gtbg1H BO/GvuBMqpxiUowixFOPcOrgcCOnbzGVcp2ttf9TEhxzmg2no3NkOiylfg8ZZjMi7HO8 KtOswB/zG5xJT0lE9yvB8l45G1ZhUcS+KIO+JzcG5eEH6rxMZBskmZ3bN93kSe+8Lkbv uY0wsCYzPHqr8AEh/mPMOlz/UfAiqfd+cJ6hzhbZ1krgfUoryAGTIuARCq9cPveIg0+R wmCBCAfqO7BGG0xRj2QHyvdJmFf2vwnzq5j+reAyc5UHi73zgJSl8tmIg3XumxCq6Zf+ 1H2Q== 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=tBtrV+xmXxMdAq7Pe5AR6JrjEw6xRDk2GeHOr25mtP0=; b=mJBk/isV7mGE9mPePrjQJMih6KujJqMsDLWsQ3xfQY54h3yGXDqmTg1BLE5Ft44AN0 mEJnVWguH8UVUwcQuUTY5uv1KJ2I/XuT6jfl/CmlSccY5lJ1+Z7Ko5GqjGDRomvOjXfT 7PQIm9m3h94MYI9LtA8nrVylZ2RjnJ9lbt4kwjeTbtAilrqRAkN+Rp7I7JFxipiZPs/z WUUVWl5eEId1NepunoxWrels51p3lOzot9BtUhbFDVoK+aKTpX7DsTw1IXeYIbfQMSsv LGBAKULQgJQ6xyw2meONxrIXhAiyYW+IKb2//mFcwECARXgw4JTFNDFLi2wUWOYItYLH 4JJw== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11si8914690oim.223.2020.02.19.00.06.40; Wed, 19 Feb 2020 00:06:52 -0800 (PST) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726772AbgBSIGY (ORCPT + 99 others); Wed, 19 Feb 2020 03:06:24 -0500 Received: from szxga03-in.huawei.com ([45.249.212.189]:2584 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726163AbgBSIGX (ORCPT ); Wed, 19 Feb 2020 03:06:23 -0500 Received: from DGGEMM404-HUB.china.huawei.com (unknown [172.30.72.53]) by Forcepoint Email with ESMTP id 9B368CBC75E280C9FAF4; Wed, 19 Feb 2020 16:06:16 +0800 (CST) Received: from dggeme762-chm.china.huawei.com (10.3.19.108) by DGGEMM404-HUB.china.huawei.com (10.3.20.212) with Microsoft SMTP Server (TLS) id 14.3.439.0; Wed, 19 Feb 2020 16:06:15 +0800 Received: from architecture4 (10.160.196.180) by dggeme762-chm.china.huawei.com (10.3.19.108) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1713.5; Wed, 19 Feb 2020 16:06:15 +0800 Date: Wed, 19 Feb 2020 16:04:57 +0800 From: Gao Xiang To: Chao Yu CC: , Matthew Wilcox , LKML , Miao Xie Subject: Re: [PATCH v2] erofs: convert workstn to XArray Message-ID: <20200219080456.GA126843@architecture4> References: <20200217033042.137855-1-gaoxiang25@huawei.com> <58f1ff26-e1f8-96a4-fa7b-ee86f972b0aa@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <58f1ff26-e1f8-96a4-fa7b-ee86f972b0aa@huawei.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-Originating-IP: [10.160.196.180] X-ClientProxiedBy: dggeme708-chm.china.huawei.com (10.1.199.104) To dggeme762-chm.china.huawei.com (10.3.19.108) X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chao, On Wed, Feb 19, 2020 at 03:46:16PM +0800, Chao Yu wrote: > On 2020/2/17 11:30, Gao Xiang wrote: [] > > - return err; > > + sbi = EROFS_SB(sb); > > +repeat: > > + xa_lock(&sbi->managed_pslots); > > + pre = __xa_cmpxchg(&sbi->managed_pslots, grp->index, > > + NULL, grp, GFP_NOFS); > > + if (pre) { > > It looks __xa_cmpxchg() could return negative value in case of failure, e.g. > no memory case. We'd better handle that case and old valid workgroup separately? Thanks, that is a quite good catch! To be honest, I'm not quite sure whether __xa_cmpxchg could fail due to no memory here (as a quick scan, it will do __xas_nomem loop interally.) But anyway, it needs bailing out all potential errors by using xa_is_err(). Will do some research and send v3 then. Thanks, Gao Xiang