[PATCH v2 5/7] ceph: set default timeout for MDS requests
From: Ionut Nechita
Date: Fri Nov 20 2026 - 02:36:21 EST
MDS requests created via ceph_mdsc_create_request() have r_timeout
initialized to 0 (from kmem_cache_zalloc). When r_timeout is 0,
ceph_timeout_jiffies() returns MAX_SCHEDULE_TIMEOUT, causing
ceph_mdsc_wait_request() to wait indefinitely.
This causes hung task warnings when MDS becomes unavailable during
operations like setattr or truncate:
INFO: task dd:12345 blocked for more than 122 seconds.
Call Trace:
ceph_mdsc_wait_request+0x...
ceph_mdsc_do_request+0x...
__ceph_setattr+0x...
Only the mount path in super.c explicitly sets r_timeout to
mount_timeout. All other MDS requests (setattr, lookup, mkdir,
etc.) use the default 0 value, making them wait forever.
Fix this by initializing r_timeout to mount_timeout in
ceph_mdsc_create_request(). This ensures all MDS requests have
a reasonable timeout and will fail with -ETIMEDOUT rather than
hanging indefinitely.
Signed-off-by: Ionut Nechita <ionut.nechita@xxxxxxxxxxxxx>
Reviewed-by: Viacheslav Dubeyko <Slava.Dubeyko@xxxxxxx>
---
fs/ceph/mds_client.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index d02fe1e34527b..4460f614050e4 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -2852,6 +2852,7 @@ ceph_mdsc_create_request(struct ceph_mds_client *mdsc, int op, int mode)
mutex_init(&req->r_fill_mutex);
req->r_mdsc = mdsc;
req->r_started = jiffies;
+ req->r_timeout = mdsc->fsc->client->options->mount_timeout;
req->r_start_latency = ktime_get();
req->r_resend_mds = -1;
INIT_LIST_HEAD(&req->r_unsafe_dir_item);
--
2.56.0