public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/stratisd] f45: Backport #4110 for RHBZ #2552449 and #4113 for RHBZ #2543511
@ 2026-10-28  1:27 Adam Williamson
  0 siblings, 0 replies; only message in thread
From: Adam Williamson @ 2026-10-28  1:27 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/stratisd
Branch : f45
Commit : 716a96cb9c860be2952e1f0c6686f89de7388bc6
Author : Adam Williamson <adamwill@fedoraproject.org>
Date   : 2026-10-27T18:27:06-07:00
Stats  : +672/-1 in 4 file(s)
URL    : https://src.fedoraproject.org/rpms/stratisd/c/716a96cb9c860be2952e1f0c6686f89de7388bc6?branch=f45

Log:
Backport #4110 for RHBZ #2552449 and #4113 for RHBZ #2543511

---
diff --git a/0001-Add-infinite-timeout-to-systemd-ask-password.patch b/0001-Add-infinite-timeout-to-systemd-ask-password.patch
new file mode 100644
index 0000000..3b486e9
--- /dev/null
+++ b/0001-Add-infinite-timeout-to-systemd-ask-password.patch
@@ -0,0 +1,39 @@
+From bc7bbebee92af29db222f9679d4f87bc8e11c84b Mon Sep 17 00:00:00 2001
+From: John Baublitz <jbaublitz@redhat.com>
+Date: Thu, 22 Oct 2026 23:20:00 -0400
+Subject: [PATCH 1/3] Add infinite timeout to systemd-ask-password
+
+---
+ dracut/50stratis/stratis-rootfs-setup | 2 +-
+ systemd/stratis-fstab-setup           | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/dracut/50stratis/stratis-rootfs-setup b/dracut/50stratis/stratis-rootfs-setup
+index df201ed9..75727126 100755
+--- a/dracut/50stratis/stratis-rootfs-setup
++++ b/dracut/50stratis/stratis-rootfs-setup
+@@ -20,7 +20,7 @@ if $(stratis-min pool is-stopped "$STRATIS_ROOTFS_UUID"); then
+ 		ATTEMPTS_REMAINING=3
+ 		if
+ 			! while [ $((ATTEMPTS_REMAINING--)) -gt 0 ]; do
+-				systemd-ask-password --id="stratis:$STRATIS_ROOTFS_UUID" "Enter password for Stratis pool with UUID $STRATIS_ROOTFS_UUID containing root filesystem" |
++				systemd-ask-password --timeout=0 --id="stratis:$STRATIS_ROOTFS_UUID" "Enter password for Stratis pool with UUID $STRATIS_ROOTFS_UUID containing root filesystem" |
+ 					stratis-min pool start --prompt --token-slot=any "$STRATIS_ROOTFS_UUID" && break
+ 			done
+ 		then
+diff --git a/systemd/stratis-fstab-setup b/systemd/stratis-fstab-setup
+index 74e7dc80..b3a90808 100755
+--- a/systemd/stratis-fstab-setup
++++ b/systemd/stratis-fstab-setup
+@@ -26,7 +26,7 @@ if $(stratis-min pool is-stopped "$POOL_UUID"); then
+ 		fi
+ 	fi
+ 	if $(stratis-min pool has-passphrase "$POOL_UUID"); then
+-		if systemd-ask-password \
++		if systemd-ask-password --timeout=0 \
+ 			"Enter password for pool with UUID $POOL_UUID" |
+ 			stratis-min pool start --token-slot=any --prompt "$POOL_UUID"; then
+ 			exit 0
+-- 
+2.56.0
+

