forked from pool/alsa-utils
Accepting request 855588 from multimedia:libs
OBS-URL: https://build.opensuse.org/request/show/855588 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/alsa-utils?expand=0&rev=128
This commit is contained in:
commit
b3ac3ee7dd
29
0010-alsactl-Fix-double-decrease-of-lock-timeout.patch
Normal file
29
0010-alsactl-Fix-double-decrease-of-lock-timeout.patch
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
From 878e1a7c0f03233530e7675ae015aced069c971d Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Fri, 11 Dec 2020 23:41:59 +0100
|
||||||
|
Subject: [PATCH] alsactl: Fix double decrease of lock timeout
|
||||||
|
|
||||||
|
The state_lock() has a loop to wait for the lock file creation, and
|
||||||
|
the timeout value gets decremented twice mistakenly, which leads to a
|
||||||
|
half timeout (5 seconds) than expected 10 seconds. Fix it.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
alsactl/lock.c | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/alsactl/lock.c b/alsactl/lock.c
|
||||||
|
index 4a485392b3bd..05f6e4d2a102 100644
|
||||||
|
--- a/alsactl/lock.c
|
||||||
|
+++ b/alsactl/lock.c
|
||||||
|
@@ -63,7 +63,6 @@ static int state_lock_(const char *file, int lock, int timeout, int _fd)
|
||||||
|
if (fd < 0) {
|
||||||
|
if (errno == EBUSY || errno == EAGAIN) {
|
||||||
|
sleep(1);
|
||||||
|
- timeout--;
|
||||||
|
} else {
|
||||||
|
err = -errno;
|
||||||
|
goto out;
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
47
0011-alsactl-Fix-race-at-creating-a-lock-file.patch
Normal file
47
0011-alsactl-Fix-race-at-creating-a-lock-file.patch
Normal file
@ -0,0 +1,47 @@
|
|||||||
|
From c53f7cd03881092d5a61505d23ab8f920b7faf12 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Fri, 11 Dec 2020 23:46:23 +0100
|
||||||
|
Subject: [PATCH] alsactl: Fix race at creating a lock file
|
||||||
|
|
||||||
|
A race at creating a lock file in state_lock() was discovered
|
||||||
|
recently: namely, between the first open(O_RDWR) and the second
|
||||||
|
open(O_RDWR|O_CREAT|O_EXCL) calls, another alsactl invocation may
|
||||||
|
already create a lock file, then the second open() will return EEXIST,
|
||||||
|
which isn't handled properly and treated as a fatal error.
|
||||||
|
|
||||||
|
In this patch, we check EEXIST case and try again open() with O_RDWR.
|
||||||
|
This must succeed usually, and if it fails, handle finally as the
|
||||||
|
fatal error.
|
||||||
|
|
||||||
|
BugLink: https://bugzilla.opensuse.org/show_bug.cgi?id=1179904
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
alsactl/lock.c | 11 ++++++++---
|
||||||
|
1 file changed, 8 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/alsactl/lock.c b/alsactl/lock.c
|
||||||
|
index 05f6e4d2a102..5b4746231996 100644
|
||||||
|
--- a/alsactl/lock.c
|
||||||
|
+++ b/alsactl/lock.c
|
||||||
|
@@ -63,10 +63,15 @@ static int state_lock_(const char *file, int lock, int timeout, int _fd)
|
||||||
|
if (fd < 0) {
|
||||||
|
if (errno == EBUSY || errno == EAGAIN) {
|
||||||
|
sleep(1);
|
||||||
|
- } else {
|
||||||
|
- err = -errno;
|
||||||
|
- goto out;
|
||||||
|
+ continue;
|
||||||
|
}
|
||||||
|
+ if (errno == EEXIST) {
|
||||||
|
+ fd = open(nfile, O_RDWR);
|
||||||
|
+ if (fd >= 0)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+ err = -errno;
|
||||||
|
+ goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -0,0 +1,33 @@
|
|||||||
|
From 12487b40b6e7230a003eb6e4333ee820d8578592 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Takashi Iwai <tiwai@suse.de>
|
||||||
|
Date: Fri, 11 Dec 2020 23:55:34 +0100
|
||||||
|
Subject: [PATCH ] alsactl: Remove asound.state file check from alsa-restore.service again
|
||||||
|
|
||||||
|
We added the check of asound.state file presence some time ago to
|
||||||
|
assure that alsactl gets called only if the state file is already
|
||||||
|
present. Since then, the situation has changed significantly:
|
||||||
|
e.g. now alsactl does initialize if the state file isn't present, and
|
||||||
|
the same alsa-restore.service is used to save the state. This means
|
||||||
|
that we should start this service no matter the state file exists at
|
||||||
|
the boot time or not. So, revert the old change again.
|
||||||
|
|
||||||
|
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||||
|
---
|
||||||
|
alsactl/alsa-restore.service.in | 1 -
|
||||||
|
1 file changed, 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/alsactl/alsa-restore.service.in b/alsactl/alsa-restore.service.in
|
||||||
|
index a84c2e842444..80fd5fd48203 100644
|
||||||
|
--- a/alsactl/alsa-restore.service.in
|
||||||
|
+++ b/alsactl/alsa-restore.service.in
|
||||||
|
@@ -7,7 +7,6 @@
|
||||||
|
Description=Save/Restore Sound Card State
|
||||||
|
ConditionPathExists=!@daemonswitch@
|
||||||
|
ConditionPathExistsGlob=/dev/snd/control*
|
||||||
|
-ConditionPathExists=@asoundrcfile@
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
--
|
||||||
|
2.26.2
|
||||||
|
|
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Fri Dec 11 23:52:24 CET 2020 - tiwai@suse.de
|
||||||
|
|
||||||
|
- Fix alsactl restore behavior during locking (boo#1179904):
|
||||||
|
0010-alsactl-Fix-double-decrease-of-lock-timeout.patch
|
||||||
|
0011-alsactl-Fix-race-at-creating-a-lock-file.patch
|
||||||
|
- Remove unnecessary condition for alsa-restore.service
|
||||||
|
0012-alsactl-Remove-asound.state-file-check-from-alsa-res.patch
|
||||||
|
- Fix dependency in sound-extra.service
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Oct 21 13:01:26 CEST 2020 - tiwai@suse.de
|
Wed Oct 21 13:01:26 CEST 2020 - tiwai@suse.de
|
||||||
|
|
||||||
|
@ -29,6 +29,9 @@ Source: ftp://ftp.alsa-project.org/pub/utils/alsa-utils-%{version}.tar.b
|
|||||||
Source1: 01beep.conf
|
Source1: 01beep.conf
|
||||||
Source2: sound-extra.service
|
Source2: sound-extra.service
|
||||||
Source5: load-sound-modules.sh
|
Source5: load-sound-modules.sh
|
||||||
|
Patch10: 0010-alsactl-Fix-double-decrease-of-lock-timeout.patch
|
||||||
|
Patch11: 0011-alsactl-Fix-race-at-creating-a-lock-file.patch
|
||||||
|
Patch12: 0012-alsactl-Remove-asound.state-file-check-from-alsa-res.patch
|
||||||
Patch101: alsa-utils-configure-version-revert.patch
|
Patch101: alsa-utils-configure-version-revert.patch
|
||||||
BuildRequires: alsa-devel
|
BuildRequires: alsa-devel
|
||||||
%ifarch %ix86 x86_64 %arm aarch64 ppc64le riscv64
|
%ifarch %ix86 x86_64 %arm aarch64 ppc64le riscv64
|
||||||
@ -71,6 +74,9 @@ and test audio before and after PM state changes.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
|
%patch10 -p1
|
||||||
|
%patch11 -p1
|
||||||
|
%patch12 -p1
|
||||||
%if 0%{?do_autoreconf}
|
%if 0%{?do_autoreconf}
|
||||||
%patch101 -p1
|
%patch101 -p1
|
||||||
# fix stupid automake's automatic action
|
# fix stupid automake's automatic action
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[Unit]
|
[Unit]
|
||||||
Description=Load extra kernel modules for sound stuff
|
Description=Load extra kernel modules for sound stuff
|
||||||
After=alsasound.service
|
After=alsa-restore.service
|
||||||
ConditionPathExists=/proc/asound
|
ConditionPathExists=/proc/asound
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user