upgrade-apply-deltafs: Stop upgrade process immediately after failure 06/286606/3
authorAntoni Adaszkiewicz <a.adaszkiewi@samsung.com>
Tue, 10 Jan 2023 10:37:12 +0000 (11:37 +0100)
committerAntoni Adaszkiewicz <a.adaszkiewi@samsung.com>
Tue, 10 Jan 2023 13:02:23 +0000 (14:02 +0100)
Previously even after critical failures (e.g. no space left) delta
would still continue be applied (with no chance of success at the end)

Change-Id: I90795b82c2bc276f6f4a5f701af1aa17b71e8bef

src/upgrade-apply-deltafs/engine/SS_UPI.c

index a2b6829..b7e3724 100755 (executable)
@@ -1134,6 +1134,7 @@ int SS_FSUpdateFile(int ubFileType, ua_dataSS_t * ua_dataSS, int ulPatchCount, f
                                                LOGE("FS update Failed Result : [%d], [Item - %s]and size is[%d] Read Count[%d], index = [%d]\n", ulResult,
                                                 ubPatch, temp_param->data_size, ulReadCnt, ulFileIndex);
                                                SS_SetUpgradeState(E_SS_FSUPDATEFAILED);
+                                               broken = 1;
                                                break;
                                        }
                                }
@@ -1481,6 +1482,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                } else {
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - DELETES fail!!\n");
+                       goto cleanup;
                }
        }
 
@@ -1494,6 +1496,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                } else {
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - DIFFS fail!!\n");
+                       goto cleanup;
                }
        }
 
@@ -1507,6 +1510,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                        } else {
                                LOGL(LOG_SSENGINE, "SS_FSUpdateFile - MOVES fail!!\n");
+                               goto cleanup;
                        }
        }
 
@@ -1520,6 +1524,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                        } else {
                                LOGL(LOG_SSENGINE, "SS_FSUpdateFile - DELETE_END fail!!\n");
+                               goto cleanup;
                        }
        }
 
@@ -1534,6 +1539,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - NEWFILES success!!\n");
                } else {
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - NEWFILES fail!!\n");
+                       goto cleanup;
                }
        }
 
@@ -1548,6 +1554,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                } else {
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - SYMDIFFS fail!!\n");
+                       goto cleanup;
                }
        }
 
@@ -1562,6 +1569,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                } else {
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - SYMNEWFILES fail!!\n");
+                       goto cleanup;
                }
        }
 
@@ -1576,6 +1584,7 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                } else {
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - HARDNEWFILES fail!!\n");
+                       goto cleanup;
                }
        }
 
@@ -1590,9 +1599,11 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
                } else {
                        LOGL(LOG_SSENGINE, "SS_FSUpdateFile - HARDDIFFs fail!!\n");
+                       goto cleanup;
                }
        }
 
+cleanup:
        if (ulResult == S_SS_SUCCESS) {
                ulResult = SS_FSSetAttributes(ua_dataSS);
        } else {
@@ -1605,14 +1616,12 @@ int SS_FSUpdatemain(ua_dataSS_t * ua_dataSS)
 
        if (ulResult == S_SS_SUCCESS) {
                SS_UpdateUIProgress(ua_dataSS, 0, 1);   //fix WGID : 51963, When all updates are done to FS , patchcount is not needed, passing 1 to 3rd arg is enough
+               LOGL(LOG_SSENGINE, "FS update complete - success!\n");
+               return ulResult;
        }
 
-       LOGL(LOG_SSENGINE, "FS update Complete\n");
-
-       if (ulResult == S_SS_SUCCESS)
-               return ulResult;
-       else
-               return SS_GetUpgradeState();
+       LOGL(LOG_SSENGINE, "FS update complete - fail!\n");
+       return SS_GetUpgradeState();
 }
 
 /*!