mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-05-01 21:24:36 +00:00
agent: reduce reference count for failed mount
The kata agent adds a reference for each storage object before mount and skip mount again if the storage object is known. We need to remove the object reference if mount fails. Fixes: #5364 Signed-off-by: Feng Wang <feng.wang@databricks.com>
This commit is contained in:
parent
ff62cedd26
commit
c31cf7269e
@ -779,16 +779,20 @@ pub async fn add_storages(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Todo need to rollback the mounted storage if err met.
|
let mount_point = match res {
|
||||||
|
Err(e) => {
|
||||||
if res.is_err() {
|
error!(
|
||||||
error!(
|
logger,
|
||||||
logger,
|
"add_storages failed, storage: {:?}, error: {:?} ", storage, e
|
||||||
"add_storages failed, storage: {:?}, error: {:?} ", storage, res
|
);
|
||||||
);
|
let mut sb = sandbox.lock().await;
|
||||||
}
|
sb.unset_sandbox_storage(&storage.mount_point)
|
||||||
|
.map_err(|e| warn!(logger, "fail to unset sandbox storage {:?}", e))
|
||||||
let mount_point = res?;
|
.ok();
|
||||||
|
return Err(e);
|
||||||
|
}
|
||||||
|
Ok(m) => m,
|
||||||
|
};
|
||||||
|
|
||||||
if !mount_point.is_empty() {
|
if !mount_point.is_empty() {
|
||||||
mount_list.push(mount_point);
|
mount_list.push(mount_point);
|
||||||
|
Loading…
Reference in New Issue
Block a user