iSulad/0008-fix-layer-remain-caused-by-hold-flag-not-clean.patch
lifeng68 97f5e13ccd isulad: set log level to warning in quota
Signed-off-by: lifeng68 <lifeng68@huawei.com>
2020-09-18 11:55:53 +08:00

63 lines
1.8 KiB
Diff

From f953e23087e3de4fd283570f6c1e09f9de5d631e Mon Sep 17 00:00:00 2001
From: WangFengTu <wangfengtu@huawei.com>
Date: Tue, 15 Sep 2020 08:46:54 +0800
Subject: [PATCH 08/10] fix layer remain caused by hold flag not clean
Signed-off-by: WangFengTu <wangfengtu@huawei.com>
---
src/daemon/modules/image/oci/oci_load.c | 24 ++++++++++++++++--------
1 file changed, 16 insertions(+), 8 deletions(-)
diff --git a/src/daemon/modules/image/oci/oci_load.c b/src/daemon/modules/image/oci/oci_load.c
index f7908b6..6304a1f 100644
--- a/src/daemon/modules/image/oci/oci_load.c
+++ b/src/daemon/modules/image/oci/oci_load.c
@@ -206,6 +206,19 @@ static void oci_load_free_image(load_image_t *im)
free(im);
}
+inline static void do_free_load_image(load_image_t *im)
+{
+ if (im == NULL) {
+ return;
+ }
+
+ if (im->layer_of_hold_flag != NULL && storage_set_hold_flag(im->layer_of_hold_flag, false) != 0) {
+ ERROR("clear hold flag failed for layer %s", im->layer_of_hold_flag);
+ }
+
+ oci_load_free_image(im);
+}
+
static char **str_array_copy(char **arr, size_t len)
{
char **str_arr = NULL;
@@ -1033,7 +1046,8 @@ int oci_do_load(const im_load_request *request)
ret = -1;
goto out;
}
- oci_load_free_image(im);
+
+ do_free_load_image(im);
im = NULL;
}
@@ -1048,13 +1062,7 @@ out:
}
free(manifest);
- if (im != NULL) {
- if (im->layer_of_hold_flag != NULL && storage_set_hold_flag(im->layer_of_hold_flag, false) != 0) {
- ERROR("clear hold flag failed for layer %s", im->layer_of_hold_flag);
- }
-
- oci_load_free_image(im);
- }
+ do_free_load_image(im);
if (reader.close != NULL) {
reader.close(reader.context, NULL);
--
2.25.1