--- /dev/null
+From ff638b7df5a9264024a6448bdfde2b2bf5d1994a Mon Sep 17 00:00:00 2001
+From: Li Wang <liwang@ubuntukylin.com>
+Date: Sat, 9 Nov 2013 10:26:06 +0800
+Subject: ceph: allocate non-zero page to fscache in readpage()
+
+From: Li Wang <liwang@ubuntukylin.com>
+
+commit ff638b7df5a9264024a6448bdfde2b2bf5d1994a upstream.
+
+ceph_osdc_readpages() returns number of bytes read, currently,
+the code only allocate full-zero page into fscache, this patch
+fixes this.
+
+Signed-off-by: Li Wang <liwang@ubuntukylin.com>
+Reviewed-by: Milosz Tanski <milosz@adfin.com>
+Reviewed-by: Sage Weil <sage@inktank.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ceph/addr.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/ceph/addr.c
++++ b/fs/ceph/addr.c
+@@ -216,7 +216,7 @@ static int readpage_nounlock(struct file
+ }
+ SetPageUptodate(page);
+
+- if (err == 0)
++ if (err >= 0)
+ ceph_readpage_to_fscache(inode, page);
+
+ out:
--- /dev/null
+From eb1b8af33c2e42a9a57fc0a7588f4a7b255d2e79 Mon Sep 17 00:00:00 2001
+From: "Yan, Zheng" <zheng.z.yan@intel.com>
+Date: Thu, 26 Sep 2013 14:25:36 +0800
+Subject: ceph: cleanup aborted requests when re-sending requests.
+
+From: "Yan, Zheng" <zheng.z.yan@intel.com>
+
+commit eb1b8af33c2e42a9a57fc0a7588f4a7b255d2e79 upstream.
+
+Aborted requests usually get cleared when the reply is received.
+If MDS crashes, no reply will be received. So we need to cleanup
+aborted requests when re-sending requests.
+
+Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
+Reviewed-by: Greg Farnum <greg@inktank.com>
+Signed-off-by: Sage Weil <sage@inktank.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ceph/mds_client.c | 5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/fs/ceph/mds_client.c
++++ b/fs/ceph/mds_client.c
+@@ -1875,8 +1875,11 @@ static int __do_request(struct ceph_mds_
+ int mds = -1;
+ int err = -EAGAIN;
+
+- if (req->r_err || req->r_got_result)
++ if (req->r_err || req->r_got_result) {
++ if (req->r_aborted)
++ __unregister_request(mdsc, req);
+ goto out;
++ }
+
+ if (req->r_timeout &&
+ time_after_eq(jiffies, req->r_started + req->r_timeout)) {
--- /dev/null
+From ffc79664d15841025d90afdd902c4112ffe168d6 Mon Sep 17 00:00:00 2001
+From: Milosz Tanski <milosz@adfin.com>
+Date: Wed, 25 Sep 2013 11:18:14 -0400
+Subject: ceph: hung on ceph fscache invalidate in some cases
+
+From: Milosz Tanski <milosz@adfin.com>
+
+commit ffc79664d15841025d90afdd902c4112ffe168d6 upstream.
+
+In some cases I'm on my ceph client cluster I'm seeing hunk kernel tasks in
+the invalidate page code path. This is due to the fact that we don't check if
+the page is marked as cache before calling fscache_wait_on_page_write().
+
+This is the log from the hang
+
+INFO: task XXXXXX:12034 blocked for more than 120 seconds.
+"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
+ ...
+Call Trace:
+[<ffffffff81568d09>] schedule+0x29/0x70
+[<ffffffffa01d4cbd>] __fscache_wait_on_page_write+0x6d/0xb0 [fscache]
+[<ffffffff81083520>] ? add_wait_queue+0x60/0x60
+[<ffffffffa029a3e9>] ceph_invalidate_fscache_page+0x29/0x50 [ceph]
+[<ffffffffa027df00>] ceph_invalidatepage+0x70/0x190 [ceph]
+[<ffffffff8112656f>] ? delete_from_page_cache+0x5f/0x70
+[<ffffffff81133cab>] truncate_inode_page+0x8b/0x90
+[<ffffffff81133ded>] truncate_inode_pages_range.part.12+0x13d/0x620
+[<ffffffff8113431d>] truncate_inode_pages_range+0x4d/0x60
+[<ffffffff811343b5>] truncate_inode_pages+0x15/0x20
+[<ffffffff8119bbf6>] evict+0x1a6/0x1b0
+[<ffffffff8119c3f3>] iput+0x103/0x190
+ ...
+
+Signed-off-by: Milosz Tanski <milosz@adfin.com>
+Reviewed-by: Sage Weil <sage@inktank.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ceph/cache.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/fs/ceph/cache.c
++++ b/fs/ceph/cache.c
+@@ -324,6 +324,9 @@ void ceph_invalidate_fscache_page(struct
+ {
+ struct ceph_inode_info *ci = ceph_inode(inode);
+
++ if (!PageFsCache(page))
++ return;
++
+ fscache_wait_on_page_write(ci->fscache, page);
+ fscache_uncache_page(ci->fscache, page);
+ }
--- /dev/null
+From fc55d2c9448b34218ca58733a6f51fbede09575b Mon Sep 17 00:00:00 2001
+From: "Yan, Zheng" <zheng.z.yan@intel.com>
+Date: Thu, 31 Oct 2013 09:10:47 +0800
+Subject: ceph: wake up 'safe' waiters when unregistering request
+
+From: "Yan, Zheng" <zheng.z.yan@intel.com>
+
+commit fc55d2c9448b34218ca58733a6f51fbede09575b upstream.
+
+We also need to wake up 'safe' waiters if error occurs or request
+aborted. Otherwise sync(2)/fsync(2) may hang forever.
+
+Signed-off-by: Yan, Zheng <zheng.z.yan@intel.com>
+Signed-off-by: Sage Weil <sage@inktank.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ceph/mds_client.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/fs/ceph/mds_client.c
++++ b/fs/ceph/mds_client.c
+@@ -642,6 +642,8 @@ static void __unregister_request(struct
+ req->r_unsafe_dir = NULL;
+ }
+
++ complete_all(&req->r_safe_completion);
++
+ ceph_mdsc_put_request(req);
+ }
+
+@@ -2189,7 +2191,6 @@ static void handle_reply(struct ceph_mds
+ if (head->safe) {
+ req->r_got_safe = true;
+ __unregister_request(mdsc, req);
+- complete_all(&req->r_safe_completion);
+
+ if (req->r_got_unsafe) {
+ /*
--- /dev/null
+From 1075a6e2dc7e2a96efc417b98dd98f57fdae985d Mon Sep 17 00:00:00 2001
+From: Peter Hurley <peter@hurleysoftware.com>
+Date: Mon, 9 Dec 2013 18:06:07 -0500
+Subject: n_tty: Fix apparent order of echoed output
+
+From: Peter Hurley <peter@hurleysoftware.com>
+
+commit 1075a6e2dc7e2a96efc417b98dd98f57fdae985d upstream.
+
+With block processing of echoed output, observed output order is still
+required. Push completed echoes and echo commands prior to output.
+
+Introduce echo_mark echo buffer index, which tracks completed echo
+commands; ie., those submitted via commit_echoes but which may not
+have been committed. Ensure that completed echoes are output prior
+to subsequent terminal writes in process_echoes().
+
+Fixes newline/prompt output order in cooked mode shell.
+
+Reported-by: Karl Dahlke <eklhad@comcast.net>
+Reported-by: Mikulas Patocka <mpatocka@redhat.com>
+Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
+Tested-by: Karl Dahlke <eklhad@comcast.net>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/n_tty.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/drivers/tty/n_tty.c
++++ b/drivers/tty/n_tty.c
+@@ -93,6 +93,7 @@ struct n_tty_data {
+ size_t canon_head;
+ size_t echo_head;
+ size_t echo_commit;
++ size_t echo_mark;
+ DECLARE_BITMAP(char_map, 256);
+
+ /* private to n_tty_receive_overrun (single-threaded) */
+@@ -336,6 +337,7 @@ static void reset_buffer_flags(struct n_
+ {
+ ldata->read_head = ldata->canon_head = ldata->read_tail = 0;
+ ldata->echo_head = ldata->echo_tail = ldata->echo_commit = 0;
++ ldata->echo_mark = 0;
+ ldata->line_start = 0;
+
+ ldata->erasing = 0;
+@@ -787,6 +789,7 @@ static void commit_echoes(struct tty_str
+ size_t head;
+
+ head = ldata->echo_head;
++ ldata->echo_mark = head;
+ old = ldata->echo_commit - ldata->echo_tail;
+
+ /* Process committed echoes if the accumulated # of bytes
+@@ -811,10 +814,11 @@ static void process_echoes(struct tty_st
+ size_t echoed;
+
+ if ((!L_ECHO(tty) && !L_ECHONL(tty)) ||
+- ldata->echo_commit == ldata->echo_tail)
++ ldata->echo_mark == ldata->echo_tail)
+ return;
+
+ mutex_lock(&ldata->output_lock);
++ ldata->echo_commit = ldata->echo_mark;
+ echoed = __process_echoes(tty);
+ mutex_unlock(&ldata->output_lock);
+
+@@ -822,6 +826,7 @@ static void process_echoes(struct tty_st
+ tty->ops->flush_chars(tty);
+ }
+
++/* NB: echo_mark and echo_head should be equivalent here */
+ static void flush_echoes(struct tty_struct *tty)
+ {
+ struct n_tty_data *ldata = tty->disc_data;
--- /dev/null
+From 91648ec09c1ef69c4d840ab6dab391bfb452d554 Mon Sep 17 00:00:00 2001
+From: pingfan liu <qemulist@gmail.com>
+Date: Fri, 15 Nov 2013 16:35:00 +0800
+Subject: powerpc: kvm: fix rare but potential deadlock scene
+
+From: pingfan liu <qemulist@gmail.com>
+
+commit 91648ec09c1ef69c4d840ab6dab391bfb452d554 upstream.
+
+Since kvmppc_hv_find_lock_hpte() is called from both virtmode and
+realmode, so it can trigger the deadlock.
+
+Suppose the following scene:
+
+Two physical cpuM, cpuN, two VM instances A, B, each VM has a group of
+vcpus.
+
+If on cpuM, vcpu_A_1 holds bitlock X (HPTE_V_HVLOCK), then is switched
+out, and on cpuN, vcpu_A_2 try to lock X in realmode, then cpuN will be
+caught in realmode for a long time.
+
+What makes things even worse if the following happens,
+ On cpuM, bitlockX is hold, on cpuN, Y is hold.
+ vcpu_B_2 try to lock Y on cpuM in realmode
+ vcpu_A_2 try to lock X on cpuN in realmode
+
+Oops! deadlock happens
+
+Signed-off-by: Liu Ping Fan <pingfank@linux.vnet.ibm.com>
+Reviewed-by: Paul Mackerras <paulus@samba.org>
+Signed-off-by: Alexander Graf <agraf@suse.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/powerpc/kvm/book3s_64_mmu_hv.c | 6 +++++-
+ arch/powerpc/kvm/book3s_hv_rm_mmu.c | 4 ++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+--- a/arch/powerpc/kvm/book3s_64_mmu_hv.c
++++ b/arch/powerpc/kvm/book3s_64_mmu_hv.c
+@@ -473,11 +473,14 @@ static int kvmppc_mmu_book3s_64_hv_xlate
+ slb_v = vcpu->kvm->arch.vrma_slb_v;
+ }
+
++ preempt_disable();
+ /* Find the HPTE in the hash table */
+ index = kvmppc_hv_find_lock_hpte(kvm, eaddr, slb_v,
+ HPTE_V_VALID | HPTE_V_ABSENT);
+- if (index < 0)
++ if (index < 0) {
++ preempt_enable();
+ return -ENOENT;
++ }
+ hptep = (unsigned long *)(kvm->arch.hpt_virt + (index << 4));
+ v = hptep[0] & ~HPTE_V_HVLOCK;
+ gr = kvm->arch.revmap[index].guest_rpte;
+@@ -485,6 +488,7 @@ static int kvmppc_mmu_book3s_64_hv_xlate
+ /* Unlock the HPTE */
+ asm volatile("lwsync" : : : "memory");
+ hptep[0] = v;
++ preempt_enable();
+
+ gpte->eaddr = eaddr;
+ gpte->vpage = ((v & HPTE_V_AVPN) << 4) | ((eaddr >> 12) & 0xfff);
+--- a/arch/powerpc/kvm/book3s_hv_rm_mmu.c
++++ b/arch/powerpc/kvm/book3s_hv_rm_mmu.c
+@@ -749,6 +749,10 @@ static int slb_base_page_shift[4] = {
+ 20, /* 1M, unsupported */
+ };
+
++/* When called from virtmode, this func should be protected by
++ * preempt_disable(), otherwise, the holding of HPTE_V_HVLOCK
++ * can trigger deadlock issue.
++ */
+ long kvmppc_hv_find_lock_hpte(struct kvm *kvm, gva_t eaddr, unsigned long slb_v,
+ unsigned long valid)
+ {
usb-serial-fix-race-in-generic-write.patch
+ceph-hung-on-ceph-fscache-invalidate-in-some-cases.patch
+ceph-cleanup-aborted-requests-when-re-sending-requests.patch
+ceph-wake-up-safe-waiters-when-unregistering-request.patch
+ceph-allocate-non-zero-page-to-fscache-in-readpage.patch
+powerpc-kvm-fix-rare-but-potential-deadlock-scene.patch
+tty-fix-hang-at-ldsem_down_read.patch
+n_tty-fix-apparent-order-of-echoed-output.patch
+tty-pmac_zilog-check-existence-of-ports-in-pmz_console_init.patch
--- /dev/null
+From cf872776fc84128bb779ce2b83a37c884c3203ae Mon Sep 17 00:00:00 2001
+From: Peter Hurley <peter@hurleysoftware.com>
+Date: Wed, 11 Dec 2013 21:11:58 -0500
+Subject: tty: Fix hang at ldsem_down_read()
+
+From: Peter Hurley <peter@hurleysoftware.com>
+
+commit cf872776fc84128bb779ce2b83a37c884c3203ae upstream.
+
+When a controlling tty is being hung up and the hang up is
+waiting for a just-signalled tty reader or writer to exit, and a new tty
+reader/writer tries to acquire an ldisc reference concurrently with the
+ldisc reference release from the signalled reader/writer, the hangup
+can hang. The new reader/writer is sleeping in ldsem_down_read() and the
+hangup is sleeping in ldsem_down_write() [1].
+
+The new reader/writer fails to wakeup the waiting hangup because the
+wrong lock count value is checked (the old lock count rather than the new
+lock count) to see if the lock is unowned.
+
+Change helper function to return the new lock count if the cmpxchg was
+successful; document this behavior.
+
+[1] edited dmesg log from reporter
+
+SysRq : Show Blocked State
+ task PC stack pid father
+systemd D ffff88040c4f0000 0 1 0 0x00000000
+ ffff88040c49fbe0 0000000000000046 ffff88040c4a0000 ffff88040c49ffd8
+ 00000000001d3980 00000000001d3980 ffff88040c4a0000 ffff88040593d840
+ ffff88040c49fb40 ffffffff810a4cc0 0000000000000006 0000000000000023
+Call Trace:
+ [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4
+ [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4
+ [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4
+ [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4
+ [<ffffffff817a6649>] schedule+0x24/0x5e
+ [<ffffffff817a588b>] schedule_timeout+0x15b/0x1ec
+ [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4
+ [<ffffffff817aa691>] ? _raw_spin_unlock_irq+0x24/0x26
+ [<ffffffff817aa10c>] down_read_failed+0xe3/0x1b9
+ [<ffffffff817aa26d>] ldsem_down_read+0x8b/0xa5
+ [<ffffffff8142b5ca>] ? tty_ldisc_ref_wait+0x1b/0x44
+ [<ffffffff8142b5ca>] tty_ldisc_ref_wait+0x1b/0x44
+ [<ffffffff81423f5b>] tty_write+0x7d/0x28a
+ [<ffffffff814241f5>] redirected_tty_write+0x8d/0x98
+ [<ffffffff81424168>] ? tty_write+0x28a/0x28a
+ [<ffffffff8115d03f>] do_loop_readv_writev+0x56/0x79
+ [<ffffffff8115e604>] do_readv_writev+0x1b0/0x1ff
+ [<ffffffff8116ea0b>] ? do_vfs_ioctl+0x32a/0x489
+ [<ffffffff81167d9d>] ? final_putname+0x1d/0x3a
+ [<ffffffff8115e6c7>] vfs_writev+0x2e/0x49
+ [<ffffffff8115e7d3>] SyS_writev+0x47/0xaa
+ [<ffffffff817ab822>] system_call_fastpath+0x16/0x1b
+bash D ffffffff81c104c0 0 5469 5302 0x00000082
+ ffff8800cf817ac0 0000000000000046 ffff8804086b22a0 ffff8800cf817fd8
+ 00000000001d3980 00000000001d3980 ffff8804086b22a0 ffff8800cf817a48
+ 000000000000b9a0 ffff8800cf817a78 ffffffff81004675 ffff8800cf817a44
+Call Trace:
+ [<ffffffff81004675>] ? dump_trace+0x165/0x29c
+ [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4
+ [<ffffffff8100edda>] ? save_stack_trace+0x26/0x41
+ [<ffffffff817a6649>] schedule+0x24/0x5e
+ [<ffffffff817a588b>] schedule_timeout+0x15b/0x1ec
+ [<ffffffff810a4cc0>] ? sched_clock_cpu+0x9f/0xe4
+ [<ffffffff817a9f03>] ? down_write_failed+0xa3/0x1c9
+ [<ffffffff817aa691>] ? _raw_spin_unlock_irq+0x24/0x26
+ [<ffffffff817a9f0b>] down_write_failed+0xab/0x1c9
+ [<ffffffff817aa300>] ldsem_down_write+0x79/0xb1
+ [<ffffffff817aada3>] ? tty_ldisc_lock_pair_timeout+0xa5/0xd9
+ [<ffffffff817aada3>] tty_ldisc_lock_pair_timeout+0xa5/0xd9
+ [<ffffffff8142bf33>] tty_ldisc_hangup+0xc4/0x218
+ [<ffffffff81423ab3>] __tty_hangup+0x2e2/0x3ed
+ [<ffffffff81424a76>] disassociate_ctty+0x63/0x226
+ [<ffffffff81078aa7>] do_exit+0x79f/0xa11
+ [<ffffffff81086bdb>] ? get_signal_to_deliver+0x206/0x62f
+ [<ffffffff810b4bfb>] ? lock_release_holdtime.part.8+0xf/0x16e
+ [<ffffffff81079b05>] do_group_exit+0x47/0xb5
+ [<ffffffff81086c16>] get_signal_to_deliver+0x241/0x62f
+ [<ffffffff810020a7>] do_signal+0x43/0x59d
+ [<ffffffff810f2af7>] ? __audit_syscall_exit+0x21a/0x2a8
+ [<ffffffff810b4bfb>] ? lock_release_holdtime.part.8+0xf/0x16e
+ [<ffffffff81002655>] do_notify_resume+0x54/0x6c
+ [<ffffffff817abaf8>] int_signal+0x12/0x17
+
+Reported-by: Sami Farin <sami.farin@gmail.com>
+Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/tty_ldsem.c | 16 +++++++++++++---
+ 1 file changed, 13 insertions(+), 3 deletions(-)
+
+--- a/drivers/tty/tty_ldsem.c
++++ b/drivers/tty/tty_ldsem.c
+@@ -86,11 +86,21 @@ static inline long ldsem_atomic_update(l
+ return atomic_long_add_return(delta, (atomic_long_t *)&sem->count);
+ }
+
++/*
++ * ldsem_cmpxchg() updates @*old with the last-known sem->count value.
++ * Returns 1 if count was successfully changed; @*old will have @new value.
++ * Returns 0 if count was not changed; @*old will have most recent sem->count
++ */
+ static inline int ldsem_cmpxchg(long *old, long new, struct ld_semaphore *sem)
+ {
+- long tmp = *old;
+- *old = atomic_long_cmpxchg(&sem->count, *old, new);
+- return *old == tmp;
++ long tmp = atomic_long_cmpxchg(&sem->count, *old, new);
++ if (tmp == *old) {
++ *old = new;
++ return 1;
++ } else {
++ *old = tmp;
++ return 0;
++ }
+ }
+
+ /*
--- /dev/null
+From dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a Mon Sep 17 00:00:00 2001
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+Date: Fri, 22 Nov 2013 16:47:26 +0100
+Subject: TTY: pmac_zilog, check existence of ports in pmz_console_init()
+
+From: Geert Uytterhoeven <geert@linux-m68k.org>
+
+commit dc1dc2f8a5dd863bf2e79f338fc3ae29e99c683a upstream.
+
+When booting a multi-platform m68k kernel on a non-Mac with "console=ttyS0"
+on the kernel command line, it crashes with:
+
+Unable to handle kernel NULL pointer dereference at virtual address (null)
+Oops: 00000000
+PC: [<0013ad28>] __pmz_startup+0x32/0x2a0
+...
+Call Trace: [<002c5d3e>] pmz_console_setup+0x64/0xe4
+
+The normal tty driver doesn't crash, because init_pmz() checks
+pmz_ports_count again after calling pmz_probe().
+
+In the serial console initialization path, pmz_console_init() doesn't do
+this, causing the driver to crash later.
+
+Add a check for pmz_ports_count to fix this.
+
+Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
+Cc: Finn Thain <fthain@telegraphics.com.au>
+Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/tty/serial/pmac_zilog.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/tty/serial/pmac_zilog.c
++++ b/drivers/tty/serial/pmac_zilog.c
+@@ -2050,6 +2050,9 @@ static int __init pmz_console_init(void)
+ /* Probe ports */
+ pmz_probe();
+
++ if (pmz_ports_count == 0)
++ return -ENODEV;
++
+ /* TODO: Autoprobe console based on OF */
+ /* pmz_console.index = i; */
+ register_console(&pmz_console);