[systemd-devel] [PATCH] blkid: Warn when rejecting a superblock with a bad csum
Gabriel de Perthuis
g2p.code at gmail.com
Fri Dec 12 04:26:08 PST 2014
Bump libblkid requirement from 2.20 to 2.24.
util-linux 2.25 is actually required since fdbbad981cc5da8bb4ed7e9b6646e7a114745ec5
---
configure.ac | 2 +-
src/udev/udev-builtin-blkid.c | 13 ++++++++++++-
2 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 9218ed3..453f5de 100644
--- a/configure.ac
+++ b/configure.ac
@@ -430,11 +430,11 @@ AM_CONDITIONAL(HAVE_XKBCOMMON, [test "$have_xkbcommon" = "yes"])
# ------------------------------------------------------------------------------
have_blkid=no
AC_ARG_ENABLE(blkid, AS_HELP_STRING([--disable-blkid], [disable blkid support]))
if test "x$enable_blkid" != "xno"; then
- PKG_CHECK_MODULES(BLKID, [ blkid >= 2.20 ],
+ PKG_CHECK_MODULES(BLKID, [ blkid >= 2.24 ],
[AC_DEFINE(HAVE_BLKID, 1, [Define if blkid is available]) have_blkid=yes], have_blkid=no)
if test "x$have_blkid" = xno -a "x$enable_blkid" = xyes; then
AC_MSG_ERROR([*** blkid support requested but libraries not found])
fi
fi
diff --git a/src/udev/udev-builtin-blkid.c b/src/udev/udev-builtin-blkid.c
index 810f27d..83bd8c4 100644
--- a/src/udev/udev-builtin-blkid.c
+++ b/src/udev/udev-builtin-blkid.c
@@ -219,10 +219,11 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
bool noraid = false;
_cleanup_close_ int fd = -1;
blkid_probe pr;
const char *data;
const char *name;
+ const char *prtype = NULL;
int nvals;
int i;
int err = 0;
bool is_gpt = false;
@@ -254,11 +255,12 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
return EXIT_FAILURE;
blkid_probe_set_superblocks_flags(pr,
BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID |
BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE |
- BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION);
+ BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION |
+ BLKID_SUBLKS_BADCSUM);
if (noraid)
blkid_probe_filter_superblocks_usage(pr, BLKID_FLTR_NOTIN, BLKID_USAGE_RAID);
fd = open(udev_device_get_devnode(dev), O_RDONLY|O_CLOEXEC);
@@ -276,10 +278,19 @@ static int builtin_blkid(struct udev_device *dev, int argc, char *argv[], bool t
noraid ? "no" : "", offset);
err = probe_superblocks(pr);
if (err < 0)
goto out;
+ if (blkid_probe_has_value(pr, "SBBADCSUM")) {
+ if (!blkid_probe_lookup_value(pr, "TYPE", &prtype, NULL))
+ log_warning("incorrect %s checksum on %s",
+ prtype, udev_device_get_devnode(dev));
+ else
+ log_warning("incorrect checksum on %s",
+ udev_device_get_devnode(dev));
+ goto out;
+ }
/* If we are a partition then our parent passed on the root
* partition UUID to us */
root_partition = udev_device_get_property_value(dev, "ID_PART_GPT_AUTO_ROOT_UUID");
--
2.1.2.457.g0cd6422
More information about the systemd-devel
mailing list