Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -93,5 +93,7 @@ fi
# tests to know we're doing upstream CI.
touch /usr/lib/.bootc-dev-stamp
# And test our own linting
## Workaround for https://github.com/bootc-dev/bootc/issues/1546
rm -rf /root/buildinfo
bootc container lint --fatal-warnings
EORUN
10 changes: 3 additions & 7 deletions crates/ostree-ext/src/sysroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,9 @@ impl SysrootLock {
/// immediately, a status message will be printed to standard output.
/// The lock will be unlocked when this object is dropped.
pub async fn new_from_sysroot(sysroot: &ostree::Sysroot) -> Result<Self> {
if sysroot.try_lock()? {
return Ok(Self {
sysroot: sysroot.clone(),
unowned: false,
});
}
async_task_with_spinner("Waiting for sysroot lock...", sysroot.lock_future()).await?;
let sysroot_clone = sysroot.clone();
let locker = tokio::task::spawn_blocking(move || sysroot_clone.lock());
async_task_with_spinner("Waiting for sysroot lock...", locker).await??;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does for me basically always cause a flicker of "Waiting for sysroot lock..." on a terminal, but if someone cares we can change that.

Ok(Self {
sysroot: sysroot.clone(),
unowned: false,
Expand Down
32 changes: 32 additions & 0 deletions tmt/tests/booted/readonly/030-test-locking-read.nu
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Verify we can spawn multiple bootc status at the same time
use std assert
use tap.nu

tap begin "concurrent bootc status"

# Fork via systemd-run
let n = 10
0..$n | each { |v|
# Clean up prior runs
systemctl stop $"bootc-status-($v)" | complete
}
# Fork off a concurrent bootc status
0..$n | each { |v|
systemd-run --no-block -qr -u $"bootc-status-($v)" bootc status
}

# Await completion
0..$n | each { |v|
loop {
let r = systemctl is-active $"bootc-status-($v)" | complete
if $r.exit_code == 0 {
break
}
# check status
systemctl status $"bootc-status-($v)" out> /dev/null
# Clean it up
systemctl reset-failed $"bootc-status-($v)"
}
}

tap ok