SHA256
1
0
forked from pool/systemd

Accepting request 145035 from home:elvigia:branches:Base:System

OBS-URL: https://build.opensuse.org/request/show/145035
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=322
This commit is contained in:
Robert Milasan 2012-12-13 09:24:00 +00:00 committed by Git OBS Bridge
parent 279d242f4c
commit 79b1f32c8f
6 changed files with 161 additions and 0 deletions

97
detect-btrfs-ssd.patch Normal file
View File

@ -0,0 +1,97 @@
commit d7228cb8529de83115af04bf653b4d204dad8fae
Author: Lennart Poettering <lennart@poettering.net>
Date: Thu Nov 22 01:51:06 2012 +0100
readahead: properly detect btrfs on SSD
diff --git a/src/readahead/readahead-common.c b/src/readahead/readahead-common.c
index 10b0ccc..41aaff0 100644
--- a/src/readahead/readahead-common.c
+++ b/src/readahead/readahead-common.c
@@ -32,6 +32,7 @@
#include "log.h"
#include "readahead-common.h"
#include "util.h"
+#include "missing.h"
int file_verify(int fd, const char *fn, off_t file_size_max, struct stat *st) {
assert(fd >= 0);
@@ -62,14 +63,63 @@ int fs_on_ssd(const char *p) {
struct udev_device *udev_device = NULL, *look_at = NULL;
bool b = false;
const char *devtype, *rotational, *model, *id;
+ int r;
assert(p);
if (stat(p, &st) < 0)
return -errno;
- if (major(st.st_dev) == 0)
+ if (major(st.st_dev) == 0) {
+ _cleanup_fclose_ FILE *f = NULL;
+ int mount_id;
+ struct file_handle *h;
+
+ /* Might be btrfs, which exposes "ssd" as mount flag if it is on ssd.
+ *
+ * We first determine the mount ID here, if we can,
+ * and then lookup the mount ID in mountinfo to find
+ * the mount options. */
+
+ h = alloca(MAX_HANDLE_SZ);
+ h->handle_bytes = MAX_HANDLE_SZ;
+ r = name_to_handle_at(AT_FDCWD, p, h, &mount_id, AT_SYMLINK_FOLLOW);
+ if (r < 0)
+ return false;
+
+ f = fopen("/proc/self/mountinfo", "re");
+ if (!f)
+ return false;
+
+ for (;;) {
+ char line[LINE_MAX], *e;
+ _cleanup_free_ char *opts = NULL;
+ int mid;
+
+ if (!fgets(line, sizeof(line), f))
+ return false;
+
+ truncate_nl(line);
+
+ if (sscanf(line, "%i", &mid) != 1)
+ continue;
+
+ if (mid != mount_id)
+ continue;
+
+ e = strstr(line, " - ");
+ if (!e)
+ continue;
+
+ if (sscanf(e+3, "%*s %*s %ms", &opts) != 1)
+ continue;
+
+ if (streq(opts, "ssd") || startswith(opts, "ssd,") || endswith(opts, ",ssd") || strstr(opts, ",ssd,"))
+ return true;
+ }
+
return false;
+ }
udev = udev_new();
if (!udev)
@@ -97,9 +147,10 @@ int fs_on_ssd(const char *p) {
/* Second, try kernel attribute */
rotational = udev_device_get_sysattr_value(look_at, "queue/rotational");
- if (rotational)
- if ((b = streq(rotational, "0")))
- goto finish;
+ if (rotational) {
+ b = streq(rotational, "0");
+ goto finish;
+ }
/* Finally, fallback to heuristics */
look_at = udev_device_get_parent(look_at);

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Dec 11 00:22:50 UTC 2012 - crrodriguez@opensuse.org
- detect-btrfs-ssd.patch: Fix btrfs detection on SSD.
- timedated-donot-close-bogus-dbus-connection.patch: Avoid
closing an non-existent dbus connection and getting assertion
failures.
-------------------------------------------------------------------
Mon Dec 10 14:22:21 UTC 2012 - coolo@suse.com

View File

@ -158,6 +158,10 @@ Patch69: switch-root-try-pivot-root.patch
Patch70: remount-ro-before-unmount.patch
# PATCH-FIX-UPSTREAM revert-of-9279749b84cc87c7830280b7895a48bed03c9429.patch crrodriguez@opensuse.org -- do not consider failure to umount / and /usr an error.
Patch73: revert-of-9279749b84cc87c7830280b7895a48bed03c9429.patch
# PATCH-FIX-UPSTREAM detect-btrfs-ssd.patch crrodriguez@opensuse.org -- fix BTRFS detection on systemd-readhead
Patch74: detect-btrfs-ssd.patch
# PATCH-FIX-UPSTREAM timedated-donot-close-bogus-dbus-connection.patch crrodriguez@opensuse.org -- Fix assertion failure when dbus is gone.
Patch75: timedated-donot-close-bogus-dbus-connection.patch
# udev patches
# PATCH-FIX-OPENSUSE 0001-Reinstate-TIMEOUT-handling.patch
@ -376,6 +380,8 @@ cp %{SOURCE7} m4/
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%build
autoreconf -fiv

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Tue Dec 11 00:22:50 UTC 2012 - crrodriguez@opensuse.org
- detect-btrfs-ssd.patch: Fix btrfs detection on SSD.
- timedated-donot-close-bogus-dbus-connection.patch: Avoid
closing an non-existent dbus connection and getting assertion
failures.
-------------------------------------------------------------------
Mon Dec 10 14:22:21 UTC 2012 - coolo@suse.com

View File

@ -153,6 +153,10 @@ Patch69: switch-root-try-pivot-root.patch
Patch70: remount-ro-before-unmount.patch
# PATCH-FIX-UPSTREAM revert-of-9279749b84cc87c7830280b7895a48bed03c9429.patch crrodriguez@opensuse.org -- do not consider failure to umount / and /usr an error.
Patch73: revert-of-9279749b84cc87c7830280b7895a48bed03c9429.patch
# PATCH-FIX-UPSTREAM detect-btrfs-ssd.patch crrodriguez@opensuse.org -- fix BTRFS detection on systemd-readhead
Patch74: detect-btrfs-ssd.patch
# PATCH-FIX-UPSTREAM timedated-donot-close-bogus-dbus-connection.patch crrodriguez@opensuse.org -- Fix assertion failure when dbus is gone.
Patch75: timedated-donot-close-bogus-dbus-connection.patch
# udev patches
# PATCH-FIX-OPENSUSE 0001-Reinstate-TIMEOUT-handling.patch
@ -371,6 +375,8 @@ cp %{SOURCE7} m4/
%patch71 -p1
%patch72 -p1
%patch73 -p1
%patch74 -p1
%patch75 -p1
%build
autoreconf -fiv

View File

@ -0,0 +1,36 @@
commit b779821b8fdcb3f2bdd0c362bceaae3c76ed9678
Author: Shawn Landden <shawnlandden@gmail.com>
Date: Mon Dec 3 00:50:55 2012 +0000
timedated: do not incorrectly close non-opened dbus connection
Fix the fallowing error when no system dbus available:
Failed to get system D-Bus connection: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory
process 14920: arguments to dbus_connection_close() were incorrect, assertion "connection != NULL" failed in file ../../dbus/dbus-connection.c line 2889.
This is normally a bug in some application using the D-Bus library.
process 14920: arguments to dbus_connection_unref() were incorrect, assertion "connection != NULL" failed in file ../../dbus/dbus-connection.c line 2776.
This is normally a bug in some application using the D-Bus library.
diff --git a/src/timedate/timedated.c b/src/timedate/timedated.c
index 40ba255..784dadc 100644
--- a/src/timedate/timedated.c
+++ b/src/timedate/timedated.c
@@ -936,7 +936,7 @@ static int connect_bus(DBusConnection **_bus) {
if (!bus) {
log_error("Failed to get system D-Bus connection: %s", bus_error_message(&error));
r = -ECONNREFUSED;
- goto fail;
+ goto fail2;
}
dbus_connection_set_exit_on_disconnect(bus, FALSE);
@@ -968,7 +968,7 @@ static int connect_bus(DBusConnection **_bus) {
fail:
dbus_connection_close(bus);
dbus_connection_unref(bus);
-
+fail2:
dbus_error_free(&error);
return r;