Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp1163794lqh; Sun, 5 May 2024 20:49:14 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVhkAFjWDv6vmzIk0xOrAYnveSBa/0Ani+shB39tp9j38kPkFUtpINy0BATqmvV85YY8LKgHXQGvFCUisoC8BY1G7OBWjWylMgnZAALFg== X-Google-Smtp-Source: AGHT+IF5hFXfRdMXhl01YxigeVs77lfXj7wQuso8U0qAg6FVmqU/VvPpRNxPtLtksBPyH+lga7vy X-Received: by 2002:a05:6214:b6c:b0:6a0:5baa:1103 with SMTP id ey12-20020a0562140b6c00b006a05baa1103mr11362579qvb.39.1714967354626; Sun, 05 May 2024 20:49:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714967354; cv=pass; d=google.com; s=arc-20160816; b=ZVnBnqpyPWMLVB4/DKivMjEyTzyJk193Bhmx0ZvCcoFfvFweB9fXBz2tP4cNvKY2jm vWoDf1kV5xwQYu8/xYsPEkTzSfIMu77YyoQHQNJManHi+1oEU/MmLrA9ul8IstqvD63w 6vpfs2uIrQiIaZqOsA5QG8hrbqQSXXTf6Ad5ackIAbZTokHoG/ZB1JunX6V9t9++Bxqo 25vMDav3JB0mWoh3m+a+NKA8lShUrlJwN2ptQ4lG8HR7Sdx2vwuReVRVYlqk38cIt2yD wvzfJGLBOx9GFPBk1TJ6RAse9GRWUtNQsPgqbabz6gkNoL3sl7Q+k0TJ4f8AA4CGxlOs REHg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=j3Aqf3b+i7muF6AejD4CXK0yCEDvofmWz+0c/tM9NRY=; fh=iMK7N1JiksCi/0omnYSDfuai+RJNcbpz1q87dv7YUA4=; b=Y3tGYZIpgzt/v6f+Xn3X9yvulkrQ2naltbCU9uJO+iRALj55dFenOX0ALtZPx88Ts8 q0/uayUxSOdmTkCaQWY0VgTxvjlDsYNTG3eTZeatcWJ6vxGHXjsR7Pw3wwz2b3Dqnb51 uEVJ6r9RU1qACa6N1wDUIgY/qcwtORL2aPFeJk20f4nIKN9VNtgvcteI4yvd2E5UjhJF AUz2F8K9aVflicbUw/AdEY58ObZgCxWPiaChJCzzNMH0hLQj/F7cvp/JpmetlRfodsox XeE1Vwfg6itStyCWVcNSYoLR0YSblne72kX6+ieZ9D25FbKgj14kD9jhcAP7c/PgZeJN X4VA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=vekq48yL; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-169284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id a6-20020ad45c46000000b006a08e153ea5si9052881qva.55.2024.05.05.20.49.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 20:49:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.alibaba.com header.s=default header.b=vekq48yL; arc=pass (i=1 spf=pass spfdomain=linux.alibaba.com dkim=pass dkdomain=linux.alibaba.com dmarc=pass fromdomain=linux.alibaba.com); spf=pass (google.com: domain of linux-kernel+bounces-169284-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169284-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.alibaba.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 1A5CA1C203BB for ; Mon, 6 May 2024 03:49:14 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F0A6344376; Mon, 6 May 2024 03:49:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="vekq48yL" Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DE7BE2D044; Mon, 6 May 2024 03:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.118 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714967343; cv=none; b=MNdTK8NS+7NgAZR7EI2qCgv7xwp1AXQsf83EaJvQhi3BB5dmZlvtX7cPYZtKQehTTl4lel2/1kAqJ4HS4LOIHjgeRD6s7j4hWREe42yamLjA0M58rdpOpBM6E5MTZWkoHukh85gtVbCWu6xr1vCsjfS84n3NZepntiI/rzsPLlk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714967343; c=relaxed/simple; bh=kxz8UrFictU+NsZQY7c3vhSPA+qILia20awE6iLFv4E=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Isvdea/FF8ay1D+b8ivR5zdiXtkzGYqq7QXyOh0JE2MTYWTb7xpRaDMUEsFDz+xrkQfiw4emsqABGhITBc3eVJgGFEEKcsw3IsEbsZKQAoRQm67xW2mozyfyCYHLAfrZS5iwDqw+cGCQctXd4d796su7h/L4Z/daiGxxXZNNTNQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=vekq48yL; arc=none smtp.client-ip=115.124.30.118 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1714967337; h=Message-ID:Date:MIME-Version:Subject:To:From:Content-Type; bh=j3Aqf3b+i7muF6AejD4CXK0yCEDvofmWz+0c/tM9NRY=; b=vekq48yL4AeTVEGP6yhx0BxoVI8nWWG3GGZK0j/IULUNFrC9TUOBDyyG8UptzxzxhufHvq0CISoQE7+TCLMM11fi8idzpRwJFPq4Hm+qrlc4VTHC5rwshQo9AZCB2Nu5ZTPORZUKn3sT1kWJs7PrndGF9Q2dgcmc8fpNnL2LEQA= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R171e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033037067113;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=9;SR=0;TI=SMTPD_---0W5sGzlR_1714967335; Received: from 30.221.146.217(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0W5sGzlR_1714967335) by smtp.aliyun-inc.com; Mon, 06 May 2024 11:48:56 +0800 Message-ID: <6e4a20f7-263a-46be-81cc-2667353c452d@linux.alibaba.com> Date: Mon, 6 May 2024 11:48:54 +0800 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 01/12] cachefiles: remove request from xarry during flush requests To: libaokun@huaweicloud.com, netfs@lists.linux.dev Cc: dhowells@redhat.com, jlayton@kernel.org, zhujia.zj@bytedance.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Baokun Li References: <20240424033916.2748488-1-libaokun@huaweicloud.com> <20240424033916.2748488-2-libaokun@huaweicloud.com> Content-Language: en-US From: Jingbo Xu In-Reply-To: <20240424033916.2748488-2-libaokun@huaweicloud.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 4/24/24 11:39 AM, libaokun@huaweicloud.com wrote: > From: Baokun Li > > This prevents concurrency from causing access to a freed req. Could you give more details on how the concurrent access will happen? How could another process access the &cache->reqs xarray after it has been flushed? > --- > fs/cachefiles/daemon.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/fs/cachefiles/daemon.c b/fs/cachefiles/daemon.c > index 6465e2574230..ccb7b707ea4b 100644 > --- a/fs/cachefiles/daemon.c > +++ b/fs/cachefiles/daemon.c > @@ -159,6 +159,7 @@ static void cachefiles_flush_reqs(struct cachefiles_cache *cache) > xa_for_each(xa, index, req) { > req->error = -EIO; > complete(&req->done); > + __xa_erase(xa, index); > } > xa_unlock(xa); > -- Thanks, Jingbo