From: Greg Kroah-Hartman Date: Mon, 25 Jul 2016 01:01:01 +0000 (-0700) Subject: 3.14-stable patches X-Git-Tag: v4.6.5~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=5a5e54c531ce4b84a2d31e5aec93a0fa115f5296;p=thirdparty%2Fkernel%2Fstable-queue.git 3.14-stable patches added patches: fix-reconnect-to-not-defer-smb3-session-reconnect-long-after-socket-reconnect.patch scsi-fix-race-between-simultaneous-decrements-of-host_failed.patch xen-acpi-allow-xen-acpi-processor-driver-to-load-on-xen-4.7.patch --- diff --git a/queue-3.14/fix-reconnect-to-not-defer-smb3-session-reconnect-long-after-socket-reconnect.patch b/queue-3.14/fix-reconnect-to-not-defer-smb3-session-reconnect-long-after-socket-reconnect.patch new file mode 100644 index 00000000000..9a2c24ca71d --- /dev/null +++ b/queue-3.14/fix-reconnect-to-not-defer-smb3-session-reconnect-long-after-socket-reconnect.patch @@ -0,0 +1,78 @@ +From 4fcd1813e6404dd4420c7d12fb483f9320f0bf93 Mon Sep 17 00:00:00 2001 +From: Steve French +Date: Wed, 22 Jun 2016 20:12:05 -0500 +Subject: Fix reconnect to not defer smb3 session reconnect long after socket reconnect + +From: Steve French + +commit 4fcd1813e6404dd4420c7d12fb483f9320f0bf93 upstream. + +Azure server blocks clients that open a socket and don't do anything on it. +In our reconnect scenarios, we can reconnect the tcp session and +detect the socket is available but we defer the negprot and SMB3 session +setup and tree connect reconnection until the next i/o is requested, but +this looks suspicous to some servers who expect SMB3 negprog and session +setup soon after a socket is created. + +In the echo thread, reconnect SMB3 sessions and tree connections +that are disconnected. A later patch will replay persistent (and +resilient) handle opens. + +Signed-off-by: Steve French +Acked-by: Pavel Shilovsky +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/connect.c | 4 +++- + fs/cifs/smb2pdu.c | 27 +++++++++++++++++++++++++++ + 2 files changed, 30 insertions(+), 1 deletion(-) + +--- a/fs/cifs/connect.c ++++ b/fs/cifs/connect.c +@@ -410,7 +410,9 @@ cifs_echo_request(struct work_struct *wo + * server->ops->need_neg() == true. Also, no need to ping if + * we got a response recently. + */ +- if (!server->ops->need_neg || server->ops->need_neg(server) || ++ ++ if (server->tcpStatus == CifsNeedReconnect || ++ server->tcpStatus == CifsExiting || server->tcpStatus == CifsNew || + (server->ops->can_echo && !server->ops->can_echo(server)) || + time_before(jiffies, server->lstrp + SMB_ECHO_INTERVAL - HZ)) + goto requeue_echo; +--- a/fs/cifs/smb2pdu.c ++++ b/fs/cifs/smb2pdu.c +@@ -1590,6 +1590,33 @@ SMB2_echo(struct TCP_Server_Info *server + + cifs_dbg(FYI, "In echo request\n"); + ++ if (server->tcpStatus == CifsNeedNegotiate) { ++ struct list_head *tmp, *tmp2; ++ struct cifs_ses *ses; ++ struct cifs_tcon *tcon; ++ ++ cifs_dbg(FYI, "Need negotiate, reconnecting tcons\n"); ++ spin_lock(&cifs_tcp_ses_lock); ++ list_for_each(tmp, &server->smb_ses_list) { ++ ses = list_entry(tmp, struct cifs_ses, smb_ses_list); ++ list_for_each(tmp2, &ses->tcon_list) { ++ tcon = list_entry(tmp2, struct cifs_tcon, ++ tcon_list); ++ /* add check for persistent handle reconnect */ ++ if (tcon && tcon->need_reconnect) { ++ spin_unlock(&cifs_tcp_ses_lock); ++ rc = smb2_reconnect(SMB2_ECHO, tcon); ++ spin_lock(&cifs_tcp_ses_lock); ++ } ++ } ++ } ++ spin_unlock(&cifs_tcp_ses_lock); ++ } ++ ++ /* if no session, renegotiate failed above */ ++ if (server->tcpStatus == CifsNeedNegotiate) ++ return -EIO; ++ + rc = small_smb2_init(SMB2_ECHO, NULL, (void **)&req); + if (rc) + return rc; diff --git a/queue-3.14/scsi-fix-race-between-simultaneous-decrements-of-host_failed.patch b/queue-3.14/scsi-fix-race-between-simultaneous-decrements-of-host_failed.patch new file mode 100644 index 00000000000..430b9afe96c --- /dev/null +++ b/queue-3.14/scsi-fix-race-between-simultaneous-decrements-of-host_failed.patch @@ -0,0 +1,94 @@ +From 72d8c36ec364c82bf1bf0c64dfa1041cfaf139f7 Mon Sep 17 00:00:00 2001 +From: Wei Fang +Date: Tue, 7 Jun 2016 14:53:56 +0800 +Subject: scsi: fix race between simultaneous decrements of ->host_failed + +From: Wei Fang + +commit 72d8c36ec364c82bf1bf0c64dfa1041cfaf139f7 upstream. + +sas_ata_strategy_handler() adds the works of the ata error handler to +system_unbound_wq. This workqueue asynchronously runs work items, so the +ata error handler will be performed concurrently on different CPUs. In +this case, ->host_failed will be decreased simultaneously in +scsi_eh_finish_cmd() on different CPUs, and become abnormal. + +It will lead to permanently inequality between ->host_failed and +->host_busy, and scsi error handler thread won't start running. IO +errors after that won't be handled. + +Since all scmds must have been handled in the strategy handler, just +remove the decrement in scsi_eh_finish_cmd() and zero ->host_busy after +the strategy handler to fix this race. + +Fixes: 50824d6c5657 ("[SCSI] libsas: async ata-eh") +Signed-off-by: Wei Fang +Reviewed-by: James Bottomley +Signed-off-by: Martin K. Petersen +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/scsi/scsi_eh.txt | 8 ++++++-- + drivers/ata/libata-eh.c | 2 +- + drivers/scsi/scsi_error.c | 4 +++- + 3 files changed, 10 insertions(+), 4 deletions(-) + +--- a/Documentation/scsi/scsi_eh.txt ++++ b/Documentation/scsi/scsi_eh.txt +@@ -263,19 +263,23 @@ scmd->allowed. + + 3. scmd recovered + ACTION: scsi_eh_finish_cmd() is invoked to EH-finish scmd +- - shost->host_failed-- + - clear scmd->eh_eflags + - scsi_setup_cmd_retry() + - move from local eh_work_q to local eh_done_q + LOCKING: none ++ CONCURRENCY: at most one thread per separate eh_work_q to ++ keep queue manipulation lockless + + 4. EH completes + ACTION: scsi_eh_flush_done_q() retries scmds or notifies upper +- layer of failure. ++ layer of failure. May be called concurrently but must have ++ a no more than one thread per separate eh_work_q to ++ manipulate the queue locklessly + - scmd is removed from eh_done_q and scmd->eh_entry is cleared + - if retry is necessary, scmd is requeued using + scsi_queue_insert() + - otherwise, scsi_finish_command() is invoked for scmd ++ - zero shost->host_failed + LOCKING: queue or finish function performs appropriate locking + + +--- a/drivers/ata/libata-eh.c ++++ b/drivers/ata/libata-eh.c +@@ -604,7 +604,7 @@ void ata_scsi_error(struct Scsi_Host *ho + ata_scsi_port_error_handler(host, ap); + + /* finish or retry handled scmd's and clean up */ +- WARN_ON(host->host_failed || !list_empty(&eh_work_q)); ++ WARN_ON(!list_empty(&eh_work_q)); + + DPRINTK("EXIT\n"); + } +--- a/drivers/scsi/scsi_error.c ++++ b/drivers/scsi/scsi_error.c +@@ -1111,7 +1111,6 @@ static int scsi_eh_action(struct scsi_cm + */ + void scsi_eh_finish_cmd(struct scsi_cmnd *scmd, struct list_head *done_q) + { +- scmd->device->host->host_failed--; + scmd->eh_eflags = 0; + list_move_tail(&scmd->eh_entry, done_q); + } +@@ -2193,6 +2192,9 @@ int scsi_error_handler(void *data) + else + scsi_unjam_host(shost); + ++ /* All scmds have been handled */ ++ shost->host_failed = 0; ++ + /* + * Note - if the above fails completely, the action is to take + * individual devices offline and flush the queue of any diff --git a/queue-3.14/series b/queue-3.14/series index 1ed3b39f24e..dd3dceee8c4 100644 --- a/queue-3.14/series +++ b/queue-3.14/series @@ -45,3 +45,6 @@ tty-vt-keyboard-fix-oob-access-in-do_compute_shiftstate.patch alsa-dummy-fix-a-use-after-free-at-closing.patch alsa-au88x0-fix-calculation-in-vortex_wtdma_bufshift.patch alsa-ctl-stop-notification-after-disconnection.patch +scsi-fix-race-between-simultaneous-decrements-of-host_failed.patch +fix-reconnect-to-not-defer-smb3-session-reconnect-long-after-socket-reconnect.patch +xen-acpi-allow-xen-acpi-processor-driver-to-load-on-xen-4.7.patch diff --git a/queue-3.14/xen-acpi-allow-xen-acpi-processor-driver-to-load-on-xen-4.7.patch b/queue-3.14/xen-acpi-allow-xen-acpi-processor-driver-to-load-on-xen-4.7.patch new file mode 100644 index 00000000000..dec54586c75 --- /dev/null +++ b/queue-3.14/xen-acpi-allow-xen-acpi-processor-driver-to-load-on-xen-4.7.patch @@ -0,0 +1,81 @@ +From 6f2d9d99213514360034c6d52d2c3919290b3504 Mon Sep 17 00:00:00 2001 +From: Jan Beulich +Date: Fri, 8 Jul 2016 06:15:07 -0600 +Subject: xen/acpi: allow xen-acpi-processor driver to load on Xen 4.7 + +From: Jan Beulich + +commit 6f2d9d99213514360034c6d52d2c3919290b3504 upstream. + +As of Xen 4.7 PV CPUID doesn't expose either of CPUID[1].ECX[7] and +CPUID[0x80000007].EDX[7] anymore, causing the driver to fail to load on +both Intel and AMD systems. Doing any kind of hardware capability +checks in the driver as a prerequisite was wrong anyway: With the +hypervisor being in charge, all such checking should be done by it. If +ACPI data gets uploaded despite some missing capability, the hypervisor +is free to ignore part or all of that data. + +Ditch the entire check_prereq() function, and do the only valid check +(xen_initial_domain()) in the caller in its place. + +Signed-off-by: Jan Beulich +Signed-off-by: David Vrabel +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/xen/xen-acpi-processor.c | 35 +++-------------------------------- + 1 file changed, 3 insertions(+), 32 deletions(-) + +--- a/drivers/xen/xen-acpi-processor.c ++++ b/drivers/xen/xen-acpi-processor.c +@@ -423,36 +423,7 @@ upload: + + return 0; + } +-static int __init check_prereq(void) +-{ +- struct cpuinfo_x86 *c = &cpu_data(0); +- +- if (!xen_initial_domain()) +- return -ENODEV; +- +- if (!acpi_gbl_FADT.smi_command) +- return -ENODEV; + +- if (c->x86_vendor == X86_VENDOR_INTEL) { +- if (!cpu_has(c, X86_FEATURE_EST)) +- return -ENODEV; +- +- return 0; +- } +- if (c->x86_vendor == X86_VENDOR_AMD) { +- /* Copied from powernow-k8.h, can't include ../cpufreq/powernow +- * as we get compile warnings for the static functions. +- */ +-#define CPUID_FREQ_VOLT_CAPABILITIES 0x80000007 +-#define USE_HW_PSTATE 0x00000080 +- u32 eax, ebx, ecx, edx; +- cpuid(CPUID_FREQ_VOLT_CAPABILITIES, &eax, &ebx, &ecx, &edx); +- if ((edx & USE_HW_PSTATE) != USE_HW_PSTATE) +- return -ENODEV; +- return 0; +- } +- return -ENODEV; +-} + /* acpi_perf_data is a pointer to percpu data. */ + static struct acpi_processor_performance __percpu *acpi_perf_data; + +@@ -508,10 +479,10 @@ static struct syscore_ops xap_syscore_op + static int __init xen_acpi_processor_init(void) + { + unsigned int i; +- int rc = check_prereq(); ++ int rc; + +- if (rc) +- return rc; ++ if (!xen_initial_domain()) ++ return -ENODEV; + + nr_acpi_bits = get_max_acpi_id() + 1; + acpi_ids_done = kcalloc(BITS_TO_LONGS(nr_acpi_bits), sizeof(unsigned long), GFP_KERNEL);