Add forceCleanUp retrys when it sometimes fails 86/140886/4 accepted/tizen/unified/20170728.195541 submit/tizen/20170727.084517
authorSungbae Yoo <sungbae.yoo@samsung.com>
Thu, 27 Jul 2017 02:53:06 +0000 (11:53 +0900)
committerSungbae Yoo <sungbae.yoo@samsung.com>
Thu, 27 Jul 2017 08:31:19 +0000 (17:31 +0900)
Signed-off-by: Sungbae Yoo <sungbae.yoo@samsung.com>
Change-Id: I800def0118b23e29ad3db513dfd507e55d0f064d

server/engine/encryption/dmcrypt-engine.cpp

index c4cccfb..5cd3163 100644 (file)
@@ -271,7 +271,15 @@ void DMCryptEngine::encrypt(const DMCryptEngine::data &key, unsigned int options
 {
        // Force filesystem check via fcsf might be able to avoid fail situation during encryption.
        Ext4Tool ext4Source(source);
-       ext4Source.forceCleanUp();
+
+       for (int retry = 0; retry < 32; retry++) {
+               try {
+                       ext4Source.forceCleanUp();
+               } catch (runtime::Exception &e) {
+                       continue;
+               }
+               break;
+       }
 
        // create crypto type device mapping layer to mount the plain partition
        // should be encrypted here.
@@ -308,7 +316,15 @@ void DMCryptEngine::decrypt(const DMCryptEngine::data &key, unsigned int options
 
        // Force filesystem check via fcsf might be able to avoid fail situation during decryption.
        Ext4Tool ext4CryptoBlkDev(cryptoBlkDev);
-       ext4CryptoBlkDev.forceCleanUp();
+
+       for (int retry = 0; retry < 32; retry++) {
+               try {
+                       ext4CryptoBlkDev.forceCleanUp();
+               } catch (runtime::Exception &e) {
+                       continue;
+               }
+               break;
+       }
 
        std::function<bool(blkcnt_t)> isTarget;
        if (!(options & OPTION_INCLUDE_UNUSED_REGION)) {