diff --git a/0002-Add-stratis-min-pool-all-devices-present-command.patch b/0002-Add-stratis-min-pool-all-devices-present-command.patch
new file mode 100644
index 0000000..8a15f87
--- /dev/null
+++ b/0002-Add-stratis-min-pool-all-devices-present-command.patch
@@ -0,0 +1,472 @@
+From d7057148388a1e93ebcf05d1b8cd81d0b5e4b111 Mon Sep 17 00:00:00 2001
+From: John Baublitz <jbaublitz@redhat.com>
+Date: Mon, 26 Oct 2026 13:54:02 -0400
+Subject: [PATCH 2/3] Add stratis-min pool all-devices-present command
+
+Add a stratis-min command and stratisd-min JSON-RPC request that report
+whether all devices recorded in a pool's metadata have been found. Pools
+that are running, or that have V1 metadata, always report true.
+
+To support this, move the check that found device UUIDs match the
+metadata into get_metadata, have pool_level_metadata_info call it once
+for both name and features, and record the result as devices_complete
+in StoppedPoolInfo.
+
+Assisted-by: Claude Code/claude-sonnet-5-5
+---
+ src/bin/stratis-min/stratis-min.rs            |  17 ++
+ src/engine/sim_engine/engine.rs               |   1 +
+ .../strat_engine/liminal/device_info.rs       |  15 +-
+ src/engine/strat_engine/liminal/liminal.rs    |   2 +-
+ src/engine/strat_engine/liminal/setup.rs      | 151 ++++++------------
+ src/engine/types/mod.rs                       |   4 +
+ src/jsonrpc/client/pool.rs                    |  10 ++
+ src/jsonrpc/interface.rs                      |   2 +
+ src/jsonrpc/server/pool.rs                    |  30 ++++
+ src/jsonrpc/server/server.rs                  |   7 +
+ tests/stratis_min.rs                          |  16 ++
+ 11 files changed, 148 insertions(+), 107 deletions(-)
+
+diff --git a/src/bin/stratis-min/stratis-min.rs b/src/bin/stratis-min/stratis-min.rs
+index ecea72c3..de01612e 100644
+--- a/src/bin/stratis-min/stratis-min.rs
++++ b/src/bin/stratis-min/stratis-min.rs
+@@ -100,6 +100,9 @@ fn parse_args() -> Command {
+                 Command::new("is-stopped")
+                     .arg(Arg::new("name").long("name").num_args(0))
+                     .arg(Arg::new("id").required(true)),
++                Command::new("all-devices-present")
++                    .arg(Arg::new("name").long("name").num_args(0))
++                    .arg(Arg::new("id").required(true)),
+                 Command::new("has-passphrase")
+                     .arg(Arg::new("name").long("name").num_args(0))
+                     .arg(Arg::new("id").required(true)),
+@@ -464,6 +467,20 @@ fn main() -> Result<(), String> {
+                 };
+                 println!("{}", pool::pool_is_stopped(id)?);
+                 Ok(())
++            } else if let Some(args) = subcommand.subcommand_matches("all-devices-present") {
++                let id = if args.get_flag("name") {
++                    PoolIdentifier::Name(Name::new(
++                        args.get_one::<String>("id").expect("required").to_owned(),
++                    ))
++                } else {
++                    PoolIdentifier::Uuid(PoolUuid::parse_str(
++                        args.get_one::<String>("id")
++                            .map(|s| s.as_str())
++                            .expect("required"),
++                    )?)
++                };
++                println!("{}", pool::pool_all_devices_present(id)?);
++                Ok(())
+             } else if let Some(args) = subcommand.subcommand_matches("has-passphrase") {
+                 let id = if args.get_flag("name") {
+                     PoolIdentifier::Name(Name::new(
+diff --git a/src/engine/sim_engine/engine.rs b/src/engine/sim_engine/engine.rs
+index 0a97dff9..99607118 100644
+--- a/src/engine/sim_engine/engine.rs
++++ b/src/engine/sim_engine/engine.rs
+@@ -275,6 +275,7 @@ impl Engine for SimEngine {
+                                 .map(|ei| ei.all_clevis_infos().count() > 0)
+                                 .unwrap_or(false),
+                         }),
++                        devices_complete: true,
+                     },
+                 );
+                 st
+diff --git a/src/engine/strat_engine/liminal/device_info.rs b/src/engine/strat_engine/liminal/device_info.rs
+index c166d560..d1673a6e 100644
+--- a/src/engine/strat_engine/liminal/device_info.rs
++++ b/src/engine/strat_engine/liminal/device_info.rs
+@@ -21,7 +21,7 @@ use crate::{
+             backstore::blockdev::{v1, v2},
+             liminal::{
+                 identify::{DeviceInfo, LuksInfo, StratisDevInfo, StratisInfo},
+-                setup::{get_feature_set, get_name},
++                setup::get_metadata,
+             },
+             metadata::{StratisIdentifiers, BDA},
+         },
+@@ -569,8 +569,12 @@ impl DeviceSet {
+         &self,
+     ) -> StratisResult<(MaybeInconsistent<Option<Name>>, Option<Features>)> {
+         match self.as_opened_set() {
+-            Some(set) => get_name(&set).map(MaybeInconsistent::No).and_then(|name| {
+-                get_feature_set(&set).map(|feat| (name, feat.map(Features::from)))
++            Some(set) => get_metadata(&set, false).map(|opt| match opt {
++                Some((_, pool)) => (
++                    MaybeInconsistent::No(Some(Name::new(pool.name))),
++                    Some(Features::from(pool.features)),
++                ),
++                None => (MaybeInconsistent::No(None), None),
+             }),
+             None => gather_pool_name(
+                 self.internal.len(),
+@@ -657,6 +661,10 @@ impl DeviceSet {
+                     None
+                 }
+             };
++            // Features can only be obtained if the devices found match the
++            // devices in the metadata, so their presence indicates that the
++            // device set is complete.
++            let devices_complete = features.is_some();
+             StoppedPoolInfo {
+                 info,
+                 devices: self
+@@ -679,6 +687,7 @@ impl DeviceSet {
+                     .collect::<Vec<_>>(),
+                 metadata_version: self.metadata_version().ok(),
+                 features,
++                devices_complete,
+             }
+         })
+     }
+diff --git a/src/engine/strat_engine/liminal/liminal.rs b/src/engine/strat_engine/liminal/liminal.rs
+index d7ea1b47..b8add326 100644
+--- a/src/engine/strat_engine/liminal/liminal.rs
++++ b/src/engine/strat_engine/liminal/liminal.rs
+@@ -1276,7 +1276,7 @@ fn load_stratis_metadata(
+             )));
+     }
+ 
+-    match get_metadata(&stratis_infos_ref(infos)) {
++    match get_metadata(&stratis_infos_ref(infos), remove_cache) {
+         Ok(opt) => {
+             let (timestamp, mut metadata) = opt
+             .ok_or_else(|| {
+diff --git a/src/engine/strat_engine/liminal/setup.rs b/src/engine/strat_engine/liminal/setup.rs
+index bb9c8a00..0f4a6be7 100644
+--- a/src/engine/strat_engine/liminal/setup.rs
++++ b/src/engine/strat_engine/liminal/setup.rs
+@@ -25,9 +25,9 @@ use crate::{
+             crypt::handle::v1::CryptHandle,
+             device::blkdev_size,
+             liminal::device_info::LStratisInfo,
+-            serde_structs::{BackstoreSave, BaseBlockDevSave, PoolFeatures, PoolSave},
++            serde_structs::{BackstoreSave, BaseBlockDevSave, PoolSave},
+         },
+-        types::{BlockDevTier, DevUuid, DevicePath, Name, TokenUnlockMethod},
++        types::{BlockDevTier, DevUuid, DevicePath, TokenUnlockMethod},
+     },
+     stratis::{StratisError, StratisResult},
+ };
+@@ -38,10 +38,15 @@ use crate::{
+ /// metadata could be written.
+ /// Returns an error if there is a last update time, but no metadata could
+ /// be obtained from any of the devices.
++/// Returns an error if devices provided don't match the devices recorded in the
++/// metadata. If allow_missing_cache is true, cache devices recorded in the
++/// metadata are permitted to be absent from the devices provided; all data devices
++/// must still be present and no devices not recorded in the metadata may be provided.
+ ///
+ /// Precondition: infos and bdas have identical sets of keys
+ pub fn get_metadata(
+     infos: &HashMap<DevUuid, &LStratisInfo>,
++    allow_missing_cache: bool,
+ ) -> StratisResult<Option<(DateTime<Utc>, PoolSave)>> {
+     // Try to read from all available devnodes that could contain most
+     // recent metadata. In the event of errors, continue to try until all are
+@@ -59,120 +64,60 @@ pub fn get_metadata(
+         None => return Ok(None),
+     };
+ 
+-    OpenOptions::new()
++    let pool: PoolSave = OpenOptions::new()
+         .read(true)
+         .open(&info.dev_info.devnode)
+         .ok()
+         .and_then(|mut f| info.bda.load_state(&mut f).unwrap_or(None))
+         .and_then(|data| serde_json::from_slice(&data).ok())
+-        .map(|psave| Some((time, psave)))
+         .ok_or_else(|| {
+             StratisError::Msg(
+                 "timestamp indicates data was written, but no data successfully read".to_string(),
+             )
+-        })
+-}
++        })?;
+ 
+-/// Get the name from the most recent metadata from a set of devices.
+-/// Returns None if no metadata found for this pool on any device. This can
+-/// happen if the pool was constructed but failed in the interval before the
+-/// metadata could be written.
+-/// Returns an error if devices provided don't match the devices recorded in the
+-/// metadata.
+-pub fn get_name(infos: &HashMap<DevUuid, &LStratisInfo>) -> StratisResult<Option<Name>> {
+     let found_uuids = infos.keys().copied().collect::<HashSet<_>>();
+-    match get_metadata(infos)? {
+-        Some((_, pool)) => {
+-            let v = [];
+-            let meta_uuids = pool
+-                .backstore
+-                .data_tier
+-                .blockdev
+-                .devs
+-                .iter()
+-                .map(|bd| bd.uuid)
+-                .chain(
+-                    pool.backstore
+-                        .cache_tier
+-                        .as_ref()
+-                        .map(|ct| ct.blockdev.devs.iter())
+-                        .unwrap_or_else(|| v.iter())
+-                        .map(|bd| bd.uuid),
+-                )
+-                .collect::<HashSet<_>>();
+-
+-            if found_uuids != meta_uuids {
+-                return Err(StratisError::Msg(format!(
+-                    "UUIDs in metadata ({}) did not match UUIDs found ({})",
+-                    Itertools::intersperse(
+-                        meta_uuids.into_iter().map(|u| u.to_string()),
+-                        ", ".to_string(),
+-                    )
+-                    .collect::<String>(),
+-                    Itertools::intersperse(
+-                        found_uuids.into_iter().map(|u| u.to_string()),
+-                        ", ".to_string(),
+-                    )
+-                    .collect::<String>(),
+-                )));
+-            }
+-
+-            Ok(Some(Name::new(pool.name)))
+-        }
+-        None => Ok(None),
++    let data_uuids = pool
++        .backstore
++        .data_tier
++        .blockdev
++        .devs
++        .iter()
++        .map(|bd| bd.uuid)
++        .collect::<HashSet<_>>();
++    let cache_uuids = pool
++        .backstore
++        .cache_tier
++        .as_ref()
++        .map(|ct| ct.blockdev.devs.iter().map(|bd| bd.uuid).collect())
++        .unwrap_or_default();
++    let meta_uuids = data_uuids
++        .union(&cache_uuids)
++        .copied()
++        .collect::<HashSet<_>>();
++
++    let matches = if allow_missing_cache {
++        data_uuids.is_subset(&found_uuids) && found_uuids.is_subset(&meta_uuids)
++    } else {
++        found_uuids == meta_uuids
++    };
++    if !matches {
++        return Err(StratisError::Msg(format!(
++            "UUIDs in metadata ({}) did not match UUIDs found ({})",
++            Itertools::intersperse(
++                meta_uuids.into_iter().map(|u| u.to_string()),
++                ", ".to_string(),
++            )
++            .collect::<String>(),
++            Itertools::intersperse(
++                found_uuids.into_iter().map(|u| u.to_string()),
++                ", ".to_string(),
++            )
++            .collect::<String>(),
++        )));
+     }
+-}
+-
+-/// Get the feature set from the most recent metadata from a set of devices.
+-/// Returns None if no metadata found for this pool on any device. This can
+-/// happen if the pool was constructed but failed in the interval before the
+-/// metadata could be written.
+-/// Returns an error if devices provided don't match the devices recorded in the
+-/// metadata.
+-pub fn get_feature_set(
+-    infos: &HashMap<DevUuid, &LStratisInfo>,
+-) -> StratisResult<Option<Vec<PoolFeatures>>> {
+-    let found_uuids = infos.keys().copied().collect::<HashSet<_>>();
+-    match get_metadata(infos)? {
+-        Some((_, pool)) => {
+-            let v = [];
+-            let meta_uuids = pool
+-                .backstore
+-                .data_tier
+-                .blockdev
+-                .devs
+-                .iter()
+-                .map(|bd| bd.uuid)
+-                .chain(
+-                    pool.backstore
+-                        .cache_tier
+-                        .as_ref()
+-                        .map(|ct| ct.blockdev.devs.iter())
+-                        .unwrap_or_else(|| v.iter())
+-                        .map(|bd| bd.uuid),
+-                )
+-                .collect::<HashSet<_>>();
+-
+-            if found_uuids != meta_uuids {
+-                return Err(StratisError::Msg(format!(
+-                    "UUIDs in metadata ({}) did not match UUIDs found ({})",
+-                    Itertools::intersperse(
+-                        meta_uuids.into_iter().map(|u| u.to_string()),
+-                        ", ".to_string(),
+-                    )
+-                    .collect::<String>(),
+-                    Itertools::intersperse(
+-                        found_uuids.into_iter().map(|u| u.to_string()),
+-                        ", ".to_string(),
+-                    )
+-                    .collect::<String>(),
+-                )));
+-            }
+ 
+-            Ok(Some(pool.features))
+-        }
+-        None => Ok(None),
+-    }
++    Ok(Some((time, pool)))
+ }
+ 
+ /// Get all the blockdevs corresponding to this pool that can be obtained from
+diff --git a/src/engine/types/mod.rs b/src/engine/types/mod.rs
+index 43af9aaf..e288c3e5 100644
+--- a/src/engine/types/mod.rs
++++ b/src/engine/types/mod.rs
+@@ -234,6 +234,10 @@ pub struct StoppedPoolInfo {
+     pub devices: Vec<PoolDevice>,
+     pub metadata_version: Option<StratSigblockVersion>,
+     pub features: Option<Features>,
++    /// True if the devices found match the complete set of devices recorded
++    /// in the pool metadata. False if some devices are missing or if this
++    /// cannot be determined, e.g., because some devices are not yet unlocked.
++    pub devices_complete: bool,
+ }
+ 
+ #[derive(Debug, Eq, PartialEq)]
+diff --git a/src/jsonrpc/client/pool.rs b/src/jsonrpc/client/pool.rs
+index fc6b0e27..847e1813 100644
+--- a/src/jsonrpc/client/pool.rs
++++ b/src/jsonrpc/client/pool.rs
+@@ -143,6 +143,16 @@ pub fn pool_is_stopped(id: PoolIdentifier<PoolUuid>) -> StratisResult<bool> {
+     }
+ }
+ 
++// stratis-min pool all-devices-present
++pub fn pool_all_devices_present(id: PoolIdentifier<PoolUuid>) -> StratisResult<bool> {
++    let (present, rc, rs) = do_request!(PoolAllDevicesPresent, id);
++    if rc != 0 {
++        Err(StratisError::Msg(rs))
++    } else {
++        Ok(present)
++    }
++}
++
+ // stratis-min pool has-passphrase
+ pub fn pool_has_passphrase(id: PoolIdentifier<PoolUuid>) -> StratisResult<bool> {
+     let (has_passphrase, rc, rs) = do_request!(PoolHasPassphrase, id);
+diff --git a/src/jsonrpc/interface.rs b/src/jsonrpc/interface.rs
+index b6e0cbbf..57151e61 100644
+--- a/src/jsonrpc/interface.rs
++++ b/src/jsonrpc/interface.rs
+@@ -62,6 +62,7 @@ pub enum StratisParamType {
+     PoolRebindClevis(PoolIdentifier<PoolUuid>, Option<u32>),
+     PoolIsEncrypted(PoolIdentifier<PoolUuid>),
+     PoolIsStopped(PoolIdentifier<PoolUuid>),
++    PoolAllDevicesPresent(PoolIdentifier<PoolUuid>),
+     PoolHasPassphrase(PoolIdentifier<PoolUuid>),
+     PoolIsBound(PoolIdentifier<PoolUuid>),
+     FsCreate(String, String),
+@@ -101,6 +102,7 @@ pub enum StratisRet {
+     PoolRebindClevis((bool, u16, String)),
+     PoolIsEncrypted((bool, u16, String)),
+     PoolIsStopped((bool, u16, String)),
++    PoolAllDevicesPresent((bool, u16, String)),
+     PoolHasPassphrase((bool, u16, String)),
+     PoolIsBound((bool, u16, String)),
+     FsCreate((bool, u16, String)),
+diff --git a/src/jsonrpc/server/pool.rs b/src/jsonrpc/server/pool.rs
+index 4e1002e4..77e611c4 100644
+--- a/src/jsonrpc/server/pool.rs
++++ b/src/jsonrpc/server/pool.rs
+@@ -340,6 +340,36 @@ pub async fn pool_is_stopped(
+     }
+ }
+ 
++// stratis-min pool all-devices-present
++//
++// Returns true if the pool is running or if all of the devices recorded in its
++// metadata have been found. Pools with V1 metadata are always reported as
++// having all devices present.
++pub async fn pool_all_devices_present(
++    engine: Arc<dyn Engine>,
++    id: PoolIdentifier<PoolUuid>,
++) -> StratisResult<bool> {
++    let stopped = engine.stopped_pools().await;
++    if engine.get_pool(id.clone()).await.is_some() {
++        return Ok(true);
++    }
++    let pool_uuid = match id {
++        PoolIdentifier::Uuid(ref u) => u,
++        PoolIdentifier::Name(ref n) => stopped
++            .name_to_uuid
++            .get(n)
++            .ok_or_else(|| StratisError::Msg(format!("Could not find pool with name {n}")))?,
++    };
++    stopped
++        .stopped
++        .get(pool_uuid)
++        .or_else(|| stopped.partially_constructed.get(pool_uuid))
++        .map(|info| {
++            matches!(info.metadata_version, Some(StratSigblockVersion::V1)) || info.devices_complete
++        })
++        .ok_or_else(|| StratisError::Msg(format!("Pool with {id} not found")))
++}
++
+ // stratis-min pool has-passphrase
+ pub async fn pool_has_passphrase(
+     engine: Arc<dyn Engine>,
+diff --git a/src/jsonrpc/server/server.rs b/src/jsonrpc/server/server.rs
+index 9e2754f9..289add8b 100644
+--- a/src/jsonrpc/server/server.rs
++++ b/src/jsonrpc/server/server.rs
+@@ -194,6 +194,13 @@ impl StratisParams {
+                     false,
+                 )))
+             }
++            StratisParamType::PoolAllDevicesPresent(id) => {
++                expects_fd!(self.fd_opt, false);
++                Ok(StratisRet::PoolAllDevicesPresent(stratis_result_to_return(
++                    pool::pool_all_devices_present(engine, id).await,
++                    false,
++                )))
++            }
+             StratisParamType::PoolHasPassphrase(id) => {
+                 expects_fd!(self.fd_opt, false);
+                 Ok(StratisRet::PoolHasPassphrase(stratis_result_to_return(
+diff --git a/tests/stratis_min.rs b/tests/stratis_min.rs
+index c17ba043..8a4fa258 100644
+--- a/tests/stratis_min.rs
++++ b/tests/stratis_min.rs
+@@ -945,3 +945,19 @@ fn stratis_min_key_set_empty() {
+ fn test_stratis_min_key_set_empty() {
+     test_with_stratisd_min_sim(stratis_min_key_set_empty);
+ }
++
++fn stratis_min_pool_all_devices_present() {
++    stratis_min_create_pool_and_fs();
++    let mut cmd = Command::cargo_bin("stratis-min").unwrap();
++    cmd.arg("pool")
++        .arg("all-devices-present")
++        .arg("--name")
++        .arg("pn");
++    cmd.assert().success().stdout("true\n");
++}
++
++#[test]
++// Test that all devices are reported present for a running pool.
++fn test_stratis_min_pool_all_devices_present() {
++    test_with_stratisd_min_sim(stratis_min_pool_all_devices_present);
++}
+-- 
+2.56.0
+

diff --git a/0003-Wait-for-all-pool-devices-in-dracut-and-systemd-setu.patch b/0003-Wait-for-all-pool-devices-in-dracut-and-systemd-setu.patch
new file mode 100644
index 0000000..6759dbd
--- /dev/null
+++ b/0003-Wait-for-all-pool-devices-in-dracut-and-systemd-setu.patch
@@ -0,0 +1,150 @@
+From c1c35dd5b3ffc4ca3eb4eab2073327b7bdb47e5c Mon Sep 17 00:00:00 2001
+From: John Baublitz <jbaublitz@redhat.com>
+Date: Mon, 26 Oct 2026 14:10:19 -0400
+Subject: [PATCH 3/3] Wait for all pool devices in dracut and systemd setup
+ scripts
+
+Use stratis-min pool all-devices-present instead of is-stopped when
+waiting on a pool, so that pool start is not attempted while only some
+of the pool's devices have appeared.
+
+Assisted-by: Claude Code/claude-sonnet-5-5
+---
+ dracut/50stratis/stratis-rootfs-setup | 41 ++++++++++++----------
+ systemd/stratis-fstab-setup           | 49 +++++++++++++++------------
+ 2 files changed, 50 insertions(+), 40 deletions(-)
+
+diff --git a/dracut/50stratis/stratis-rootfs-setup b/dracut/50stratis/stratis-rootfs-setup
+index 75727126..24dcf7c6 100755
+--- a/dracut/50stratis/stratis-rootfs-setup
++++ b/dracut/50stratis/stratis-rootfs-setup
+@@ -6,8 +6,8 @@ if [ -z "$STRATIS_ROOTFS_UUID" ]; then
+ fi
+ 
+ i=0
+-while ! stratis-min pool is-stopped "$STRATIS_ROOTFS_UUID" >/dev/null; do
+-	echo Waiting on pool with UUID $STRATIS_ROOTFS_UUID...
++while [ "$(stratis-min pool all-devices-present "$STRATIS_ROOTFS_UUID" 2>/dev/null)" != true ]; do
++	echo Waiting on all devices for pool with UUID $STRATIS_ROOTFS_UUID...
+ 	sleep 1
+ 	if [ "$i" = 5 ]; then
+ 		break
+@@ -15,23 +15,28 @@ while ! stratis-min pool is-stopped "$STRATIS_ROOTFS_UUID" >/dev/null; do
+ 	i=$(($i + 1))
+ done
+ 
+-if $(stratis-min pool is-stopped "$STRATIS_ROOTFS_UUID"); then
+-	if $(stratis-min pool has-passphrase "$STRATIS_ROOTFS_UUID"); then
+-		ATTEMPTS_REMAINING=3
+-		if
+-			! while [ $((ATTEMPTS_REMAINING--)) -gt 0 ]; do
+-				systemd-ask-password --timeout=0 --id="stratis:$STRATIS_ROOTFS_UUID" "Enter password for Stratis pool with UUID $STRATIS_ROOTFS_UUID containing root filesystem" |
+-					stratis-min pool start --prompt --token-slot=any "$STRATIS_ROOTFS_UUID" && break
+-			done
+-		then
+-			echo Failed to start pool with UUID $STRATIS_ROOTFS_UUID using a passphrase >&2
+-			exit 1
++if $(stratis-min pool all-devices-present "$STRATIS_ROOTFS_UUID"); then
++	if $(stratis-min pool is-stopped "$STRATIS_ROOTFS_UUID"); then
++		if $(stratis-min pool has-passphrase "$STRATIS_ROOTFS_UUID"); then
++			ATTEMPTS_REMAINING=3
++			if
++				! while [ $((ATTEMPTS_REMAINING--)) -gt 0 ]; do
++					systemd-ask-password --timeout=0 --id="stratis:$STRATIS_ROOTFS_UUID" "Enter password for Stratis pool with UUID $STRATIS_ROOTFS_UUID containing root filesystem" |
++						stratis-min pool start --prompt --token-slot=any "$STRATIS_ROOTFS_UUID" && break
++				done
++			then
++				echo Failed to start pool with UUID $STRATIS_ROOTFS_UUID using a passphrase >&2
++				exit 1
++			fi
+ 		fi
+-	fi
+-	if ! $(stratis-min pool is-encrypted "$STRATIS_ROOTFS_UUID"); then
+-		if ! stratis-min pool start "$STRATIS_ROOTFS_UUID"; then
+-			echo Failed to start pool with UUID $STRATIS_ROOTFS_UUID >&2
+-			exit 1
++		if ! $(stratis-min pool is-encrypted "$STRATIS_ROOTFS_UUID"); then
++			if ! stratis-min pool start "$STRATIS_ROOTFS_UUID"; then
++				echo Failed to start pool with UUID $STRATIS_ROOTFS_UUID >&2
++				exit 1
++			fi
+ 		fi
+ 	fi
++else
++	echo Could not find all devices for pool "$STRATIS_ROOTFS_UUID"
++	exit 1
+ fi
+diff --git a/systemd/stratis-fstab-setup b/systemd/stratis-fstab-setup
+index b3a90808..f9fc71d3 100755
+--- a/systemd/stratis-fstab-setup
++++ b/systemd/stratis-fstab-setup
+@@ -8,8 +8,8 @@ fi
+ POOL_UUID="$1"
+ 
+ i=0
+-while ! stratis-min pool is-stopped "$POOL_UUID" >/dev/null; do
+-	echo Waiting on pool with UUID $POOL_UUID...
++while [ "$(stratis-min pool all-devices-present "$POOL_UUID" 2>/dev/null)" != true ]; do
++	echo Waiting on all devices for pool with UUID $POOL_UUID...
+ 	sleep 1
+ 	if [ "$i" = 5 ]; then
+ 		break
+@@ -17,30 +17,35 @@ while ! stratis-min pool is-stopped "$POOL_UUID" >/dev/null; do
+ 	i=$(($i + 1))
+ done
+ 
+-if $(stratis-min pool is-stopped "$POOL_UUID"); then
+-	if $(stratis-min pool is-bound "$POOL_UUID"); then
+-		if stratis-min pool start --token-slot=any "$POOL_UUID"; then
+-			exit 0
+-		else
+-			echo Failed to start pool with UUID $POOL_UUID using an unattended unlock method. >&2
++if $(stratis-min pool all-devices-present "$POOL_UUID"); then
++	if $(stratis-min pool is-stopped "$POOL_UUID"); then
++		if $(stratis-min pool is-bound "$POOL_UUID"); then
++			if stratis-min pool start --token-slot=any "$POOL_UUID"; then
++				exit 0
++			else
++				echo Failed to start pool with UUID $POOL_UUID using an unattended unlock method. >&2
++			fi
+ 		fi
+-	fi
+-	if $(stratis-min pool has-passphrase "$POOL_UUID"); then
+-		if systemd-ask-password --timeout=0 \
+-			"Enter password for pool with UUID $POOL_UUID" |
+-			stratis-min pool start --token-slot=any --prompt "$POOL_UUID"; then
+-			exit 0
+-		else
+-			echo Failed to start pool with UUID $POOL_UUID using passphrase. >&2
++		if $(stratis-min pool has-passphrase "$POOL_UUID"); then
++			if systemd-ask-password --timeout=0 \
++				"Enter password for pool with UUID $POOL_UUID" |
++				stratis-min pool start --token-slot=any --prompt "$POOL_UUID"; then
++				exit 0
++			else
++				echo Failed to start pool with UUID $POOL_UUID using passphrase. >&2
++			fi
+ 		fi
+-	fi
+-	if ! $(stratis-min pool is-encrypted "$POOL_UUID"); then
+-		if stratis-min pool start "$POOL_UUID"; then
+-			exit 0
+-		else
+-			echo Failed to start pool with UUID $POOL_UUID. >&2
++		if ! $(stratis-min pool is-encrypted "$POOL_UUID"); then
++			if stratis-min pool start "$POOL_UUID"; then
++				exit 0
++			else
++				echo Failed to start pool with UUID $POOL_UUID. >&2
++			fi
+ 		fi
++		exit 1
+ 	fi
++else
++	echo Could not find all devices for pool "$POOL_UUID"
+ 	exit 1
+ fi
+ 
+-- 
+2.56.0
+

diff --git a/stratisd.spec b/stratisd.spec
index e93972c..58540c3 100644
--- a/stratisd.spec
+++ b/stratisd.spec
@@ -13,6 +13,16 @@ URL:            https://github.com/stratis-storage/stratisd
 Source0:        %{url}/archive/stratisd-v%{version}/%{name}-%{version}.tar.gz
 Source1:        %{url}/releases/download/stratisd-v%{version}/%{name}-%{version}-vendor.tar.gz
 
+# https://github.com/stratis-storage/stratisd/pull/4110
+# https://bugzilla.redhat.com/show_bug.cgi?id=2552449
+# Wait indefinitely for encryption passphrase on boot
+Patch:          0001-Add-infinite-timeout-to-systemd-ask-password.patch
+# https://github.com/stratis-storage/stratisd/pull/4113
+# https://bugzilla.redhat.com/show_bug.cgi?id=2543511
+# Wait for all pool devices before attempting decryption
+Patch:          0002-Add-stratis-min-pool-all-devices-present-command.patch
+Patch:          0003-Wait-for-all-pool-devices-in-dracut-and-systemd-setu.patch
+
 
 %if 0%{?rhel}
 ExcludeArch:    i686
@@ -80,7 +90,7 @@ Requires:     stratisd
 %{summary}.
 
 %prep
-%autosetup -n stratisd-stratisd-v%{version} %{?rhel:-a1}
+%autosetup -p1 -n stratisd-stratisd-v%{version} %{?rhel:-a1}
 
 %if 0%{?rhel}
 %cargo_prep -v vendor

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-28  1:27 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-28  1:27 [rpms/stratisd] f45: Backport #4110 for RHBZ #2552449 and #4113 for RHBZ #2543511 Adam Williamson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox