Skip to content

Commit bdb97bf

Browse files
mulkieranjbaublitz
authored andcommitted
Fix hang on filesystem signal emit
Signed-off-by: mulhern <amulhern@redhat.com>
1 parent 258ba59 commit bdb97bf

File tree

1 file changed

+39
-35
lines changed

1 file changed

+39
-35
lines changed

src/dbus/filesystem/filesystem_3_0/methods.rs

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,42 +23,46 @@ pub async fn set_name_method(
2323
) -> ((bool, String), u16, String) {
2424
let default_return = (false, FilesystemUuid::nil().simple().to_string());
2525

26-
match engine
27-
.get_mut_pool(PoolIdentifier::Uuid(uuid))
28-
.await
29-
.ok_or_else(|| StratisError::Msg(format!("No pool associated with uuid {uuid}")))
30-
{
31-
Err(err) => (default_return, DbusErrorEnum::ERROR as u16, err.to_string()),
32-
Ok(mut guard) => {
33-
let (pool_name, _, pool) = guard.as_mut_tuple();
34-
match handle_action!(pool.rename_filesystem(&pool_name, fs_uuid, name)) {
35-
Ok(RenameAction::NoSource) => (
36-
default_return,
37-
DbusErrorEnum::ERROR as u16,
38-
format!("pool doesn't know about filesystem {fs_uuid}"),
39-
),
40-
Ok(RenameAction::Renamed(_)) => {
41-
match manager.read().await.filesystem_get_path(&fs_uuid) {
42-
Some(p) => {
43-
send_fs_name_signal(connection, &p.as_ref()).await;
44-
}
45-
None => {
46-
warn!("No object path associated with pool UUID {uuid}; failed to send pool name change signals");
47-
}
48-
};
49-
(
50-
(true, fs_uuid.simple().to_string()),
51-
DbusErrorEnum::OK as u16,
52-
OK_STRING.to_string(),
53-
)
26+
let result = {
27+
let mut guard = match engine
28+
.get_mut_pool(PoolIdentifier::Uuid(uuid))
29+
.await
30+
.ok_or_else(|| StratisError::Msg(format!("No pool associated with uuid {uuid}")))
31+
{
32+
Err(err) => return (default_return, DbusErrorEnum::ERROR as u16, err.to_string()),
33+
Ok(guard) => guard,
34+
};
35+
36+
let (pool_name, _, pool) = guard.as_mut_tuple();
37+
handle_action!(pool.rename_filesystem(&pool_name, fs_uuid, name))
38+
};
39+
40+
match result {
41+
Ok(RenameAction::NoSource) => (
42+
default_return,
43+
DbusErrorEnum::ERROR as u16,
44+
format!("pool doesn't know about filesystem {fs_uuid}"),
45+
),
46+
Ok(RenameAction::Renamed(_)) => {
47+
match manager.read().await.filesystem_get_path(&fs_uuid) {
48+
Some(p) => {
49+
send_fs_name_signal(connection, &p.as_ref()).await;
5450
}
55-
Ok(RenameAction::Identity) => (
56-
default_return,
57-
DbusErrorEnum::OK as u16,
58-
OK_STRING.to_string(),
59-
),
60-
Err(err) => (default_return, DbusErrorEnum::ERROR as u16, err.to_string()),
61-
}
51+
None => {
52+
warn!("No object path associated with pool UUID {uuid}; failed to send pool name change signals");
53+
}
54+
};
55+
(
56+
(true, fs_uuid.simple().to_string()),
57+
DbusErrorEnum::OK as u16,
58+
OK_STRING.to_string(),
59+
)
6260
}
61+
Ok(RenameAction::Identity) => (
62+
default_return,
63+
DbusErrorEnum::OK as u16,
64+
OK_STRING.to_string(),
65+
),
66+
Err(err) => (default_return, DbusErrorEnum::ERROR as u16, err.to_string()),
6367
}
6468
}

0 commit comments

Comments
 (0)