From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f47.google.com (mail-wm1-f47.google.com [209.85.128.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9E43224B1E for ; Tue, 17 Mar 2026 21:33:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773783187; cv=none; b=QQIdu1aRbYWo/WGvWflWzNcg70Tk7NeomGAKVDGQTtQxjLessRAuwjuym7lgWtK48XvA+xWpBwN2yKwMSn1xNXtRcz7vh0yTivMyZVHbBZkiM24ovRwtHOaOA4HwrRgvp4xHq7ybtjTfCozi8yeNzCukPUQMKdgfzHmrcv8xo0k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773783187; c=relaxed/simple; bh=YHbHT9AJemHssuLOo73VnL6wbjXVR6hqjg5+7PWPXsc=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Ix9DVmcXh+Sl6iONGff9TyGk+JT+bbKmq37rTNv+y78aGtO0YyivRXcAQd7CT8A1jNBEb8/8Y7evotng0yE5tbas16RkRlrydgqiwvTxDRkyNubS9jurYKSCm52zIhBAFs0kAKJM5IfSs3GFlGGGIa+Byl0jtHisPC652W7Drf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=b5w5K7wz; arc=none smtp.client-ip=209.85.128.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="b5w5K7wz" Received: by mail-wm1-f47.google.com with SMTP id 5b1f17b1804b1-4856cd3f1ffso717885e9.3 for ; Tue, 17 Mar 2026 14:33:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1773783184; x=1774387984; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=9k1Q78vvWMlaqGXjHpQUyuVWvxrimwsZXLbDTbmHPWc=; b=b5w5K7wzKK/BzCSHI6TNPHSWtCHhwNWS1WVNRAEzQJO+hk0qBiOX4YPPlWtvN/+8lA 2o0rHZaWPqSwe8lFHVdRqoBPBp9GRbS6KclUl5t1Cb66x8WdRw1kO85b/psrY6qs5Hcf rVn/tTn31Tf+owVtNWX+oQJHF9QFjDxaKfKR3r3ZPXmjmAYK1v4npl9X+FTkP1aUCmWf c4qjoKOqZ6FXHcpTKMiySh9oKQk+jFNDTct0zZjOCkps8BPVlFhQvcaAy8RmNLbXE6H4 l3ED+WIv7eU6UEZbMYMZKqAoxVMjSsE4WKj768fXxkh11pRsLR2mdLjXWsmLgJUPJN3G pREw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773783184; x=1774387984; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=9k1Q78vvWMlaqGXjHpQUyuVWvxrimwsZXLbDTbmHPWc=; b=fVkYH6Hh+MY7xSV+fs90dVsC+BsblwBzj6AFjvHw+x24+GylC/RQfgLKEmtG3H49Qq p2WVbg1lJ/F5H8PJItHXWpWCQIyi/kdb6yS0R6gmLH2c17VHa5mwtIJGfZDcWc2BBPjn HMjlynfju9nDZbB7/4zcge3Js4YVze24DPrOqYN6PmSNppe0b4EYtGGOiZ3MzCClvODa s/KH1EaW7gsHBxracfloyXoxqN12NIkY8/fZB6WJ1WldjQI0I1yhJSOPw6qPqFZiWzyM l3I6zJlD0ySxcdZdSv7wiYQaW6kBku7Km4z+NoLgBd6uUc+C7eAz83URdXa5/K68w8Yr Rxfw== X-Forwarded-Encrypted: i=1; AJvYcCX0xJ4O0c4ujsJvNm4q/2W5tuO4NKUgsoaL3VDSntF1hbOwr8UziUXh4R7+8ac4zUim+z00SBjuOL5PmNg=@vger.kernel.org X-Gm-Message-State: AOJu0YwkUlFCMTLhzLyCv2HuqEg/N54JfyhSUOw9Q9szygRGRv4fhmVu o9DXxh/IgjDJhFL1uVaOP54j5E+st8v2k0hfzTiE8WDmP03UZr47TNb+bctewg== X-Gm-Gg: ATEYQzxWaUKDoyY2b3rHWCAUSbGEEVwA+PqPTkXZx+Ec+AUruK1biQUJ3+1e9AZoUXl NePnTUVq38MmHu1i5SLJztP10AliVs1LPSPgoPc/GE/z1pAVG29z7t2m0EtC1jf1cHIeq7k4K7d /xVwBUpF+ZquvCP99aU3OcBAEUcWhiOkH01lpf9Kda2PkFRwQePIIcG9aCPTMKL4As5WCWVPGOX wcdUE/RXBLOhyIxDMEWVvU6CJgWudS5a5VxiuWRBUVEIm6kRk6q0ipmppyYlKVgnsZeqN/+Uwkw V87Vny0wDE04ovsbO8zpZqIUXJltEAXP1whj34dQzsGTR3NS3Pwxx7oGzqvm89OyoveAURlC/IR d7CBpuyaGYjhbAKRZ87XFEtR5uUv1fTzAHa3QVwxR0ZO0d6G7wiyt4hc//iq40aYfC64WhBvhx6 6lGMrpUGbNhSuMNPaj8MY2Ev1nxLaOn3tjjwQ= X-Received: by 2002:a05:600c:3107:b0:47f:f952:d207 with SMTP id 5b1f17b1804b1-486f4448679mr18144485e9.19.1773783183884; Tue, 17 Mar 2026 14:33:03 -0700 (PDT) Received: from LT2202712.home ([2a01:cb14:322:b900:b58d:d83a:3509:7c0a]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-486f4b9beb0sm5120755e9.8.2026.03.17.14.33.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 17 Mar 2026 14:33:03 -0700 (PDT) From: Guillaume Gonnet To: Alasdair Kergon , Mike Snitzer , Mikulas Patocka , Benjamin Marzinski , Peter Korsgaard Cc: dm-devel@schwermer.no, chanho.min@lge.com, jaeyuel.im@lge.com, Guillaume Gonnet , dm-devel@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] dm init: ensure device probing has finished in dm-mod.waitfor= Date: Tue, 17 Mar 2026 22:32:28 +0100 Message-Id: <20260317213229.18371-1-ggonnet.linux@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The early_lookup_bdev() function returns successfully when the disk device is present but not necessarily its partitions. In this situation, dm_early_create() fails as the partition block device does not exist yet. In my case, this phenomenon occurs quite often because the device is an SD card with slow reading times, on which kernel takes time to enumerate available partitions. Fortunately, the underlying device is back to "probing" state while enumerating partitions. Waiting for all probing to end is enough to fix this issue. That's also the reason why this problem never occurs with rootwait= parameter: the while loop inside wait_for_root() explicitly waits for probing to be done and then the function calls async_synchronize_full(). These lines were omitted in 035641b, even though the commit says it's based on the rootwait logic... Anyway, calling wait_for_device_probe() after our while loop does the job (it both waits for probing and calls async_synchronize_full). Fixes: 035641b01e72 ("dm init: add dm-mod.waitfor to wait for asynchronously probed block devices") Signed-off-by: Guillaume Gonnet --- Hello, This patch is my attempt to fix the dm-mod.waitfor= issue. I had this fix for quite a while now, but I've never made the effort to contribute until recently. Some have tried to fix it this issue in the past but without finding its real root cause (ie. not waiting for device probe to end). Here are the links to those patches, for reference: https://lore.kernel.org/all/b5c5cd56-b9dd-4368-a8e1-b9e0a07b79b4@schwermer.no/ https://lore.kernel.org/all/20250410080056.43247-1-chanho.min@lge.com/ https://lore.kernel.org/dm-devel/20251211073426.123026-1-jaeyuel.im@lge.com/ drivers/md/dm-init.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/md/dm-init.c b/drivers/md/dm-init.c index 7403823384c5..c1bacba92c65 100644 --- a/drivers/md/dm-init.c +++ b/drivers/md/dm-init.c @@ -303,8 +303,10 @@ static int __init dm_init_init(void) } } - if (waitfor[0]) + if (waitfor[0]) { + wait_for_device_probe(); DMINFO("all devices available"); + } list_for_each_entry(dev, &devices, list) { if (dm_early_create(&dev->dmi, dev->table, -- 2.43.0