From d4f5094b302eb190d85b7ff011de45b373b4cf94 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Sat, 26 Jul 2014 11:12:01 -0700 Subject: [PATCH] 3.14-stable patches added patches: dm-cache-metadata-do-not-allow-the-data-block-size-to-change.patch dm-thin-metadata-do-not-allow-the-data-block-size-to-change.patch locking-mutex-disable-optimistic-spinning-on-some-architectures.patch pm-sleep-fix-request_firmware-error-at-resume.patch --- ...-allow-the-data-block-size-to-change.patch | 39 ++++++ ...-allow-the-data-block-size-to-change.patch | 54 ++++++++ ...istic-spinning-on-some-architectures.patch | 116 ++++++++++++++++++ ...fix-request_firmware-error-at-resume.patch | 51 ++++++++ queue-3.14/series | 4 + 5 files changed, 264 insertions(+) create mode 100644 queue-3.14/dm-cache-metadata-do-not-allow-the-data-block-size-to-change.patch create mode 100644 queue-3.14/dm-thin-metadata-do-not-allow-the-data-block-size-to-change.patch create mode 100644 queue-3.14/locking-mutex-disable-optimistic-spinning-on-some-architectures.patch create mode 100644 queue-3.14/pm-sleep-fix-request_firmware-error-at-resume.patch diff --git a/queue-3.14/dm-cache-metadata-do-not-allow-the-data-block-size-to-change.patch b/queue-3.14/dm-cache-metadata-do-not-allow-the-data-block-size-to-change.patch new file mode 100644 index 00000000000..376cf9b77b8 --- /dev/null +++ b/queue-3.14/dm-cache-metadata-do-not-allow-the-data-block-size-to-change.patch @@ -0,0 +1,39 @@ +From 048e5a07f282c57815b3901d4a68a77fa131ce0a Mon Sep 17 00:00:00 2001 +From: Mike Snitzer +Date: Mon, 14 Jul 2014 16:59:39 -0400 +Subject: dm cache metadata: do not allow the data block size to change + +From: Mike Snitzer + +commit 048e5a07f282c57815b3901d4a68a77fa131ce0a upstream. + +The block size for the dm-cache's data device must remained fixed for +the life of the cache. Disallow any attempt to change the cache's data +block size. + +Signed-off-by: Mike Snitzer +Acked-by: Joe Thornber +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-cache-metadata.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/md/dm-cache-metadata.c ++++ b/drivers/md/dm-cache-metadata.c +@@ -425,6 +425,15 @@ static int __open_metadata(struct dm_cac + + disk_super = dm_block_data(sblock); + ++ /* Verify the data block size hasn't changed */ ++ if (le32_to_cpu(disk_super->data_block_size) != cmd->data_block_size) { ++ DMERR("changing the data block size (from %u to %llu) is not supported", ++ le32_to_cpu(disk_super->data_block_size), ++ (unsigned long long)cmd->data_block_size); ++ r = -EINVAL; ++ goto bad; ++ } ++ + r = __check_incompat_features(disk_super, cmd); + if (r < 0) + goto bad; diff --git a/queue-3.14/dm-thin-metadata-do-not-allow-the-data-block-size-to-change.patch b/queue-3.14/dm-thin-metadata-do-not-allow-the-data-block-size-to-change.patch new file mode 100644 index 00000000000..2866dd6d2b7 --- /dev/null +++ b/queue-3.14/dm-thin-metadata-do-not-allow-the-data-block-size-to-change.patch @@ -0,0 +1,54 @@ +From 9aec8629ec829fc9403788cd959e05dd87988bd1 Mon Sep 17 00:00:00 2001 +From: Mike Snitzer +Date: Mon, 14 Jul 2014 16:35:54 -0400 +Subject: dm thin metadata: do not allow the data block size to change + +From: Mike Snitzer + +commit 9aec8629ec829fc9403788cd959e05dd87988bd1 upstream. + +The block size for the thin-pool's data device must remained fixed for +the life of the thin-pool. Disallow any attempt to change the +thin-pool's data block size. + +It should be noted that attempting to change the data block size via +thin-pool table reload will be ignored as a side-effect of the thin-pool +handover that the thin-pool target does during thin-pool table reload. + +Here is an example outcome of attempting to load a thin-pool table that +reduced the thin-pool's data block size from 1024K to 512K. + +Before: +kernel: device-mapper: thin: 253:4: growing the data device from 204800 to 409600 blocks + +After: +kernel: device-mapper: thin metadata: changing the data block size (from 2048 to 1024) is not supported +kernel: device-mapper: table: 253:4: thin-pool: Error creating metadata object +kernel: device-mapper: ioctl: error adding target to table + +Signed-off-by: Mike Snitzer +Acked-by: Joe Thornber +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-thin-metadata.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +--- a/drivers/md/dm-thin-metadata.c ++++ b/drivers/md/dm-thin-metadata.c +@@ -613,6 +613,15 @@ static int __open_metadata(struct dm_poo + + disk_super = dm_block_data(sblock); + ++ /* Verify the data block size hasn't changed */ ++ if (le32_to_cpu(disk_super->data_block_size) != pmd->data_block_size) { ++ DMERR("changing the data block size (from %u to %llu) is not supported", ++ le32_to_cpu(disk_super->data_block_size), ++ (unsigned long long)pmd->data_block_size); ++ r = -EINVAL; ++ goto bad_unlock_sblock; ++ } ++ + r = __check_incompat_features(disk_super, pmd); + if (r < 0) + goto bad_unlock_sblock; diff --git a/queue-3.14/locking-mutex-disable-optimistic-spinning-on-some-architectures.patch b/queue-3.14/locking-mutex-disable-optimistic-spinning-on-some-architectures.patch new file mode 100644 index 00000000000..5fca692e4d8 --- /dev/null +++ b/queue-3.14/locking-mutex-disable-optimistic-spinning-on-some-architectures.patch @@ -0,0 +1,116 @@ +From 4badad352a6bb202ec68afa7a574c0bb961e5ebc Mon Sep 17 00:00:00 2001 +From: Peter Zijlstra +Date: Fri, 6 Jun 2014 19:53:16 +0200 +Subject: locking/mutex: Disable optimistic spinning on some architectures + +From: Peter Zijlstra + +commit 4badad352a6bb202ec68afa7a574c0bb961e5ebc upstream. + +The optimistic spin code assumes regular stores and cmpxchg() play nice; +this is found to not be true for at least: parisc, sparc32, tile32, +metag-lock1, arc-!llsc and hexagon. + +There is further wreckage, but this in particular seemed easy to +trigger, so blacklist this. + +Opt in for known good archs. + +Signed-off-by: Peter Zijlstra +Reported-by: Mikulas Patocka +Cc: David Miller +Cc: Chris Metcalf +Cc: James Bottomley +Cc: Vineet Gupta +Cc: Jason Low +Cc: Waiman Long +Cc: "James E.J. Bottomley" +Cc: Paul McKenney +Cc: John David Anglin +Cc: James Hogan +Cc: Linus Torvalds +Cc: Davidlohr Bueso +Cc: Benjamin Herrenschmidt +Cc: Catalin Marinas +Cc: Russell King +Cc: Will Deacon +Cc: linux-arm-kernel@lists.infradead.org +Cc: linux-kernel@vger.kernel.org +Cc: linuxppc-dev@lists.ozlabs.org +Cc: sparclinux@vger.kernel.org +Link: http://lkml.kernel.org/r/20140606175316.GV13930@laptop.programming.kicks-ass.net +Signed-off-by: Ingo Molnar +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/Kconfig | 1 + + arch/arm64/Kconfig | 1 + + arch/powerpc/Kconfig | 1 + + arch/sparc/Kconfig | 1 + + arch/x86/Kconfig | 1 + + kernel/Kconfig.locks | 5 ++++- + 6 files changed, 9 insertions(+), 1 deletion(-) + +--- a/arch/arm/Kconfig ++++ b/arch/arm/Kconfig +@@ -6,6 +6,7 @@ config ARM + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST + select ARCH_HAVE_CUSTOM_GPIO_H + select ARCH_MIGHT_HAVE_PC_PARPORT ++ select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_USE_BUILTIN_BSWAP + select ARCH_USE_CMPXCHG_LOCKREF + select ARCH_WANT_IPC_PARSE_VERSION +--- a/arch/arm64/Kconfig ++++ b/arch/arm64/Kconfig +@@ -2,6 +2,7 @@ config ARM64 + def_bool y + select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE + select ARCH_USE_CMPXCHG_LOCKREF ++ select ARCH_SUPPORTS_ATOMIC_RMW + select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST + select ARCH_WANT_OPTIONAL_GPIOLIB + select ARCH_WANT_COMPAT_IPC_PARSE_VERSION +--- a/arch/powerpc/Kconfig ++++ b/arch/powerpc/Kconfig +@@ -141,6 +141,7 @@ config PPC + select HAVE_DEBUG_STACKOVERFLOW + select HAVE_IRQ_EXIT_ON_IRQ_STACK + select ARCH_USE_CMPXCHG_LOCKREF if PPC64 ++ select ARCH_SUPPORTS_ATOMIC_RMW + + config GENERIC_CSUM + def_bool CPU_LITTLE_ENDIAN +--- a/arch/sparc/Kconfig ++++ b/arch/sparc/Kconfig +@@ -77,6 +77,7 @@ config SPARC64 + select ARCH_HAVE_NMI_SAFE_CMPXCHG + select HAVE_C_RECORDMCOUNT + select NO_BOOTMEM ++ select ARCH_SUPPORTS_ATOMIC_RMW + + config ARCH_DEFCONFIG + string +--- a/arch/x86/Kconfig ++++ b/arch/x86/Kconfig +@@ -127,6 +127,7 @@ config X86 + select HAVE_DEBUG_STACKOVERFLOW + select HAVE_IRQ_EXIT_ON_IRQ_STACK if X86_64 + select HAVE_CC_STACKPROTECTOR ++ select ARCH_SUPPORTS_ATOMIC_RMW + + config INSTRUCTION_DECODER + def_bool y +--- a/kernel/Kconfig.locks ++++ b/kernel/Kconfig.locks +@@ -220,6 +220,9 @@ config INLINE_WRITE_UNLOCK_IRQRESTORE + + endif + ++config ARCH_SUPPORTS_ATOMIC_RMW ++ bool ++ + config MUTEX_SPIN_ON_OWNER + def_bool y +- depends on SMP && !DEBUG_MUTEXES ++ depends on SMP && !DEBUG_MUTEXES && ARCH_SUPPORTS_ATOMIC_RMW diff --git a/queue-3.14/pm-sleep-fix-request_firmware-error-at-resume.patch b/queue-3.14/pm-sleep-fix-request_firmware-error-at-resume.patch new file mode 100644 index 00000000000..0c97ae8cecd --- /dev/null +++ b/queue-3.14/pm-sleep-fix-request_firmware-error-at-resume.patch @@ -0,0 +1,51 @@ +From 4320f6b1d9db4ca912c5eb6ecb328b2e090e1586 Mon Sep 17 00:00:00 2001 +From: Takashi Iwai +Date: Tue, 15 Jul 2014 08:51:27 +0200 +Subject: PM / sleep: Fix request_firmware() error at resume + +From: Takashi Iwai + +commit 4320f6b1d9db4ca912c5eb6ecb328b2e090e1586 upstream. + +The commit [247bc037: PM / Sleep: Mitigate race between the freezer +and request_firmware()] introduced the finer state control, but it +also leads to a new bug; for example, a bug report regarding the +firmware loading of intel BT device at suspend/resume: + https://bugzilla.novell.com/show_bug.cgi?id=873790 + +The root cause seems to be a small window between the process resume +and the clear of usermodehelper lock. The request_firmware() function +checks the UMH lock and gives up when it's in UMH_DISABLE state. This +is for avoiding the invalid f/w loading during suspend/resume phase. +The problem is, however, that usermodehelper_enable() is called at the +end of thaw_processes(). Thus, a thawed process in between can kick +off the f/w loader code path (in this case, via btusb_setup_intel()) +even before the call of usermodehelper_enable(). Then +usermodehelper_read_trylock() returns an error and request_firmware() +spews WARN_ON() in the end. + +This oneliner patch fixes the issue just by setting to UMH_FREEZING +state again before restarting tasks, so that the call of +request_firmware() will be blocked until the end of this function +instead of returning an error. + +Fixes: 247bc0374254 (PM / Sleep: Mitigate race between the freezer and request_firmware()) +Link: https://bugzilla.novell.com/show_bug.cgi?id=873790 +Signed-off-by: Takashi Iwai +Signed-off-by: Rafael J. Wysocki +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/power/process.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/kernel/power/process.c ++++ b/kernel/power/process.c +@@ -184,6 +184,7 @@ void thaw_processes(void) + + printk("Restarting tasks ... "); + ++ __usermodehelper_set_disable_depth(UMH_FREEZING); + thaw_workqueues(); + + read_lock(&tasklist_lock); diff --git a/queue-3.14/series b/queue-3.14/series index ec9be573938..a2d25d6fa5c 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -75,3 +75,7 @@ drm-radeon-avoid-leaking-edid-data.patch alarmtimer-fix-bug-where-relative-alarm-timers-were-treated-as-absolute.patch x86-tsc-fix-cpufreq-lockup.patch mtd-devices-elm-fix-elm_context_save-and-elm_context_restore-functions.patch +dm-thin-metadata-do-not-allow-the-data-block-size-to-change.patch +dm-cache-metadata-do-not-allow-the-data-block-size-to-change.patch +pm-sleep-fix-request_firmware-error-at-resume.patch +locking-mutex-disable-optimistic-spinning-on-some-architectures.patch -- 2.47.3