Skip to content
Snippets Groups Projects
Commit 7f7e4ffb authored by Drew Fisher's avatar Drew Fisher Committed by CQ bot account: commit-bot@chromium.org
Browse files

[fshost] Revert log when encountering unknown disk format

This reverts commit 396d2162.

Reason for revert: we've gotten enough information on the bug that we were trying to investigate with this (DNO-492) that we no longer need this logging, and the excessive logging is causing people grief.

Original change's description:
> [fshost] log when encountering unknown disk format
> 
> DNO-492 #comment
> Tests: paved an Astro, saw this log reasonable content
> for the empty volumes before formatted, did not log after paved.
> 
> Change-Id: I07a80dc2a826e80ba5c12ca5901d460a65266153

TBR=smklein@google.com,abarth@google.com,zarvox@google.com

# Not skipping CQ checks because original CL landed > 1 day ago.

Change-Id: Ifc296d88a00a9898cebd49980ffcfa409d45b0d0
parent b8a76e6a
No related branches found
No related tags found
No related merge requests found
......@@ -86,7 +86,7 @@ int UnsealZxcryptThread(void* arg) {
zx_status_t rc;
std::unique_ptr<zxcrypt::FdioVolume> zxcrypt_volume;
if ((rc = zxcrypt::FdioVolume::Init(std::move(fd), &zxcrypt_volume)) != ZX_OK) {
printf("fshost: couldn't open zxcrypt fdio volume\n");
printf("fshost: couldn't open zxcrypt fdio volume");
return ZX_OK;
}
......@@ -94,14 +94,14 @@ int UnsealZxcryptThread(void* arg) {
if ((rc = zxcrypt_volume->OpenManager(zx::sec(2),
zxcrypt_volume_manager_chan.reset_and_get_address())) !=
ZX_OK) {
printf("fshost: couldn't open zxcrypt manager device\n");
printf("fshost: couldn't open zxcrypt manager device");
return 0;
}
zxcrypt::FdioVolumeManager zxcrypt_volume_manager(std::move(zxcrypt_volume_manager_chan));
uint8_t slot = 0;
if ((rc = zxcrypt_volume_manager.UnsealWithDeviceKey(slot)) != ZX_OK) {
printf("fshost: couldn't unseal zxcrypt manager device\n");
printf("fshost: couldn't unseal zxcrypt manager device");
return 0;
}
......@@ -112,7 +112,7 @@ int UnsealZxcryptThread(void* arg) {
BlockDevice::BlockDevice(FilesystemMounter* mounter, fbl::unique_fd fd)
: mounter_(mounter), fd_(std::move(fd)),
format_(detect_disk_format_log_unknown(fd_.get())) {}
format_(detect_disk_format(fd_.get())) {}
disk_format_t BlockDevice::GetFormat() {
return format_;
......
......@@ -60,14 +60,7 @@ zx_status_t BlockDeviceCallback(int dirfd, int event, const char* name, void* co
auto mounter = static_cast<FilesystemMounter*>(cookie);
BlockDevice device(mounter, std::move(device_fd));
zx_status_t rc = device.Add();
if (rc != ZX_OK) {
// This callback has to return ZX_OK for resiliency reasons, or we'll
// stop getting subsequent callbacks, but we should log loudly that we
// tried to do something and that failed.
fprintf(stderr, "fshost: (%s/%s) failed: %s\n", kPathBlockDeviceRoot,
name, zx_status_get_string(rc));
}
device.Add();
return ZX_OK;
}
......
......@@ -29,7 +29,6 @@ library("fs-management") {
"$zx/system/ulib/fvm",
"$zx/system/ulib/fzl",
"$zx/system/ulib/gpt",
"$zx/system/ulib/pretty",
"$zx/system/ulib/zx",
"$zx/system/ulib/zxcpp",
"$zx/third_party/ulib/uboringssl",
......
......@@ -73,7 +73,6 @@ static const uint8_t zxcrypt_magic[16] = {
};
disk_format_t detect_disk_format(int fd);
disk_format_t detect_disk_format_log_unknown(int fd);
typedef struct mount_options {
bool readonly;
......
......@@ -25,7 +25,6 @@
#include <lib/fdio/vfs.h>
#include <lib/fzl/fdio.h>
#include <lib/zx/channel.h>
#include <pretty/hexdump.h>
#include <zircon/compiler.h>
#include <zircon/device/block.h>
#include <zircon/device/vfs.h>
......@@ -272,12 +271,7 @@ const fsck_options_t default_fsck_options = {
.apply_journal = false,
};
enum DiskFormatLogVerbosity {
Silent,
Verbose,
};
disk_format_t detect_disk_format_impl(int fd, DiskFormatLogVerbosity verbosity) {
disk_format_t detect_disk_format(int fd) {
if (lseek(fd, 0, SEEK_SET) != 0) {
fprintf(stderr, "detect_disk_format: Cannot seek to start of device.\n");
return DISK_FORMAT_UNKNOWN;
......@@ -333,30 +327,9 @@ disk_format_t detect_disk_format_impl(int fd, DiskFormatLogVerbosity verbosity)
}
return DISK_FORMAT_MBR;
}
if (verbosity == DiskFormatLogVerbosity::Verbose) {
// Log a hexdump of the bytes we looked at and didn't find any magic in.
fprintf(stderr, "detect_disk_format: did not recognize format. Looked at:\n");
// fvm, zxcrypt, minfs, and blobfs have their magic bytes at the start
// of the block.
hexdump_very_ex(data, 16, 0, hexdump_stdio_printf, stderr);
// MBR is two bytes at offset 0x1fe, but print 16 just for consistency
hexdump_very_ex(data + 0x1f0, 16, 0x1f0, hexdump_stdio_printf, stderr);
// GPT magic is stored 512 bytes in, so it can coexist with MBR.
hexdump_very_ex(data + 0x200, 16, 0x200, hexdump_stdio_printf, stderr);
}
return DISK_FORMAT_UNKNOWN;
}
disk_format_t detect_disk_format(int fd) {
return detect_disk_format_impl(fd, DiskFormatLogVerbosity::Silent);
}
disk_format_t detect_disk_format_log_unknown(int fd) {
return detect_disk_format_impl(fd, DiskFormatLogVerbosity::Verbose);
}
zx_status_t fmount(int device_fd, int mount_fd, disk_format_t df, const mount_options_t* options,
LaunchCallback cb) {
Mounter mounter(mount_fd);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment