Skip to content

Commit e71aeb4

Browse files
committed
cryptpilot-convert: fix failed checking free nbd device when no nbd kernel module avaliable
Signed-off-by: Kun Lai <[email protected]>
1 parent ce785d2 commit e71aeb4

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

cryptpilot-convert.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
set -e # exit on error
44
set -u # exit when variable not set
5+
shopt -s nullglob
56

67
# To avoid locale issues.
78
export LC_ALL=C
@@ -125,11 +126,11 @@ disk::align_start_sector() {
125126

126127
# https://unix.stackexchange.com/a/312273
127128
disk::nbd_available() {
128-
[[ $(blockdev --getsize64 $1) -eq 0 ]]
129+
[[ $(blockdev --getsize64 $1) == 0 ]]
129130
}
130131

131132
disk::get_available_nbd() {
132-
modprobe nbd max_part=8
133+
{ lsmod | grep nbd >/dev/null; } || modprobe nbd max_part=8
133134
# If run in container, use following instead
134135
#
135136
# mknod /dev/nbd0 b 43 0

src/fs/block/blktrace/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ impl BlkTrace {
8383
false
8484
});
8585
if !mounted {
86-
tracing::info!("debugfs not mounted, mounting it now");
86+
tracing::debug!("debugfs not mounted, mounting it now");
8787
tokio::fs::create_dir_all(&debugfs).await?;
8888

8989
tokio::task::spawn_blocking(move || -> Result<_> {

src/fs/cmd.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ impl CheckCommandOutput for Command {
5454
input_bytes: Option<&[u8]>,
5555
f: impl Fn(i32, Vec<u8>, Vec<u8>) -> Result<R> + Send + Sync,
5656
) -> Result<R> {
57+
tracing::trace!(cmd=?self.as_std(), "run external cmd");
58+
5759
async {
5860
// Spawn the command and get output
5961
let output = async {

0 commit comments

Comments
 (0)