forked from pool/util-linux
Accepting request 230696 from home:sbrabec:branches:Base:System
- Enable socket activation needed by systemd service (bnc#872807). - libblkid: Drop the broken ext2/ext3/ext4 discrimination logic (util-linux-libblkid-ext-probe.patch, bnc#864703). - Abort blkid probing on I/O errors (bnc#859062, blkid-stop-scanning-on-I-O-error.patch, blkid-convert-superblocks-to-new-calling-convention.patch, http://www.spinics.net/lists/util-linux-ng/msg08976.html) OBS-URL: https://build.opensuse.org/request/show/230696 OBS-URL: https://build.opensuse.org/package/show/Base:System/util-linux?expand=0&rev=231
This commit is contained in:
parent
4cf84bd5f1
commit
737b1a31db
2268
blkid-convert-superblocks-to-new-calling-convention.patch
Normal file
2268
blkid-convert-superblocks-to-new-calling-convention.patch
Normal file
File diff suppressed because it is too large
Load Diff
138
blkid-stop-scanning-on-I-O-error.patch
Normal file
138
blkid-stop-scanning-on-I-O-error.patch
Normal file
@ -0,0 +1,138 @@
|
||||
From 65245d440656a8df4352f9a5b9ec047bf4b6a663 Mon Sep 17 00:00:00 2001
|
||||
From: Hannes Reinecke <hare@suse.de>
|
||||
Date: Tue, 21 Jan 2014 09:16:46 +0100
|
||||
Subject: [PATCH] blkid: stop scanning on I/O error
|
||||
|
||||
Whenever we fail to read from a device it's pointless to
|
||||
continue with probing; we should be failing immediately.
|
||||
Otherwise the system will continue logging I/O errors.
|
||||
|
||||
This patch updates the probe functions to return -1
|
||||
on error and 1 if not found.
|
||||
|
||||
Signed-off-by: Hannes Reinecke <hare@suse.de>
|
||||
---
|
||||
libblkid/src/partitions/partitions.c | 13 +++++++++----
|
||||
libblkid/src/probe.c | 13 +++++++++++--
|
||||
libblkid/src/superblocks/superblocks.c | 13 ++++++++++---
|
||||
3 files changed, 30 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/libblkid/src/partitions/partitions.c b/libblkid/src/partitions/partitions.c
|
||||
index 6c915d9..98baece 100644
|
||||
--- a/libblkid/src/partitions/partitions.c
|
||||
+++ b/libblkid/src/partitions/partitions.c
|
||||
@@ -540,7 +540,8 @@ static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id,
|
||||
if (pr->size <= 0 || (id->minsz && id->minsz > pr->size))
|
||||
goto nothing; /* the device is too small */
|
||||
|
||||
- if (blkid_probe_get_idmag(pr, id, &off, &mag))
|
||||
+ rc = blkid_probe_get_idmag(pr, id, &off, &mag);
|
||||
+ if (rc != 0)
|
||||
goto nothing;
|
||||
|
||||
/* final check by probing function */
|
||||
@@ -548,12 +549,13 @@ static int idinfo_probe(blkid_probe pr, const struct blkid_idinfo *id,
|
||||
DBG(LOWPROBE, blkid_debug(
|
||||
"%s: ---> call probefunc()", id->name));
|
||||
rc = id->probefunc(pr, mag);
|
||||
- if (rc == -1) {
|
||||
+ if (rc != 0) {
|
||||
/* reset after error */
|
||||
reset_partlist(blkid_probe_get_partlist(pr));
|
||||
if (chn && !chn->binary)
|
||||
blkid_probe_chain_reset_vals(pr, chn);
|
||||
- DBG(LOWPROBE, blkid_debug("%s probefunc failed", id->name));
|
||||
+ DBG(LOWPROBE, blkid_debug("%s probefunc failed, rc %d",
|
||||
+ id->name, rc));
|
||||
}
|
||||
if (rc == 0 && mag && chn && !chn->binary)
|
||||
rc = blkid_probe_set_magic(pr, off, mag->len,
|
||||
@@ -599,7 +601,10 @@ static int partitions_probe(blkid_probe pr, struct blkid_chain *chn)
|
||||
continue;
|
||||
|
||||
/* apply checks from idinfo */
|
||||
- if (idinfo_probe(pr, idinfos[i], chn) != 0)
|
||||
+ rc = idinfo_probe(pr, idinfos[i], chn);
|
||||
+ if (rc < 0)
|
||||
+ return rc;
|
||||
+ if (rc > 0)
|
||||
continue;
|
||||
|
||||
name = idinfos[i]->name;
|
||||
diff --git a/libblkid/src/probe.c b/libblkid/src/probe.c
|
||||
index 4b0c997..452c743 100644
|
||||
--- a/libblkid/src/probe.c
|
||||
+++ b/libblkid/src/probe.c
|
||||
@@ -569,13 +569,17 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
|
||||
if (!bf) {
|
||||
ssize_t ret;
|
||||
|
||||
- if (blkid_llseek(pr->fd, pr->off + off, SEEK_SET) < 0)
|
||||
+ if (blkid_llseek(pr->fd, pr->off + off, SEEK_SET) < 0) {
|
||||
+ errno = 0;
|
||||
return NULL;
|
||||
+ }
|
||||
|
||||
/* allocate info and space for data by why call */
|
||||
bf = calloc(1, sizeof(struct blkid_bufinfo) + len);
|
||||
- if (!bf)
|
||||
+ if (!bf) {
|
||||
+ errno = 0;
|
||||
return NULL;
|
||||
+ }
|
||||
|
||||
bf->data = ((unsigned char *) bf) + sizeof(struct blkid_bufinfo);
|
||||
bf->len = len;
|
||||
@@ -587,7 +591,10 @@ unsigned char *blkid_probe_get_buffer(blkid_probe pr,
|
||||
|
||||
ret = read(pr->fd, bf->data, len);
|
||||
if (ret != (ssize_t) len) {
|
||||
+ DBG(LOWPROBE, blkid_debug("\tbuffer read: return %d error %d", ret, errno));
|
||||
free(bf);
|
||||
+ if (ret >= 0 || errno != EIO)
|
||||
+ errno = 0;
|
||||
return NULL;
|
||||
}
|
||||
list_add_tail(&bf->bufs, &pr->buffers);
|
||||
@@ -794,6 +801,8 @@ int blkid_probe_get_idmag(blkid_probe pr, const struct blkid_idinfo *id,
|
||||
off = (mag->kboff + (mag->sboff >> 10)) << 10;
|
||||
buf = blkid_probe_get_buffer(pr, off, 1024);
|
||||
|
||||
+ if (!buf && errno)
|
||||
+ return -1;
|
||||
if (buf && !memcmp(mag->magic,
|
||||
buf + (mag->sboff & 0x3ff), mag->len)) {
|
||||
DBG(LOWPROBE, blkid_debug("\tmagic sboff=%u, kboff=%ld",
|
||||
diff --git a/libblkid/src/superblocks/superblocks.c b/libblkid/src/superblocks/superblocks.c
|
||||
index 565daf2..ad93b4e 100644
|
||||
--- a/libblkid/src/superblocks/superblocks.c
|
||||
+++ b/libblkid/src/superblocks/superblocks.c
|
||||
@@ -380,15 +380,22 @@ static int superblocks_probe(blkid_probe pr, struct blkid_chain *chn)
|
||||
|
||||
DBG(LOWPROBE, blkid_debug("[%zd] %s:", i, id->name));
|
||||
|
||||
- if (blkid_probe_get_idmag(pr, id, &off, &mag))
|
||||
+ rc = blkid_probe_get_idmag(pr, id, &off, &mag);
|
||||
+ if (rc < 0)
|
||||
+ break;
|
||||
+ if (rc > 0)
|
||||
continue;
|
||||
|
||||
/* final check by probing function */
|
||||
if (id->probefunc) {
|
||||
DBG(LOWPROBE, blkid_debug("\tcall probefunc()"));
|
||||
- if (id->probefunc(pr, mag) != 0) {
|
||||
+ rc = id->probefunc(pr, mag);
|
||||
+ if (rc != 0) {
|
||||
blkid_probe_chain_reset_vals(pr, chn);
|
||||
- continue;
|
||||
+ if (rc < 0)
|
||||
+ break;
|
||||
+ else
|
||||
+ continue;
|
||||
}
|
||||
}
|
||||
|
||||
--
|
||||
1.8.1.4
|
||||
|
274
util-linux-libblkid-ext-probe.patch
Normal file
274
util-linux-libblkid-ext-probe.patch
Normal file
@ -0,0 +1,274 @@
|
||||
This is a backport of patch from master branch.
|
||||
|
||||
commit a1ca32fb3862ccac7275d6b342805b6d99f20e39
|
||||
Author: Lukas Czerner <lczerner@redhat.com>
|
||||
Date: Tue Dec 3 16:24:44 2013 +0100
|
||||
|
||||
libblkid: Identify extN file system properly
|
||||
|
||||
Currently when trying to identify extN file system we're playing games
|
||||
with searching for kernel modules and parsing /proc/filesystem. All of
|
||||
this just because ext4 module can be used to mount ext3 and ext2 file
|
||||
systems on recent kernel and also because of ext4dev.
|
||||
|
||||
However all of this is not necessary. Ext4 module which does support
|
||||
mounting ext2 and ext3 file system is able to recognize and mount ext2
|
||||
and ext3 type so there is no need to disguise it and ext4dev should only
|
||||
be ever used for testing and not as fallback when other modules are
|
||||
missing (use -t instead).
|
||||
|
||||
This also introduces a bug when in situation that we only have ext4
|
||||
modules with ext2/ext3 support which is not loaded and we try to mount
|
||||
ext2 file system we will mount it incorrectly as ext4. This will not
|
||||
happen if the ext4 module is already loaded.
|
||||
|
||||
With this patch we remove all the unnecessary checks and return the real
|
||||
type of the file system which is on the device. This fixes the issue.
|
||||
However on the kernel which was not compiled with EXT4_USE_FOR_EXT23
|
||||
support one would have to provide file system type (-t) to be able to
|
||||
mount the file system with ext4 driver.
|
||||
|
||||
Signed-off-by: Lukas Czerner <lczerner@redhat.com>
|
||||
Signed-off-by: Karel Zak <kzak@redhat.com>
|
||||
|
||||
Index: util-linux-2.24.1/libblkid/src/superblocks/ext.c
|
||||
===================================================================
|
||||
--- util-linux-2.24.1.orig/libblkid/src/superblocks/ext.c
|
||||
+++ util-linux-2.24.1/libblkid/src/superblocks/ext.c
|
||||
@@ -18,7 +18,6 @@
|
||||
#endif
|
||||
#include <time.h>
|
||||
|
||||
-#include "linux_version.h"
|
||||
#include "superblocks.h"
|
||||
|
||||
struct ext2_super_block {
|
||||
@@ -132,140 +131,11 @@ struct ext2_super_block {
|
||||
#define EXT3_FEATURE_RO_COMPAT_UNSUPPORTED ~EXT3_FEATURE_RO_COMPAT_SUPP
|
||||
|
||||
/*
|
||||
- * Check to see if a filesystem is in /proc/filesystems.
|
||||
- * Returns 1 if found, 0 if not
|
||||
- */
|
||||
-static int fs_proc_check(const char *fs_name)
|
||||
-{
|
||||
- FILE *f;
|
||||
- char buf[80], *cp, *t;
|
||||
-
|
||||
- f = fopen("/proc/filesystems", "r" UL_CLOEXECSTR);
|
||||
- if (!f)
|
||||
- return 0;
|
||||
- while (!feof(f)) {
|
||||
- if (!fgets(buf, sizeof(buf), f))
|
||||
- break;
|
||||
- cp = buf;
|
||||
- if (!isspace(*cp)) {
|
||||
- while (*cp && !isspace(*cp))
|
||||
- cp++;
|
||||
- }
|
||||
- while (*cp && isspace(*cp))
|
||||
- cp++;
|
||||
- if ((t = strchr(cp, '\n')) != NULL)
|
||||
- *t = 0;
|
||||
- if ((t = strchr(cp, '\t')) != NULL)
|
||||
- *t = 0;
|
||||
- if ((t = strchr(cp, ' ')) != NULL)
|
||||
- *t = 0;
|
||||
- if (!strcmp(fs_name, cp)) {
|
||||
- fclose(f);
|
||||
- return 1;
|
||||
- }
|
||||
- }
|
||||
- fclose(f);
|
||||
- return (0);
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
- * Check to see if a filesystem is available as a module
|
||||
- * Returns 1 if found, 0 if not
|
||||
- */
|
||||
-static int check_for_modules(const char *fs_name)
|
||||
-{
|
||||
-#ifdef __linux__
|
||||
- struct utsname uts;
|
||||
- FILE *f;
|
||||
- char buf[1024], *cp;
|
||||
- int namesz;
|
||||
-
|
||||
- if (uname(&uts))
|
||||
- return 0;
|
||||
- snprintf(buf, sizeof(buf), "/lib/modules/%s/modules.dep", uts.release);
|
||||
-
|
||||
- f = fopen(buf, "r" UL_CLOEXECSTR);
|
||||
- if (!f)
|
||||
- return 0;
|
||||
-
|
||||
- namesz = strlen(fs_name);
|
||||
-
|
||||
- while (!feof(f)) {
|
||||
- if (!fgets(buf, sizeof(buf), f))
|
||||
- break;
|
||||
- if ((cp = strchr(buf, ':')) != NULL)
|
||||
- *cp = 0;
|
||||
- else
|
||||
- continue;
|
||||
- if ((cp = strrchr(buf, '/')) == NULL)
|
||||
- continue;
|
||||
- cp++;
|
||||
-
|
||||
- if (!strncmp(cp, fs_name, namesz) &&
|
||||
- (!strcmp(cp + namesz, ".ko") ||
|
||||
- !strcmp(cp + namesz, ".ko.gz"))) {
|
||||
- fclose(f);
|
||||
- return 1;
|
||||
- }
|
||||
- }
|
||||
- fclose(f);
|
||||
-#endif /* __linux__ */
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-/*
|
||||
* Starting in 2.6.29, ext4 can be used to support filesystems
|
||||
* without a journal.
|
||||
*/
|
||||
#define EXT4_SUPPORTS_EXT2 KERNEL_VERSION(2, 6, 29)
|
||||
|
||||
-static int system_supports_ext2(void)
|
||||
-{
|
||||
- static time_t last_check = 0;
|
||||
- static int ret = -1;
|
||||
- time_t now = time(0);
|
||||
-
|
||||
- if (ret != -1 || (now - last_check) < 5)
|
||||
- return ret;
|
||||
- last_check = now;
|
||||
- ret = (fs_proc_check("ext2") || check_for_modules("ext2"));
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static int system_supports_ext4(void)
|
||||
-{
|
||||
- static time_t last_check = 0;
|
||||
- static int ret = -1;
|
||||
- time_t now = time(0);
|
||||
-
|
||||
- if (ret != -1 || (now - last_check) < 5)
|
||||
- return ret;
|
||||
- last_check = now;
|
||||
- ret = (fs_proc_check("ext4") || check_for_modules("ext4"));
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static int system_supports_ext4dev(void)
|
||||
-{
|
||||
- static time_t last_check = 0;
|
||||
- static int ret = -1;
|
||||
- time_t now = time(0);
|
||||
-
|
||||
- if (ret != -1 || (now - last_check) < 5)
|
||||
- return ret;
|
||||
- last_check = now;
|
||||
- ret = (fs_proc_check("ext4dev") || check_for_modules("ext4dev"));
|
||||
- return ret;
|
||||
-}
|
||||
-
|
||||
-static int system_supports_ext4_ext2(void)
|
||||
-{
|
||||
-#ifdef __linux__
|
||||
- return get_linux_version() >= EXT4_SUPPORTS_EXT2;
|
||||
-#else
|
||||
- return 0;
|
||||
-#endif
|
||||
-}
|
||||
/*
|
||||
* reads superblock and returns:
|
||||
* fc = feature_compat
|
||||
@@ -357,15 +227,6 @@ static int probe_ext2(blkid_probe pr,
|
||||
(fi & EXT2_FEATURE_INCOMPAT_UNSUPPORTED))
|
||||
return 1;
|
||||
|
||||
- /*
|
||||
- * If ext2 is not present, but ext4 or ext4dev are, then
|
||||
- * disclaim we are ext2
|
||||
- */
|
||||
- if (!system_supports_ext2() &&
|
||||
- (system_supports_ext4() || system_supports_ext4dev()) &&
|
||||
- system_supports_ext4_ext2())
|
||||
- return 1;
|
||||
-
|
||||
ext_get_info(pr, 2, es);
|
||||
return 0;
|
||||
}
|
||||
@@ -408,34 +269,9 @@ static int probe_ext4dev(blkid_probe pr,
|
||||
if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
|
||||
return 1;
|
||||
|
||||
- /*
|
||||
- * If the filesystem does not have a journal and ext2 and ext4
|
||||
- * is not present, then force this to be detected as an
|
||||
- * ext4dev filesystem.
|
||||
- */
|
||||
- if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
|
||||
- !system_supports_ext2() && !system_supports_ext4() &&
|
||||
- system_supports_ext4dev() &&
|
||||
- system_supports_ext4_ext2())
|
||||
- goto force_ext4dev;
|
||||
-
|
||||
- /*
|
||||
- * If the filesystem is marked as OK for use by in-development
|
||||
- * filesystem code, but ext4dev is not supported, and ext4 is,
|
||||
- * then don't call ourselves ext4dev, since we should be
|
||||
- * detected as ext4 in that case.
|
||||
- *
|
||||
- * If the filesystem is marked as in use by production
|
||||
- * filesystem, then it can only be used by ext4 and NOT by
|
||||
- * ext4dev, so always disclaim we are ext4dev in that case.
|
||||
- */
|
||||
- if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) {
|
||||
- if (!system_supports_ext4dev() && system_supports_ext4())
|
||||
- return 1;
|
||||
- } else
|
||||
+ if (!(le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS))
|
||||
return 1;
|
||||
|
||||
-force_ext4dev:
|
||||
ext_get_info(pr, 4, es);
|
||||
return 0;
|
||||
}
|
||||
@@ -454,22 +290,11 @@ static int probe_ext4(blkid_probe pr,
|
||||
if (fi & EXT3_FEATURE_INCOMPAT_JOURNAL_DEV)
|
||||
return 1;
|
||||
|
||||
- /*
|
||||
- * If the filesystem does not have a journal and ext2 is not
|
||||
- * present, then force this to be detected as an ext2
|
||||
- * filesystem.
|
||||
- */
|
||||
- if (!(fc & EXT3_FEATURE_COMPAT_HAS_JOURNAL) &&
|
||||
- !system_supports_ext2() && system_supports_ext4() &&
|
||||
- system_supports_ext4_ext2())
|
||||
- goto force_ext4;
|
||||
-
|
||||
/* Ext4 has at least one feature which ext3 doesn't understand */
|
||||
if (!(frc & EXT3_FEATURE_RO_COMPAT_UNSUPPORTED) &&
|
||||
!(fi & EXT3_FEATURE_INCOMPAT_UNSUPPORTED))
|
||||
return 1;
|
||||
|
||||
-force_ext4:
|
||||
/*
|
||||
* If the filesystem is a OK for use by in-development
|
||||
* filesystem code, and ext4dev is supported or ext4 is not
|
||||
@@ -480,10 +305,8 @@ force_ext4:
|
||||
* filesystem, then it can only be used by ext4 and NOT by
|
||||
* ext4dev.
|
||||
*/
|
||||
- if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS) {
|
||||
- if (system_supports_ext4dev() || !system_supports_ext4())
|
||||
- return 1;
|
||||
- }
|
||||
+ if (le32_to_cpu(es->s_flags) & EXT2_FLAGS_TEST_FILESYS)
|
||||
+ return 1;
|
||||
|
||||
ext_get_info(pr, 4, es);
|
||||
return 0;
|
@ -1,3 +1,22 @@
|
||||
-------------------------------------------------------------------
|
||||
Thu Apr 17 22:43:31 CEST 2014 - sbrabec@suse.cz
|
||||
|
||||
- Enable socket activation needed by systemd service (bnc#872807).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 11 16:45:03 CEST 2014 - sbrabec@suse.cz
|
||||
|
||||
- libblkid: Drop the broken ext2/ext3/ext4 discrimination logic
|
||||
(util-linux-libblkid-ext-probe.patch, bnc#864703).
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Apr 11 16:27:11 CEST 2014 - hare@suse.de
|
||||
|
||||
- Abort blkid probing on I/O errors (bnc#859062,
|
||||
blkid-stop-scanning-on-I-O-error.patch,
|
||||
blkid-convert-superblocks-to-new-calling-convention.patch,
|
||||
http://www.spinics.net/lists/util-linux-ng/msg08976.html)
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Apr 1 18:49:26 UTC 2014 - sweet_f_a@gmx.de
|
||||
|
||||
|
@ -124,6 +124,13 @@ Patch21: util-linux-ng-2.16-squashfs3-detect.patch
|
||||
Patch23: util-linux-ng-2.19.1-barrier_documentation.patch
|
||||
# PATCH-FEATURE-SLES util-linux-lscpu-improve-hypervisor-detection.patch fate310255 puzel@novell.com -- Improve hypervisor detection.
|
||||
Patch24: util-linux-lscpu-improve-hypervisor-detection.patch
|
||||
# PATH-FIX-SLES blkid-stop-scanning-on-I-O-error.patch bnc859062 hare@suse.de -- Abort blkid probing on I/O errors
|
||||
Patch30: blkid-stop-scanning-on-I-O-error.patch
|
||||
# PATH-FIX-SLES lkid-convert-superblocks-to-new-calling-convention.patch bnc859062 hare@suse.de -- convert blkid probing functions to new calling sequence
|
||||
Patch31: blkid-convert-superblocks-to-new-calling-convention.patch
|
||||
# PATH-FIX-UPSTREAM util-linux-libblkid-ext-probe.patch bnc864703 sbrabec@suse.cz -- libblkid: Drop the broken ext2/ext3/ext4 discrimination logic.
|
||||
Patch32: util-linux-libblkid-ext-probe.patch
|
||||
|
||||
##
|
||||
## klogconsole
|
||||
##
|
||||
@ -256,6 +263,9 @@ xzcat %{S:0} | %gpg_verify %{S:12} -
|
||||
%patch21 -p1
|
||||
%patch23 -p1
|
||||
%patch24 -p1
|
||||
%patch30 -p1
|
||||
%patch31 -p1
|
||||
%patch32 -p1
|
||||
#
|
||||
# setctsid
|
||||
cp -p %{S:22} %{S:23} .
|
||||
@ -311,6 +321,7 @@ export SUID_LDFLAGS="-pie"
|
||||
--enable-new-mount \
|
||||
--enable-login-utils \
|
||||
--enable-tunelp \
|
||||
--enable-socket-activation \
|
||||
%if %{with enable_last}
|
||||
--enable-last \
|
||||
%else
|
||||
|
Loading…
Reference in New Issue
Block a user