Received: by 2002:a89:48b:0:b0:1f5:f2ab:c469 with SMTP id a11csp176484lqd; Tue, 23 Apr 2024 20:43:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW3msxCS9BT5+FmC2thllEEwlOvG2nZEuP5Sl8unTMAQk9lEfbRE2sd9dECF8HNaeII+8fR4HvcmtTpDEMvri5CMT+bgTheOLBXOBbF/g== X-Google-Smtp-Source: AGHT+IE33L+XxQIbXg71ovnBbwoHWJr6TqEwyLsGvxLx+7J+4ywieSF/wRbpjGqqxrTgZz7pdIN4 X-Received: by 2002:a05:622a:30f:b0:439:80de:9c96 with SMTP id q15-20020a05622a030f00b0043980de9c96mr1592884qtw.32.1713930217349; Tue, 23 Apr 2024 20:43:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713930217; cv=pass; d=google.com; s=arc-20160816; b=s4eqIh36VoPkt1agS9DPhdNB0Ej8apzdVqWcVC+/9TPGXgEZz2TAN+nWIeF3DytRLO ArCuiyPly8yyVdDSOVygq84Dkw0Fdg4u7tt0FYEtoZs2PJjSC1JLOhSEzQB2x3k6oWXr IvO5LnIsB+piujHnqjUmrvLld9HU4ma28g9g3ZhTA53rjdEgt7eXXIYdEhvK2Lg7Mq45 NyBeBx8HkhyOZPmSErnICs2mzXW/3IgGBAZ1+H0hJdGJJau42USkBUrhYQq0p/qvm8w1 VuQXux7h9boNyfkJ/9/nuV04FMt7fUEO6Xr9M5nOpH2VqqvpxH0Hi8dQny7KwSb9SXdO SaRA== 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:message-id:date:subject:cc:to :from; bh=+rnk4CaKICa3uf2pKVWwrMYHnwycP4POOJHLtx00YxI=; fh=Ye1aB3Y8ZI5cub/+xDqe1Iol73ORxWApZQj750gAZJs=; b=m4sGKiqp/eJgV96qTkS/5kmhXpbBZ12f0HpvEl5fhaA5d5IZfzoKW5kjioKbBRN0jB ehSML/SV1M/bpgc5iWef/y1jFkIXutX7Nb0sE3SUqnKogadqdEasW31hPB77sM8RfbIh 1zcBH6UbZ6Zs1sYbiAx/z+IaFT39RBuRQzuEnjPQJLdh9yFjHTShZUiPPxyGKX1ZQbpb 7o932gjXXJXhCedprbe8zD5udtnB42fzhsVOCK3SNHtlBB8dyE8wPJ9HWssk8ViNwqi0 KZldhhPx+p3wMapXzoh+l3ydJzSB9D5f1UDPKGwKKviEaW27pHIAfy6fZzj43a//3WDf vp3Q==; 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-156225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156225-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id d2-20020ac85ac2000000b0043a18d4588bsi883686qtd.749.2024.04.23.20.43.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 Apr 2024 20:43:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-156225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-156225-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-156225-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 199251C23466 for ; Wed, 24 Apr 2024 03:43:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AD2EF13CFAD; Wed, 24 Apr 2024 03:43:28 +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 8F2AA85C59; Wed, 24 Apr 2024 03:43:26 +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=1713930208; cv=none; b=Faeq87iUJy9tcKXYtGf0QITc7GVuRrmMzXyv4v7ekIH9YoYJbsfqCFIXWlFhpAois51keFFvIKZrHy6U3zq1rGlugHIhFmBimG7PjdinBAXTKrR/jxIN38L62OGcAP4rRv6wixiqU5t5vRNswT+C5TsDn/HAqGug4xPWwLjS02E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713930208; c=relaxed/simple; bh=NXQYY86D+GDRBXc8Sz0xux5RIySTPOpCMXcp/jSOXFs=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=biTpjNQyVq7Z+zdS9nWqvxaopQ32bB43wz+G3pV7wgkJBsQN0H/QXc6SF1VRbOsR67OsAzoNTqoJRck1CLiDHghga53j6wQUFqC88JQiJQ/UrPyXdVrbgywBfv+yIGgTFSgVazPPeaqNliCA4QqmFdaLbtYmlwHIWwpMJjBxJ+s= 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 4VPPw65qbcz4f3l8g; Wed, 24 Apr 2024 11:43:18 +0800 (CST) Received: from mail02.huawei.com (unknown [10.116.40.112]) by mail.maildlp.com (Postfix) with ESMTP id A819E1A0EE6; Wed, 24 Apr 2024 11:43:23 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.104.67]) by APP1 (Coremail) with SMTP id cCh0CgBHGBHafyhmuSA4Kw--.57541S4; Wed, 24 Apr 2024 11:43:23 +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-cachefs@redhat.com, linux-erofs@lists.ozlabs.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, libaokun@huaweicloud.com, Baokun Li Subject: [PATCH 0/5] cachefiles: some bugfixes for clean object/send req/poll Date: Wed, 24 Apr 2024 11:34:04 +0800 Message-Id: <20240424033409.2735257-1-libaokun@huaweicloud.com> X-Mailer: git-send-email 2.39.2 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:cCh0CgBHGBHafyhmuSA4Kw--.57541S4 X-Coremail-Antispam: 1UD129KBjvJXoW7JF48GFW7Xr43Xr1DXrW5KFg_yoW8JF4rpF Wav3W3JFy8Wr12kws3Zw1rJrWrC3s3ZF9rtF47XrykArn8XF1FvrW0yrn8ZFyUCrZ7Gw42 gw48WF929wn0v3DanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUB214x267AKxVW8JVW5JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWUWVWUuwAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4U JVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_Gc CE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E 2Ix0cI8IcVAFwI0_JrI_JrylYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJV W8JwACjcxG0xvY0x0EwIxGrwACjI8F5VA0II8E6IAqYI8I648v4I1lFIxGxcIEc7CjxVA2 Y2ka0xkIwI1lw4CEc2x0rVAKj4xxMxkF7I0Ew4C26cxK6c8Ij28IcwCF04k20xvY0x0EwI xGrwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480 Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_Jw0_GFylIxkGc2Ij64vIr41lIxAIcVC0I7 IYx2IY67AKxVWUCVW8JwCI42IY6xIIjxv20xvEc7CjxVAFwI0_Cr0_Gr1UMIIF0xvE42xK 8VAvwI8IcIk0rVWrJr0_WFyUJwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6x kF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfU0_-PUUUUU X-CM-SenderInfo: 5olet0hnxqqx5xdzvxpfor3voofrz/ From: Baokun Li Hello everyone! Recently we found some bugs while doing tests on cachefiles ondemand mode, and this patchset is a fix for some of those issues. The following is a brief overview of the patches, see the patches for more details. Patch 1-3: After an object has been cleaned up, make sure it has no outstanding requests and that the corresponding ondemand_object_worker has exited, otherwise it may use-after-free. Patch 4: Cyclic allocation of msg_id to avoid msg_id reuse misleading the daemon to cause hung. Patch 5: Hold xas_lock during polling to avoid dereferencing reqs causing use-after-free. Comments and questions are, as always, welcome. Thanks, Baokun Baokun Li (3): cachefiles: stop sending new request when dropping object cachefiles: flush all requests for the object that is being dropped cachefiles: cyclic allocation of msg_id to avoid reuse Hou Tao (1): cachefiles: flush ondemand_object_worker during clean object Jingbo Xu (1): cachefiles: add missing lock protection when polling fs/cachefiles/daemon.c | 4 +- fs/cachefiles/internal.h | 3 + fs/cachefiles/ondemand.c | 120 ++++++++++++++++++++++++++------------- 3 files changed, 86 insertions(+), 41 deletions(-) -- 2.39.2