cryptfs: extra debugging around crypto blockdev dm-... errors.

Some times the /dev/block/dm-0 fails to open after it has been setup.
Log why.

Bug: 17576594
Bug: 17942270
Change-Id: If0bbfe22d84137f2029bacb10873832038f0d36c
This commit is contained in:
JP Abgrall 2014-10-10 15:52:11 -07:00
parent fc61504166
commit 3334c6a1ae

View file

@ -1894,7 +1894,10 @@ int cryptfs_setup_volume(const char *label, int major, int minor,
create_crypto_blk_dev(&sd_crypt_ftr, saved_master_key, real_blkdev,
crypto_blkdev, label);
stat(crypto_blkdev, &statbuf);
if (stat(crypto_blkdev, &statbuf) < 0) {
SLOGE("Error get stat for crypto_blkdev %s. err=%d(%s)\n",
crypto_blkdev, errno, strerror(errno));
}
*new_major = MAJOR(statbuf.st_rdev);
*new_minor = MINOR(statbuf.st_rdev);
@ -2424,15 +2427,15 @@ static int cryptfs_enable_inplace_ext4(char *crypto_blkdev,
data.crypto_blkdev = crypto_blkdev;
if ( (data.realfd = open(real_blkdev, O_RDWR)) < 0) {
SLOGE("Error opening real_blkdev %s for inplace encrypt\n",
real_blkdev);
SLOGE("Error opening real_blkdev %s for inplace encrypt. err=%d(%s)\n",
real_blkdev, errno, strerror(errno));
rc = -1;
goto errout;
}
if ( (data.cryptofd = open(crypto_blkdev, O_WRONLY)) < 0) {
SLOGE("Error opening crypto_blkdev %s for inplace encrypt\n",
crypto_blkdev);
SLOGE("Error opening crypto_blkdev %s for inplace encrypt. err=%d(%s)\n",
crypto_blkdev, errno, strerror(errno));
rc = -1;
goto errout;
}
@ -2561,8 +2564,8 @@ static int cryptfs_enable_inplace_f2fs(char *crypto_blkdev,
goto errout;
}
if ( (data.cryptofd = open64(crypto_blkdev, O_WRONLY)) < 0) {
SLOGE("Error opening crypto_blkdev %s for inplace encrypt\n",
crypto_blkdev);
SLOGE("Error opening crypto_blkdev %s for inplace encrypt. err=%d(%s)\n",
crypto_blkdev, errno, strerror(errno));
goto errout;
}
@ -2631,7 +2634,8 @@ static int cryptfs_enable_inplace_full(char *crypto_blkdev, char *real_blkdev,
}
if ( (cryptofd = open(crypto_blkdev, O_WRONLY)) < 0) {
SLOGE("Error opening crypto_blkdev %s for inplace encrypt\n", crypto_blkdev);
SLOGE("Error opening crypto_blkdev %s for inplace encrypt. err=%d(%s)\n",
crypto_blkdev, errno, strerror(errno));
close(realfd);
return -1;
}