OSDN Git Service

MetadataCrypt: remove unnecessary retry loop
authorEric Biggers <ebiggers@google.com>
Thu, 15 Oct 2020 21:39:34 +0000 (14:39 -0700)
committerEric Biggers <ebiggers@google.com>
Thu, 15 Oct 2020 21:46:35 +0000 (14:46 -0700)
As per the discussion at http://aosp/1456266, the retry loop in
create_crypto_blk_dev() doesn't appear to be needed.  Remove it.

For now don't bother removing the same retry loop in cryptfs.cpp, since
the FDE code isn't really being updated anymore and eventually will be
removed entirely.

Change-Id: Iba0b046f9cdd9723ea1a2ae70f4d4aed4355b97b

MetadataCrypt.cpp

index 4b61373..4f35e9a 100644 (file)
@@ -45,8 +45,6 @@
 #include "Utils.h"
 #include "VoldUtil.h"
 
-#define TABLE_LOAD_RETRIES 10
-
 namespace android {
 namespace vold {
 
@@ -215,18 +213,10 @@ static bool create_crypto_blk_dev(const std::string& dm_name, const std::string&
     table.AddTarget(std::move(target));
 
     auto& dm = DeviceMapper::Instance();
-    for (int i = 0;; i++) {
-        if (dm.CreateDevice(dm_name, table, crypto_blkdev, std::chrono::seconds(5))) {
-            break;
-        }
-        if (i + 1 >= TABLE_LOAD_RETRIES) {
-            PLOG(ERROR) << "Could not create default-key device " << dm_name;
-            return false;
-        }
-        PLOG(INFO) << "Could not create default-key device, retrying";
-        usleep(500000);
+    if (!dm.CreateDevice(dm_name, table, crypto_blkdev, std::chrono::seconds(5))) {
+        PLOG(ERROR) << "Could not create default-key device " << dm_name;
+        return false;
     }
-
     return true;
 }