summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarel Zak2012-06-12 16:31:39 +0200
committerKarel Zak2012-06-12 16:31:39 +0200
commita01e15f1e43dc5c3109ca77029678cdb88e160a3 (patch)
treeebd28848155fd3426f86de26cd921e80fd26ee6f
parentlosetup: improve -a to report loopdevs < 512 bytes (diff)
downloadkernel-qcow2-util-linux-a01e15f1e43dc5c3109ca77029678cdb88e160a3.tar.gz
kernel-qcow2-util-linux-a01e15f1e43dc5c3109ca77029678cdb88e160a3.tar.xz
kernel-qcow2-util-linux-a01e15f1e43dc5c3109ca77029678cdb88e160a3.zip
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 <kzak@redhat.com>
-rw-r--r--libblkid/src/blkidP.h5
-rw-r--r--libblkid/src/evaluate.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/libblkid/src/blkidP.h b/libblkid/src/blkidP.h
index b6c2bc607..604de3ddb 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 <sys/types.h>
#include <dirent.h>
#include <sys/stat.h>
diff --git a/libblkid/src/evaluate.c b/libblkid/src/evaluate.c
index fbd8a96fd..5a84b4325 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: