From a01e15f1e43dc5c3109ca77029678cdb88e160a3 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 12 Jun 2012 16:31:39 +0200 Subject: [PATCH] libblkid: trust in udev symlinks, don't verify The libblkid always verify that /dev/disk/by-* symlinks match with on-device LABELs/UUIDs. It means that all requests (e.g. mount -L | -U) generates extra superblocks scans on the device. Currently, many users and tools (GNOME, systemd, ...etc) use the symlink directly and udev maintains the symlinks by inotify (+watch rule). It seems better for system performance to disable the extra paranoid mode and trust in udev. Signed-off-by: Karel Zak --- libblkid/src/blkidP.h | 5 ++++- libblkid/src/evaluate.c | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h index b6c2bc607f..604de3ddb4 100644 --- a/libblkid/src/blkidP.h +++ b/libblkid/src/blkidP.h @@ -13,9 +13,12 @@ #ifndef _BLKID_BLKIDP_H #define _BLKID_BLKIDP_H - +/* support debug output if LIBBLKID_DEBUG env. variable is set */ #define CONFIG_BLKID_DEBUG 1 +/* Always confirm that /dev/disk-by symlinks match with LABEL/UUID on device */ +/* #define CONFIG_BLKID_VERIFY_UDEV 1 */ + #include #include #include diff --git a/libblkid/src/evaluate.c b/libblkid/src/evaluate.c index fbd8a96fd6..5a84b43258 100644 --- a/libblkid/src/evaluate.c +++ b/libblkid/src/evaluate.c @@ -48,6 +48,7 @@ * API. */ +#ifdef CONFIG_BLKID_VERIFY_UDEV /* returns zero when the device has NAME=value (LABEL/UUID) */ static int verify_tag(const char *devname, const char *name, const char *value) { @@ -91,6 +92,7 @@ done: /* for non-root users we use unverified udev links */ return errsv == EACCES ? 0 : rc; } +#endif /* CONFIG_BLKID_VERIFY_UDEV*/ /** * blkid_send_uevent: @@ -169,8 +171,10 @@ static char *evaluate_by_udev(const char *token, const char *value, int uevent) if (!path) return NULL; +#ifdef CONFIG_BLKID_VERIFY_UDEV if (verify_tag(path, token, value)) goto failed; +#endif return path; failed: -- 2.47.3