From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Baokun Li <libaokun1@huawei.com>,
Jeff Layton <jlayton@kernel.org>,
Gao Xiang <hsiangkao@linux.alibaba.com>,
Jia Zhu <zhujia.zj@bytedance.com>,
Christian Brauner <brauner@kernel.org>,
Sasha Levin <sashal@kernel.org>,
dhowells@redhat.com, netfs@lists.linux.dev
Subject: [PATCH AUTOSEL 6.9 04/11] cachefiles: cancel all requests for the object that is being dropped
Date: Tue, 16 Jul 2024 14:31:48 -0400 [thread overview]
Message-ID: <20240716183222.2813968-4-sashal@kernel.org> (raw)
In-Reply-To: <20240716183222.2813968-1-sashal@kernel.org>
From: Baokun Li <libaokun1@huawei.com>
[ Upstream commit 751f524635a4f076117d714705eeddadaf6748ee ]
Because after an object is dropped, requests for that object are useless,
cancel them to avoid causing other problems.
This prepares for the later addition of cancel_work_sync(). After the
reopen requests is generated, cancel it to avoid cancel_work_sync()
blocking by waiting for daemon to complete the reopen requests.
Signed-off-by: Baokun Li <libaokun1@huawei.com>
Link: https://lore.kernel.org/r/20240628062930.2467993-7-libaokun@huaweicloud.com
Acked-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Jia Zhu <zhujia.zj@bytedance.com>
Signed-off-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/cachefiles/ondemand.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/fs/cachefiles/ondemand.c b/fs/cachefiles/ondemand.c
index 14f91a9fbe447..1c0fa7412a6fa 100644
--- a/fs/cachefiles/ondemand.c
+++ b/fs/cachefiles/ondemand.c
@@ -636,12 +636,31 @@ int cachefiles_ondemand_init_object(struct cachefiles_object *object)
void cachefiles_ondemand_clean_object(struct cachefiles_object *object)
{
+ unsigned long index;
+ struct cachefiles_req *req;
+ struct cachefiles_cache *cache;
+
if (!object->ondemand)
return;
cachefiles_ondemand_send_req(object, CACHEFILES_OP_CLOSE, 0,
cachefiles_ondemand_init_close_req, NULL);
+
+ if (!object->ondemand->ondemand_id)
+ return;
+
+ /* Cancel all requests for the object that is being dropped. */
+ cache = object->volume->cache;
+ xa_lock(&cache->reqs);
cachefiles_ondemand_set_object_dropping(object);
+ xa_for_each(&cache->reqs, index, req) {
+ if (req->object == object) {
+ req->error = -EIO;
+ complete(&req->done);
+ __xa_erase(&cache->reqs, index);
+ }
+ }
+ xa_unlock(&cache->reqs);
}
int cachefiles_ondemand_init_obj_info(struct cachefiles_object *object,
--
2.43.0
next prev parent reply other threads:[~2024-07-16 18:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-16 18:31 [PATCH AUTOSEL 6.9 01/11] spi: imx: Don't expect DMA for i.MX{25,35,50,51,53} cspi devices Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 02/11] spi: davinci: Unset POWERDOWN bit when releasing resources Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 03/11] cachefiles: stop sending new request when dropping object Sasha Levin
2024-07-16 18:31 ` Sasha Levin [this message]
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 05/11] ksmbd: return FILE_DEVICE_DISK instead of super magic Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 06/11] ASoC: SOF: Intel: hda-pcm: Limit the maximum number of periods by MAX_BDL_ENTRIES Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 07/11] selftest/timerns: fix clang build failures for abs() calls Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 08/11] selftests/vDSO: fix clang build errors and warnings Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 09/11] hfsplus: fix uninit-value in copy_name Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 10/11] selftests/bpf: Extend tcx tests to cover late tcx_entry release Sasha Levin
2024-07-16 18:31 ` [PATCH AUTOSEL 6.9 11/11] spi: mux: set ctlr->bits_per_word_mask Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240716183222.2813968-4-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=brauner@kernel.org \
--cc=dhowells@redhat.com \
--cc=hsiangkao@linux.alibaba.com \
--cc=jlayton@kernel.org \
--cc=libaokun1@huawei.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netfs@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=zhujia.zj@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox