Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp177908lqd; Tue, 23 Apr 2024 20:49:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCX5PtyNj1LhLeBBGe7z4fwpzM+kAXIeTQoV/u45EgX+YTNjcQqIDAitpQx631t8ukC7fQWHLN8ueO1MU16CqReMzV4vd+auo4M+liyUFA== X-Google-Smtp-Source: AGHT+IGFnlW2C0TKt9277QXI2j56L/diKTnAb0zfbj+bDGLBrVsD9zCbFY+O/vFCmclx4pvfl4vh X-Received: by 2002:a2e:87d4:0:b0:2da:50f8:dfab with SMTP id v20-20020a2e87d4000000b002da50f8dfabmr652333ljj.7.1713930563090; Tue, 23 Apr 2024 20:49:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713930563; cv=pass; d=google.com; s=arc-20160816; b=Z/L6vWJwbjlDFAjF8W800iPNRoGxh2TzK0pMGI48cSmr1WZsnRDSRMykZ9C8AXbuA2 77nS6Yg/rSzY7pcC+BRitA10H/PSFNevrffleuvx3jCxnmP19e99SqSwAf5ELXrF9kK7 KInlYu+pkUXJTrVWJvA8zPbOODT+b051JHNoXv8vHoqO6gsNlvi6RIUrxQWDqFqtvWxN hCclwEfpB22et0RDrXg4cea/TKjuVrNeaC//n5ryUaynt63iLzNHmmqk5SKdEGj4njLD naDLuO2qlMzbmcvgegmeYrPwVplRDGM/0owylvtkuQEqQqxb+j0TzbtQQFaj7E7xP3cV jLVQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=RemIpD+B/h48eh5OlvfVfx6IL/jQFDuMAZhaL0887VI=; fh=FGAq13Dh0ICWnTZ1bINaUEc79yKht6kuxMzZnIgqSjw=; b=ZslL0lrO2lZsitSKTWtfK6BQSjg4AMxUabB7KH32ggseicUez1zqPFuRzDCVbPSv11 Qpg9c2Ho+Pp7fnpjTYnV81O1PxaHZ8u4GAJp06Lrxu7vy5EAloLb+PT5pgAeZvIdDC7U s1zUMCCnYxORFY5T7RE6zsbJUNJBVMWzsRNXPU8w744RAqXWjWUd7JS+i5dlPuptP1W5 mpn/kiWU6zKgaTBc7Tnj9zWHtC79Q/sp8xmKQDoelOProzlQhPScG2csCjVJgmkhC3Yx dTJ0ZmpILMVwgWXchaZf/qxWjF8NHjm/5rgLF43CIPGENMyC3tYUPG//dDJ/eJapeI4w I+Cw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-156238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156238-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c27-20020a50f61b000000b00568b856f574si7907657edn.145.2024.04.23.20.49.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 20:49:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-156238-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156238-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C11921F24D46 for ; Wed, 24 Apr 2024 03:49:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6066F142E76; Wed, 24 Apr 2024 03:48:35 +0000 (UTC) Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) (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 5DFBC13B5A6; Wed, 24 Apr 2024 03:48:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713930514; cv=none; b=cjFYxi+6XRGj4n3kr7NIGujEduIw8TDOmI6SvarjrCaj70gu7FnZATvAWsVYbu1ihyI0VdJh6m4+0EejtG5JAKw6nQdhip91403M5olJnEsPPpeAKroaaVHeRmj452NxB8mB8kzwqaFTPLEgWIF7EIU3ZHnWNzFEZ5Z6n4GLxBg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713930514; c=relaxed/simple; bh=pdyBPJU7U2EQ4gjJ/dHa8Y9qZl4bS6342Xfk7s4+8mY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=VLjv3gTxDYBUUoHRPCijWRu6PDOtzxbtPjqPnkSpOsWbpn3rqleVTqROLZWNmOI9p8N47rxoGPUgdspyo7I2uxcMvzxYj9Juhq+0xvTmJtwSHhBqDpRAh95yE2/m401K+498lwLvLn8GxEZ0qxunNWtkcoJqPCMa/A8XD472Upw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=45.249.212.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.19.163.216]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4VPQ214DDHz4f3jZV; Wed, 24 Apr 2024 11:48:25 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id 6E5481A0E09; Wed, 24 Apr 2024 11:48:30 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgCXaBELgShmKXE4Kw--.6143S5; Wed, 24 Apr 2024 11:48:30 +0800 (CST) From: libaokun@huaweicloud.com To: netfs@lists.linux.dev Cc: dhowells@redhat.com, jlayton@kernel.org, zhujia.zj@bytedance.com, jefflexu@linux.alibaba.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, libaokun@huaweicloud.com, Baokun Li Subject: [PATCH 01/12] cachefiles: remove request from xarry during flush requests Date: Wed, 24 Apr 2024 11:39:05 +0800 Message-Id: <20240424033916.2748488-2-libaokun@huaweicloud.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240424033916.2748488-1-libaokun@huaweicloud.com> References: <20240424033916.2748488-1-libaokun@huaweicloud.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:cCh0CgCXaBELgShmKXE4Kw--.6143S5 X-Coremail-Antispam: 1UD129KBjvdXoWrAF4DAFWfWr4kAry8Aw4ruFg_yoWxGwb_uF ZrArWkXrs3Gwn7A3y3ZryDXF4jqw48Ar13Cr15KF43A3sxJry5CF4qqr95XayUC34j9FZr Zw1kZF1Yqr1qgjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbPkFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k26cxKx2IYs7xG 6r1F6r1fM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGwA2048vs2IY02 0Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxSw2x7M28EF7xv wVC0I7IYx2IY67AKxVWDJVCq3wA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxVW8Jr0_Cr1UM2 8EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v26rxl6s0DM2AI xVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMcIj6xIIjxv20x vE14v26r1Y6r17McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_Jr0_Gr1lF7xv r2IYc2Ij64vIr41lF7I21c0EjII2zVCS5cI20VAGYxC7M4IIrI8v6xkF7I0E8cxan2IY04 v7M4kE6xkIj40Ew7xC0wCY1x0264kExVAvwVAq07x20xyl42xK82IYc2Ij64vIr41l4I8I 3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxV WUGVWUWwC2zVAF1VAY17CE14v26r1q6r43MIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAF wI0_Gr0_Xr1lIxAIcVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1lIxAIcVCF04k26cxKx2 IYs7xG6r1j6r1xMIIF0xvEx4A2jsIE14v26r4j6F4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_ Gr1j6F4UJbIYCTnIWIevJa73UjIFyTuYvjTRMWlvUUUUU X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/ From: Baokun Li This prevents concurrency from causing access to a freed req. Signed-off-by: Baokun Li --- 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); -- 2.39.2