aboutsummaryrefslogtreecommitdiffstats
path: root/updater
diff options
context:
space:
mode:
authorSami Tolvanen <samitolvanen@google.com>2015-06-09 21:42:30 +0100
committerSami Tolvanen <samitolvanen@google.com>2015-06-09 22:21:44 +0100
commit604c583c9dd3d47906b1a57c14a7e9650df7471e (patch)
treed1aa0e7ad15692da944a0de4ace55f940c600353 /updater
parent02b6472546b899ebc16029371eb75364059871d2 (diff)
downloadbootable_recovery-604c583c9dd3d47906b1a57c14a7e9650df7471e.zip
bootable_recovery-604c583c9dd3d47906b1a57c14a7e9650df7471e.tar.gz
bootable_recovery-604c583c9dd3d47906b1a57c14a7e9650df7471e.tar.bz2
Zero blocks before BLKDISCARD
Due to observed BLKDISCARD flakiness, overwrite blocks that we want to discard with zeros first to avoid later issues with dm-verity if BLKDISCARD is not successful. Bug: 20614277 Bug: 20881595 Change-Id: I0280fe115b020dcab35f49041fb55b7f8e793da3 (cherry picked from commit 96392b97f6bf1670d478494fb6df89a3410e53fa)
Diffstat (limited to 'updater')
-rw-r--r--updater/blockimg.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/updater/blockimg.c b/updater/blockimg.c
index 7b8721d..a2786c8 100644
--- a/updater/blockimg.c
+++ b/updater/blockimg.c
@@ -39,11 +39,6 @@
#define BLOCKSIZE 4096
-// Set this to 0 to interpret 'erase' transfers to mean do a
-// BLKDISCARD ioctl (the normal behavior). Set to 1 to interpret
-// erase to mean fill the region with zeroes.
-#define DEBUG_ERASE 0
-
#ifndef BLKDISCARD
#define BLKDISCARD _IO(0x12,119)
#endif
@@ -1222,8 +1217,7 @@ static int PerformCommandZero(CommandParameters* params) {
}
if (params->cmdname[0] == 'z') {
- // Update only for the zero command, as the erase command will call
- // this if DEBUG_ERASE is defined.
+ // Update only for the zero command, as the erase command will call this
params->written += tgt->size;
}
@@ -1409,8 +1403,10 @@ static int PerformCommandErase(CommandParameters* params) {
struct stat st;
uint64_t blocks[2];
- if (DEBUG_ERASE) {
- return PerformCommandZero(params);
+ // Always zero the blocks first to work around possibly flaky BLKDISCARD
+ // Bug: 20881595
+ if (PerformCommandZero(params) != 0) {
+ goto pceout;
}
if (!params) {