From 95e840292fba67da0b5f2df03e355de6cf8489c5 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 16 May 2013 18:15:22 -0400 Subject: [PATCH] 3.4-stable patches added patches: dm-thin-do-not-set-discard_zeroes_data.patch drbd-fix-for-deadlock-when-using-automatic-split-brain-recovery.patch drivers-rtc-rtc-pcf2123.c-fix-error-return-code-in-pcf2123_probe.patch hugetlbfs-fix-mmap-failure-in-unaligned-size-request.patch pch_dma-use-gfp_atomic-because-called-from-interrupt-context.patch r8169-fix-vlan-tag-read-ordering.patch --- ...-thin-do-not-set-discard_zeroes_data.patch | 49 ++++++ ...using-automatic-split-brain-recovery.patch | 41 +++++ ...x-error-return-code-in-pcf2123_probe.patch | 33 ++++ ...ap-failure-in-unaligned-size-request.patch | 159 ++++++++++++++++++ ...ecause-called-from-interrupt-context.patch | 33 ++++ .../r8169-fix-vlan-tag-read-ordering.patch | 78 +++++++++ queue-3.4/series | 6 + 7 files changed, 399 insertions(+) create mode 100644 queue-3.4/dm-thin-do-not-set-discard_zeroes_data.patch create mode 100644 queue-3.4/drbd-fix-for-deadlock-when-using-automatic-split-brain-recovery.patch create mode 100644 queue-3.4/drivers-rtc-rtc-pcf2123.c-fix-error-return-code-in-pcf2123_probe.patch create mode 100644 queue-3.4/hugetlbfs-fix-mmap-failure-in-unaligned-size-request.patch create mode 100644 queue-3.4/pch_dma-use-gfp_atomic-because-called-from-interrupt-context.patch create mode 100644 queue-3.4/r8169-fix-vlan-tag-read-ordering.patch diff --git a/queue-3.4/dm-thin-do-not-set-discard_zeroes_data.patch b/queue-3.4/dm-thin-do-not-set-discard_zeroes_data.patch new file mode 100644 index 00000000000..d452979a1b6 --- /dev/null +++ b/queue-3.4/dm-thin-do-not-set-discard_zeroes_data.patch @@ -0,0 +1,49 @@ +From 307615a26e95406c42c95916a66ba50434567e0f Mon Sep 17 00:00:00 2001 +From: Mike Snitzer +Date: Wed, 26 Sep 2012 23:45:39 +0100 +Subject: dm thin: do not set discard_zeroes_data + +From: Mike Snitzer + +commit 307615a26e95406c42c95916a66ba50434567e0f upstream. + +The dm thin pool target claims to support the zeroing of discarded +data areas. This turns out to be incorrect when processing discards +that do not exactly cover a complete number of blocks, so the target +must always set discard_zeroes_data_unsupported. + +The thin pool target will zero blocks when they are allocated if the +skip_block_zeroing feature is not specified. The block layer +may send a discard that only partly covers a block. If a thin pool +block is partially discarded then there is no guarantee that the +discarded data will get zeroed before it is accessed again. +Due to this, thin devices cannot claim discards will always zero data. + +Signed-off-by: Mike Snitzer +Signed-off-by: Joe Thornber +Signed-off-by: Alasdair G Kergon +Cc: Libo Chen +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/md/dm-thin.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/md/dm-thin.c ++++ b/drivers/md/dm-thin.c +@@ -2027,6 +2027,7 @@ static int pool_ctr(struct dm_target *ti + * thin devices' discard limits consistent). + */ + ti->discards_supported = 1; ++ ti->discard_zeroes_data_unsupported = 1; + } + ti->private = pt; + +@@ -2443,7 +2444,6 @@ static void set_discard_limits(struct po + * bios that overlap 2 blocks. + */ + limits->discard_granularity = pool->sectors_per_block << SECTOR_SHIFT; +- limits->discard_zeroes_data = pool->pf.zero_new_blocks; + } + + static void pool_io_hints(struct dm_target *ti, struct queue_limits *limits) diff --git a/queue-3.4/drbd-fix-for-deadlock-when-using-automatic-split-brain-recovery.patch b/queue-3.4/drbd-fix-for-deadlock-when-using-automatic-split-brain-recovery.patch new file mode 100644 index 00000000000..eaaa62afc6d --- /dev/null +++ b/queue-3.4/drbd-fix-for-deadlock-when-using-automatic-split-brain-recovery.patch @@ -0,0 +1,41 @@ +From 7c689e63a847316c1b2500f86891b0a574ce7e69 Mon Sep 17 00:00:00 2001 +From: Philipp Reisner +Date: Wed, 27 Mar 2013 14:08:47 +0100 +Subject: drbd: fix for deadlock when using automatic split-brain-recovery + +From: Philipp Reisner + +commit 7c689e63a847316c1b2500f86891b0a574ce7e69 upstream. + +With an automatic after split-brain recovery policy of +"after-sb-1pri call-pri-lost-after-sb", +when trying to drbd_set_role() to R_SECONDARY, +we run into a deadlock. + +This was first recognized and supposedly fixed by +2009-06-10 "Fixed a deadlock when using automatic split brain recovery when both nodes are" +replacing drbd_set_role() with drbd_change_state() in that code-path, +but the first hunk of that patch forgets to remove the drbd_set_role(). + +We apparently only ever tested the "two primaries" case. + +Signed-off-by: Philipp Reisner +Signed-off-by: Lars Ellenberg +Signed-off-by: Jens Axboe +Signed-off-by: Jonghwan Choi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/block/drbd/drbd_receiver.c | 1 - + 1 file changed, 1 deletion(-) + +--- a/drivers/block/drbd/drbd_receiver.c ++++ b/drivers/block/drbd/drbd_receiver.c +@@ -2225,7 +2225,6 @@ static int drbd_asb_recover_1p(struct dr + if (hg == -1 && mdev->state.role == R_PRIMARY) { + enum drbd_state_rv rv2; + +- drbd_set_role(mdev, R_SECONDARY, 0); + /* drbd_change_state() does not sleep while in SS_IN_TRANSIENT_STATE, + * we might be here in C_WF_REPORT_PARAMS which is transient. + * we do not need to wait for the after state change work either. */ diff --git a/queue-3.4/drivers-rtc-rtc-pcf2123.c-fix-error-return-code-in-pcf2123_probe.patch b/queue-3.4/drivers-rtc-rtc-pcf2123.c-fix-error-return-code-in-pcf2123_probe.patch new file mode 100644 index 00000000000..7ae92f47a0b --- /dev/null +++ b/queue-3.4/drivers-rtc-rtc-pcf2123.c-fix-error-return-code-in-pcf2123_probe.patch @@ -0,0 +1,33 @@ +From 35623715818dfa720cccf99cd280dcbb4b78da23 Mon Sep 17 00:00:00 2001 +From: Wei Yongjun +Date: Mon, 29 Apr 2013 16:21:07 -0700 +Subject: drivers/rtc/rtc-pcf2123.c: fix error return code in pcf2123_probe() + +From: Wei Yongjun + +commit 35623715818dfa720cccf99cd280dcbb4b78da23 upstream. + +Fix to return -ENODEV in the chip not found error handling +case instead of 0, as done elsewhere in this function. + +Signed-off-by: Wei Yongjun +Cc: Jingoo Han +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Jonghwan Choi +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/rtc/rtc-pcf2123.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/drivers/rtc/rtc-pcf2123.c ++++ b/drivers/rtc/rtc-pcf2123.c +@@ -264,6 +264,7 @@ static int __devinit pcf2123_probe(struc + + if (!(rxbuf[0] & 0x20)) { + dev_err(&spi->dev, "chip not found\n"); ++ ret = -ENODEV; + goto kfree_exit; + } + diff --git a/queue-3.4/hugetlbfs-fix-mmap-failure-in-unaligned-size-request.patch b/queue-3.4/hugetlbfs-fix-mmap-failure-in-unaligned-size-request.patch new file mode 100644 index 00000000000..c33a2214bc7 --- /dev/null +++ b/queue-3.4/hugetlbfs-fix-mmap-failure-in-unaligned-size-request.patch @@ -0,0 +1,159 @@ +From af73e4d9506d3b797509f3c030e7dcd554f7d9c4 Mon Sep 17 00:00:00 2001 +From: Naoya Horiguchi +Date: Tue, 7 May 2013 16:18:13 -0700 +Subject: hugetlbfs: fix mmap failure in unaligned size request + +From: Naoya Horiguchi + +commit af73e4d9506d3b797509f3c030e7dcd554f7d9c4 upstream. + +The current kernel returns -EINVAL unless a given mmap length is +"almost" hugepage aligned. This is because in sys_mmap_pgoff() the +given length is passed to vm_mmap_pgoff() as it is without being aligned +with hugepage boundary. + +This is a regression introduced in commit 40716e29243d ("hugetlbfs: fix +alignment of huge page requests"), where alignment code is pushed into +hugetlb_file_setup() and the variable len in caller side is not changed. + +To fix this, this patch partially reverts that commit, and adds +alignment code in caller side. And it also introduces hstate_sizelog() +in order to get proper hstate to specified hugepage size. + +Addresses https://bugzilla.kernel.org/show_bug.cgi?id=56881 + +[akpm@linux-foundation.org: fix warning when CONFIG_HUGETLB_PAGE=n] +Signed-off-by: Naoya Horiguchi +Signed-off-by: Johannes Weiner +Reported-by: +Cc: Steven Truelove +Cc: Jianguo Wu +Cc: Hugh Dickins +Cc: +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Jianguo Wu +Signed-off-by: Greg Kroah-Hartman + +--- + fs/hugetlbfs/inode.c | 20 ++++++++++---------- + include/linux/hugetlb.h | 9 ++++----- + ipc/shm.c | 4 +++- + mm/mmap.c | 6 +++++- + 4 files changed, 22 insertions(+), 17 deletions(-) + +--- a/fs/hugetlbfs/inode.c ++++ b/fs/hugetlbfs/inode.c +@@ -927,9 +927,13 @@ static int can_do_hugetlb_shm(void) + return capable(CAP_IPC_LOCK) || in_group_p(sysctl_hugetlb_shm_group); + } + +-struct file *hugetlb_file_setup(const char *name, unsigned long addr, +- size_t size, vm_flags_t acctflag, +- struct user_struct **user, int creat_flags) ++/* ++ * Note that size should be aligned to proper hugepage size in caller side, ++ * otherwise hugetlb_reserve_pages reserves one less hugepages than intended. ++ */ ++struct file *hugetlb_file_setup(const char *name, size_t size, ++ vm_flags_t acctflag, struct user_struct **user, ++ int creat_flags) + { + int error = -ENOMEM; + struct file *file; +@@ -937,8 +941,6 @@ struct file *hugetlb_file_setup(const ch + struct path path; + struct dentry *root; + struct qstr quick_string; +- struct hstate *hstate; +- unsigned long num_pages; + + *user = NULL; + if (!hugetlbfs_vfsmount) +@@ -972,12 +974,10 @@ struct file *hugetlb_file_setup(const ch + if (!inode) + goto out_dentry; + +- hstate = hstate_inode(inode); +- size += addr & ~huge_page_mask(hstate); +- num_pages = ALIGN(size, huge_page_size(hstate)) >> +- huge_page_shift(hstate); + error = -ENOMEM; +- if (hugetlb_reserve_pages(inode, 0, num_pages, NULL, acctflag)) ++ if (hugetlb_reserve_pages(inode, 0, ++ size >> huge_page_shift(hstate_inode(inode)), NULL, ++ acctflag)) + goto out_inode; + + d_instantiate(path.dentry, inode); +--- a/include/linux/hugetlb.h ++++ b/include/linux/hugetlb.h +@@ -152,8 +152,7 @@ static inline struct hugetlbfs_sb_info * + + extern const struct file_operations hugetlbfs_file_operations; + extern const struct vm_operations_struct hugetlb_vm_ops; +-struct file *hugetlb_file_setup(const char *name, unsigned long addr, +- size_t size, vm_flags_t acct, ++struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acct, + struct user_struct **user, int creat_flags); + + static inline int is_file_hugepages(struct file *file) +@@ -170,8 +169,8 @@ static inline int is_file_hugepages(stru + + #define is_file_hugepages(file) 0 + static inline struct file * +-hugetlb_file_setup(const char *name, unsigned long addr, size_t size, +- vm_flags_t acctflag, struct user_struct **user, int creat_flags) ++hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, ++ struct user_struct **user, int creat_flags) + { + return ERR_PTR(-ENOSYS); + } +@@ -294,7 +293,7 @@ static inline unsigned hstate_index_to_s + return hstates[index].order + PAGE_SHIFT; + } + +-#else ++#else /* CONFIG_HUGETLB_PAGE */ + struct hstate {}; + #define alloc_huge_page_node(h, nid) NULL + #define alloc_bootmem_huge_page(h) NULL +--- a/ipc/shm.c ++++ b/ipc/shm.c +@@ -479,10 +479,12 @@ static int newseg(struct ipc_namespace * + + sprintf (name, "SYSV%08x", key); + if (shmflg & SHM_HUGETLB) { ++ size_t hugesize = ALIGN(size, huge_page_size(&default_hstate)); ++ + /* hugetlb_file_setup applies strict accounting */ + if (shmflg & SHM_NORESERVE) + acctflag = VM_NORESERVE; +- file = hugetlb_file_setup(name, 0, size, acctflag, ++ file = hugetlb_file_setup(name, hugesize, acctflag, + &shp->mlock_user, HUGETLB_SHMFS_INODE); + } else { + /* +--- a/mm/mmap.c ++++ b/mm/mmap.c +@@ -1130,15 +1130,19 @@ SYSCALL_DEFINE6(mmap_pgoff, unsigned lon + file = fget(fd); + if (!file) + goto out; ++ if (is_file_hugepages(file)) ++ len = ALIGN(len, huge_page_size(hstate_file(file))); + } else if (flags & MAP_HUGETLB) { + struct user_struct *user = NULL; ++ ++ len = ALIGN(len, huge_page_size(&default_hstate)); + /* + * VM_NORESERVE is used because the reservations will be + * taken when vm_ops->mmap() is called + * A dummy user value is used because we are not locking + * memory so no accounting is necessary + */ +- file = hugetlb_file_setup(HUGETLB_ANON_FILE, addr, len, ++ file = hugetlb_file_setup(HUGETLB_ANON_FILE, len, + VM_NORESERVE, &user, + HUGETLB_ANONHUGE_INODE); + if (IS_ERR(file)) diff --git a/queue-3.4/pch_dma-use-gfp_atomic-because-called-from-interrupt-context.patch b/queue-3.4/pch_dma-use-gfp_atomic-because-called-from-interrupt-context.patch new file mode 100644 index 00000000000..79171cda8c3 --- /dev/null +++ b/queue-3.4/pch_dma-use-gfp_atomic-because-called-from-interrupt-context.patch @@ -0,0 +1,33 @@ +From 5c1ef59168c485318e40ba485c1eba57d81d0faa Mon Sep 17 00:00:00 2001 +From: Tomoya MORINAGA +Date: Tue, 12 Feb 2013 11:25:33 +0900 +Subject: pch_dma: Use GFP_ATOMIC because called from interrupt context + +From: Tomoya MORINAGA + +commit 5c1ef59168c485318e40ba485c1eba57d81d0faa upstream. + +pdc_desc_get() is called from pd_prep_slave_sg, and the function is +called from interrupt context(e.g. Uart driver "pch_uart.c"). +In fact, I saw kernel error message. +So, GFP_ATOMIC must be used not GFP_NOIO. + +Signed-off-by: Tomoya MORINAGA +Signed-off-by: Vinod Koul +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/dma/pch_dma.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/dma/pch_dma.c ++++ b/drivers/dma/pch_dma.c +@@ -476,7 +476,7 @@ static struct pch_dma_desc *pdc_desc_get + dev_dbg(chan2dev(&pd_chan->chan), "scanned %d descriptors\n", i); + + if (!ret) { +- ret = pdc_alloc_desc(&pd_chan->chan, GFP_NOIO); ++ ret = pdc_alloc_desc(&pd_chan->chan, GFP_ATOMIC); + if (ret) { + spin_lock(&pd_chan->lock); + pd_chan->descs_allocated++; diff --git a/queue-3.4/r8169-fix-vlan-tag-read-ordering.patch b/queue-3.4/r8169-fix-vlan-tag-read-ordering.patch new file mode 100644 index 00000000000..55bd9a405f4 --- /dev/null +++ b/queue-3.4/r8169-fix-vlan-tag-read-ordering.patch @@ -0,0 +1,78 @@ +From romieu@fr.zoreil.com Thu May 16 18:09:17 2013 +From: Francois Romieu +Date: Fri, 10 May 2013 00:53:11 +0200 +Subject: r8169: fix vlan tag read ordering. +To: Greg Kroah-Hartman +Cc: stable@vger.kernel.org, Hayes Wang , "David S. Miller" , Timo Teras +Message-ID: <20130509225311.GC28258@electric-eye.fr.zoreil.com> +Content-Disposition: inline + +From: Francois Romieu + +commit ce11ff5e5963e441feb591e76278528f876c332d upstream. + +Control of receive descriptor must not be returned to ethernet chipset +before vlan tag processing is done. + +VLAN tag receive word is now reset both in normal and error path. + +Signed-off-by: Francois Romieu +Spotted-by: Timo Teras +Cc: Hayes Wang +Signed-off-by: David S. Miller +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/net/ethernet/realtek/r8169.c | 14 ++++++-------- + 1 file changed, 6 insertions(+), 8 deletions(-) + +--- a/drivers/net/ethernet/realtek/r8169.c ++++ b/drivers/net/ethernet/realtek/r8169.c +@@ -1690,8 +1690,6 @@ static void rtl8169_rx_vlan_tag(struct R + + if (opts2 & RxVlanTag) + __vlan_hwaccel_put_tag(skb, swab16(opts2 & 0xffff)); +- +- desc->opts2 = 0; + } + + static int rtl8169_gset_tbi(struct net_device *dev, struct ethtool_cmd *cmd) +@@ -5434,8 +5432,6 @@ static int rtl_rx(struct net_device *dev + !(status & (RxRWT | RxFOVF)) && + (dev->features & NETIF_F_RXALL)) + goto process_pkt; +- +- rtl8169_mark_to_asic(desc, rx_buf_sz); + } else { + struct sk_buff *skb; + dma_addr_t addr; +@@ -5456,16 +5452,14 @@ process_pkt: + if (unlikely(rtl8169_fragmented_frame(status))) { + dev->stats.rx_dropped++; + dev->stats.rx_length_errors++; +- rtl8169_mark_to_asic(desc, rx_buf_sz); +- continue; ++ goto release_descriptor; + } + + skb = rtl8169_try_rx_copy(tp->Rx_databuff[entry], + tp, pkt_size, addr); +- rtl8169_mark_to_asic(desc, rx_buf_sz); + if (!skb) { + dev->stats.rx_dropped++; +- continue; ++ goto release_descriptor; + } + + rtl8169_rx_csum(skb, status); +@@ -5481,6 +5475,10 @@ process_pkt: + tp->rx_stats.bytes += pkt_size; + u64_stats_update_end(&tp->rx_stats.syncp); + } ++release_descriptor: ++ desc->opts2 = 0; ++ wmb(); ++ rtl8169_mark_to_asic(desc, rx_buf_sz); + } + + count = cur_rx - tp->cur_rx; diff --git a/queue-3.4/series b/queue-3.4/series index 42cdeac1e7b..cf47cabefff 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -38,3 +38,9 @@ if_cablemodem.h-add-parenthesis-around-ioctl-macros.patch macvlan-fix-passthru-mode-race-between-dev-removal-and-rx-path.patch ipv6-do-not-clear-pinet6-field.patch xfrm6-release-dev-before-returning-error.patch +dm-thin-do-not-set-discard_zeroes_data.patch +pch_dma-use-gfp_atomic-because-called-from-interrupt-context.patch +hugetlbfs-fix-mmap-failure-in-unaligned-size-request.patch +r8169-fix-vlan-tag-read-ordering.patch +drbd-fix-for-deadlock-when-using-automatic-split-brain-recovery.patch +drivers-rtc-rtc-pcf2123.c-fix-error-return-code-in-pcf2123_probe.patch -- 2.47.3