* [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource
@ 2015-05-15 14:28 Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() Jiri Slaby
` (7 more replies)
0 siblings, 8 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable
Cc: Junxiao Bi, Joseph Qi, Mark Fasheh, Joel Becker, Andrew Morton,
Linus Torvalds, Jiri Slaby
From: Junxiao Bi <junxiao.bi@oracle.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit b1432a2a35565f538586774a03bf277c27fc267d upstream.
There is a race window in dlm_get_lock_resource(), which may return a
lock resource which has been purged. This will cause the process to
hang forever in dlmlock() as the ast msg can't be handled due to its
lock resource not existing.
dlm_get_lock_resource {
...
spin_lock(&dlm->spinlock);
tmpres = __dlm_lookup_lockres_full(dlm, lockid, namelen, hash);
if (tmpres) {
spin_unlock(&dlm->spinlock);
>>>>>>>> race window, dlm_run_purge_list() may run and purge
the lock resource
spin_lock(&tmpres->spinlock);
...
spin_unlock(&tmpres->spinlock);
}
}
Signed-off-by: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Joseph Qi <joseph.qi@huawei.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
fs/ocfs2/dlm/dlmmaster.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/fs/ocfs2/dlm/dlmmaster.c b/fs/ocfs2/dlm/dlmmaster.c
index 673c9bf5debc..4fe55b776a74 100644
--- a/fs/ocfs2/dlm/dlmmaster.c
+++ b/fs/ocfs2/dlm/dlmmaster.c
@@ -726,6 +726,19 @@ lookup:
if (tmpres) {
spin_unlock(&dlm->spinlock);
spin_lock(&tmpres->spinlock);
+
+ /*
+ * Right after dlm spinlock was released, dlm_thread could have
+ * purged the lockres. Check if lockres got unhashed. If so
+ * start over.
+ */
+ if (hlist_unhashed(&tmpres->hash_node)) {
+ spin_unlock(&tmpres->spinlock);
+ dlm_lockres_put(tmpres);
+ tmpres = NULL;
+ goto lookup;
+ }
+
/* Wait on the thread that is mastering the resource */
if (tmpres->owner == DLM_LOCK_RES_OWNER_UNKNOWN) {
__dlm_wait_on_lockres(tmpres);
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] nilfs2: fix sanity check of btree level in nilfs_btree_root_broken()
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] RDMA/CMA: Canonize IPv4 on IPV6 sockets properly Jiri Slaby
` (6 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable; +Cc: Ryusuke Konishi, Andrew Morton, Linus Torvalds, Jiri Slaby
From: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit d8fd150fe3935e1692bf57c66691e17409ebb9c1 upstream.
The range check for b-tree level parameter in nilfs_btree_root_broken()
is wrong; it accepts the case of "level == NILFS_BTREE_LEVEL_MAX" even
though the level is limited to values in the range of 0 to
(NILFS_BTREE_LEVEL_MAX - 1).
Since the level parameter is read from storage device and used to index
nilfs_btree_path array whose element count is NILFS_BTREE_LEVEL_MAX, it
can cause memory overrun during btree operations if the boundary value
is set to the level parameter on device.
This fixes the broken sanity check and adds a comment to clarify that
the upper bound NILFS_BTREE_LEVEL_MAX is exclusive.
Signed-off-by: Ryusuke Konishi <konishi.ryusuke@lab.ntt.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
fs/nilfs2/btree.c | 2 +-
include/linux/nilfs2_fs.h | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/fs/nilfs2/btree.c b/fs/nilfs2/btree.c
index ecdbae19a766..090d8ce25bd1 100644
--- a/fs/nilfs2/btree.c
+++ b/fs/nilfs2/btree.c
@@ -388,7 +388,7 @@ static int nilfs_btree_root_broken(const struct nilfs_btree_node *node,
nchildren = nilfs_btree_node_get_nchildren(node);
if (unlikely(level < NILFS_BTREE_LEVEL_NODE_MIN ||
- level > NILFS_BTREE_LEVEL_MAX ||
+ level >= NILFS_BTREE_LEVEL_MAX ||
nchildren < 0 ||
nchildren > NILFS_BTREE_ROOT_NCHILDREN_MAX)) {
pr_crit("NILFS: bad btree root (inode number=%lu): level = %d, flags = 0x%x, nchildren = %d\n",
diff --git a/include/linux/nilfs2_fs.h b/include/linux/nilfs2_fs.h
index 98755767c7b0..1108acaacfc6 100644
--- a/include/linux/nilfs2_fs.h
+++ b/include/linux/nilfs2_fs.h
@@ -458,7 +458,7 @@ struct nilfs_btree_node {
/* level */
#define NILFS_BTREE_LEVEL_DATA 0
#define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
-#define NILFS_BTREE_LEVEL_MAX 14
+#define NILFS_BTREE_LEVEL_MAX 14 /* Max level (exclusive) */
/**
* struct nilfs_palloc_group_desc - block group descriptor
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] RDMA/CMA: Canonize IPv4 on IPV6 sockets properly
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug Jiri Slaby
` (5 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable; +Cc: Jason Gunthorpe, Doug Ledford, Jiri Slaby
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 285214409a9e5fceba2215461b4682b6069d8e77 upstream.
When accepting a new IPv4 connect to an IPv6 socket, the CMA tries to
canonize the address family to IPv4, but does not properly process
the listening sockaddr to get the listening port, and does not properly
set the address family of the canonized sockaddr.
Fixes: e51060f08a61 ("IB: IP address based RDMA connection manager")
Reported-By: Yotam Kenneth <yotamke@mellanox.com>
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Tested-by: Haggai Eran <haggaie@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/infiniband/core/cma.c | 27 +++++++++++++++++----------
1 file changed, 17 insertions(+), 10 deletions(-)
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index dab4b41f1715..1429143301a7 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -840,19 +840,27 @@ static void cma_save_ib_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id
memcpy(&ib->sib_addr, &path->dgid, 16);
}
+static __be16 ss_get_port(const struct sockaddr_storage *ss)
+{
+ if (ss->ss_family == AF_INET)
+ return ((struct sockaddr_in *)ss)->sin_port;
+ else if (ss->ss_family == AF_INET6)
+ return ((struct sockaddr_in6 *)ss)->sin6_port;
+ BUG();
+}
+
static void cma_save_ip4_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id,
struct cma_hdr *hdr)
{
- struct sockaddr_in *listen4, *ip4;
+ struct sockaddr_in *ip4;
- listen4 = (struct sockaddr_in *) &listen_id->route.addr.src_addr;
ip4 = (struct sockaddr_in *) &id->route.addr.src_addr;
- ip4->sin_family = listen4->sin_family;
+ ip4->sin_family = AF_INET;
ip4->sin_addr.s_addr = hdr->dst_addr.ip4.addr;
- ip4->sin_port = listen4->sin_port;
+ ip4->sin_port = ss_get_port(&listen_id->route.addr.src_addr);
ip4 = (struct sockaddr_in *) &id->route.addr.dst_addr;
- ip4->sin_family = listen4->sin_family;
+ ip4->sin_family = AF_INET;
ip4->sin_addr.s_addr = hdr->src_addr.ip4.addr;
ip4->sin_port = hdr->port;
}
@@ -860,16 +868,15 @@ static void cma_save_ip4_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_i
static void cma_save_ip6_info(struct rdma_cm_id *id, struct rdma_cm_id *listen_id,
struct cma_hdr *hdr)
{
- struct sockaddr_in6 *listen6, *ip6;
+ struct sockaddr_in6 *ip6;
- listen6 = (struct sockaddr_in6 *) &listen_id->route.addr.src_addr;
ip6 = (struct sockaddr_in6 *) &id->route.addr.src_addr;
- ip6->sin6_family = listen6->sin6_family;
+ ip6->sin6_family = AF_INET6;
ip6->sin6_addr = hdr->dst_addr.ip6;
- ip6->sin6_port = listen6->sin6_port;
+ ip6->sin6_port = ss_get_port(&listen_id->route.addr.src_addr);
ip6 = (struct sockaddr_in6 *) &id->route.addr.dst_addr;
- ip6->sin6_family = listen6->sin6_family;
+ ip6->sin6_family = AF_INET6;
ip6->sin6_addr = hdr->src_addr.ip6;
ip6->sin6_port = hdr->port;
}
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] RDMA/CMA: Canonize IPv4 on IPV6 sockets properly Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
2015-05-15 14:51 ` Johan Hovold
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mnt: Fix fs_fully_visible to verify the root directory is visible Jiri Slaby
` (4 subsequent siblings)
7 siblings, 1 reply; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable; +Cc: Johan Hovold, Linus Walleij, Jiri Slaby
From: Johan Hovold <johan@kernel.org>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 483d821108791092798f5d230686868112927044 upstream.
Unregister GPIOs requested through sysfs at chip remove to avoid leaking
the associated memory and sysfs entries.
The stale sysfs entries prevented the gpio numbers from being exported
when the gpio range was later reused (e.g. at device reconnect).
This also fixes the related module-reference leak.
Note that kernfs makes sure that any on-going sysfs operations finish
before the class devices are unregistered and that further accesses
fail.
The chip exported flag is used to prevent gpiod exports during removal.
This also makes it harder to trigger, but does not fix, the related race
between gpiochip_remove and export_store, which is really a race with
gpiod_request that needs to be addressed separately.
Also note that this would prevent the crashes (e.g. NULL-dereferences)
at reconnect that affects pre-3.18 kernels, as well as use-after-free on
operations on open attribute files on pre-3.14 kernels (prior to
kernfs).
Fixes: d8f388d8dc8d ("gpio: sysfs interface")
Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/gpio/gpiolib.c | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8a9b61adcd87..b471a70e5966 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -747,6 +747,7 @@ static struct class gpio_class = {
*/
static int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
{
+ struct gpio_chip *chip;
unsigned long flags;
int status;
const char *ioname = NULL;
@@ -764,8 +765,16 @@ static int gpiod_export(struct gpio_desc *desc, bool direction_may_change)
return -EINVAL;
}
+ chip = desc->chip;
+
mutex_lock(&sysfs_lock);
+ /* check if chip is being removed */
+ if (!chip || !chip->exported) {
+ status = -ENODEV;
+ goto fail_unlock;
+ }
+
spin_lock_irqsave(&gpio_lock, flags);
if (!test_bit(FLAG_REQUESTED, &desc->flags) ||
test_bit(FLAG_EXPORT, &desc->flags)) {
@@ -1029,12 +1038,15 @@ static void gpiochip_unexport(struct gpio_chip *chip)
{
int status;
struct device *dev;
+ struct gpio_desc *desc;
+ unsigned int i;
mutex_lock(&sysfs_lock);
dev = class_find_device(&gpio_class, NULL, chip, match_export);
if (dev) {
put_device(dev);
device_unregister(dev);
+ /* prevent further gpiod exports */
chip->exported = 0;
status = 0;
} else
@@ -1044,6 +1056,13 @@ static void gpiochip_unexport(struct gpio_chip *chip)
if (status)
pr_debug("%s: chip %s status %d\n", __func__,
chip->label, status);
+
+ /* unregister gpiod class devices owned by sysfs */
+ for (i = 0; i < chip->ngpio; i++) {
+ desc = &chip->desc[i];
+ if (test_and_clear_bit(FLAG_SYSFS, &desc->flags))
+ gpiod_free(desc);
+ }
}
static int __init gpiolib_sysfs_init(void)
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] mnt: Fix fs_fully_visible to verify the root directory is visible
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
` (2 preceding siblings ...)
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mm/memory-failure: call shake_page() when error hits thp tail page Jiri Slaby
` (3 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable; +Cc: Eric W. Biederman, Jiri Slaby
From: "Eric W. Biederman" <ebiederm@xmission.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 7e96c1b0e0f495c5a7450dc4aa7c9a24ba4305bd upstream.
This fixes a dumb bug in fs_fully_visible that allows proc or sys to
be mounted if there is a bind mount of part of /proc/ or /sys/ visible.
Reported-by: Eric Windisch <ewindisch@docker.com>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
fs/namespace.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/fs/namespace.c b/fs/namespace.c
index 7c3c0f6d2744..247f34d43dda 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2940,6 +2940,12 @@ bool fs_fully_visible(struct file_system_type *type)
if (mnt->mnt.mnt_sb->s_type != type)
continue;
+ /* This mount is not fully visible if it's root directory
+ * is not the root directory of the filesystem.
+ */
+ if (mnt->mnt.mnt_root != mnt->mnt.mnt_sb->s_root)
+ continue;
+
/* This mount is not fully visible if there are any child mounts
* that cover anything except for empty directories.
*/
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] mm/memory-failure: call shake_page() when error hits thp tail page
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
` (3 preceding siblings ...)
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mnt: Fix fs_fully_visible to verify the root directory is visible Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] writeback: use |1 instead of +1 to protect against div by zero Jiri Slaby
` (2 subsequent siblings)
7 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable
Cc: Naoya Horiguchi, Andrea Arcangeli, Hidetoshi Seto, Jin Dongming,
Andrew Morton, Linus Torvalds, Jiri Slaby
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 09789e5de18e4e442870b2d700831f5cb802eb05 upstream.
Currently memory_failure() calls shake_page() to sweep pages out from
pcplists only when the victim page is 4kB LRU page or thp head page.
But we should do this for a thp tail page too.
Consider that a memory error hits a thp tail page whose head page is on
a pcplist when memory_failure() runs. Then, the current kernel skips
shake_pages() part, so hwpoison_user_mappings() returns without calling
split_huge_page() nor try_to_unmap() because PageLRU of the thp head is
still cleared due to the skip of shake_page().
As a result, me_huge_page() runs for the thp, which is broken behavior.
One effect is a leak of the thp. And another is to fail to isolate the
memory error, so later access to the error address causes another MCE,
which kills the processes which used the thp.
This patch fixes this problem by calling shake_page() for thp tail case.
Fixes: 385de35722c9 ("thp: allow a hwpoisoned head page to be put back to LRU")
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Reviewed-by: Andi Kleen <ak@linux.intel.com>
Acked-by: Dean Nelson <dnelson@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Cc: Jin Dongming <jin.dongming@np.css.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
mm/memory-failure.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 532b4661985c..2e94ad1133af 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1149,10 +1149,10 @@ int memory_failure(unsigned long pfn, int trapno, int flags)
* The check (unnecessarily) ignores LRU pages being isolated and
* walked by the page reclaim code, however that's not a big loss.
*/
- if (!PageHuge(p) && !PageTransTail(p)) {
- if (!PageLRU(p))
- shake_page(p, 0);
- if (!PageLRU(p)) {
+ if (!PageHuge(p)) {
+ if (!PageLRU(hpage))
+ shake_page(hpage, 0);
+ if (!PageLRU(hpage)) {
/*
* shake_page could have turned it free.
*/
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] writeback: use |1 instead of +1 to protect against div by zero
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
` (4 preceding siblings ...)
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mm/memory-failure: call shake_page() when error hits thp tail page Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mm: soft-offline: fix num_poisoned_pages counting on concurrent events Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] xen/console: Update console event channel on resume Jiri Slaby
7 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable; +Cc: Tejun Heo, Jens Axboe, Jiri Slaby
From: Tejun Heo <tj@kernel.org>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 464d1387acb94dc43ba772b35242345e3d2ead1b upstream.
mm/page-writeback.c has several places where 1 is added to the divisor
to prevent division by zero exceptions; however, if the original
divisor is equivalent to -1, adding 1 leads to division by zero.
There are three places where +1 is used for this purpose - one in
pos_ratio_polynom() and two in bdi_position_ratio(). The second one
in bdi_position_ratio() actually triggered div-by-zero oops on a
machine running a 3.10 kernel. The divisor is
x_intercept - bdi_setpoint + 1 == span + 1
span is confirmed to be (u32)-1. It isn't clear how it ended up that
but it could be from write bandwidth calculation underflow fixed by
c72efb658f7c ("writeback: fix possible underflow in write bandwidth
calculation").
At any rate, +1 isn't a proper protection against div-by-zero. This
patch converts all +1 protections to |1. Note that
bdi_update_dirty_ratelimit() was already using |1 before this patch.
Signed-off-by: Tejun Heo <tj@kernel.org>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
mm/page-writeback.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
index 51d8d15f48d7..656a5490f693 100644
--- a/mm/page-writeback.c
+++ b/mm/page-writeback.c
@@ -601,7 +601,7 @@ static long long pos_ratio_polynom(unsigned long setpoint,
long x;
x = div64_s64(((s64)setpoint - (s64)dirty) << RATELIMIT_CALC_SHIFT,
- limit - setpoint + 1);
+ (limit - setpoint) | 1);
pos_ratio = x;
pos_ratio = pos_ratio * x >> RATELIMIT_CALC_SHIFT;
pos_ratio = pos_ratio * x >> RATELIMIT_CALC_SHIFT;
@@ -828,7 +828,7 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi,
* scale global setpoint to bdi's:
* bdi_setpoint = setpoint * bdi_thresh / thresh
*/
- x = div_u64((u64)bdi_thresh << 16, thresh + 1);
+ x = div_u64((u64)bdi_thresh << 16, thresh | 1);
bdi_setpoint = setpoint * (u64)x >> 16;
/*
* Use span=(8*write_bw) in single bdi case as indicated by
@@ -843,7 +843,7 @@ static unsigned long bdi_position_ratio(struct backing_dev_info *bdi,
if (bdi_dirty < x_intercept - span / 4) {
pos_ratio = div64_u64(pos_ratio * (x_intercept - bdi_dirty),
- x_intercept - bdi_setpoint + 1);
+ (x_intercept - bdi_setpoint) | 1);
} else
pos_ratio /= 4;
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] mm: soft-offline: fix num_poisoned_pages counting on concurrent events
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
` (5 preceding siblings ...)
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] writeback: use |1 instead of +1 to protect against div by zero Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] xen/console: Update console event channel on resume Jiri Slaby
7 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable
Cc: Naoya Horiguchi, Andi Kleen, Andrew Morton, Linus Torvalds,
Jiri Slaby
From: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit 602498f9aa43d4951eece3fd6ad95a6d0a78d537 upstream.
If multiple soft offline events hit one free page/hugepage concurrently,
soft_offline_page() can handle the free page/hugepage multiple times,
which makes num_poisoned_pages counter increased more than once. This
patch fixes this wrong counting by checking TestSetPageHWPoison for normal
papes and by checking the return value of dequeue_hwpoisoned_huge_page()
for hugepages.
Signed-off-by: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Acked-by: Dean Nelson <dnelson@redhat.com>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
mm/memory-failure.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 2e94ad1133af..5785b59620ef 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -1718,12 +1718,12 @@ int soft_offline_page(struct page *page, int flags)
} else { /* for free pages */
if (PageHuge(page)) {
set_page_hwpoison_huge_page(hpage);
- dequeue_hwpoisoned_huge_page(hpage);
- atomic_long_add(1 << compound_order(hpage),
+ if (!dequeue_hwpoisoned_huge_page(hpage))
+ atomic_long_add(1 << compound_order(hpage),
&num_poisoned_pages);
} else {
- SetPageHWPoison(page);
- atomic_long_inc(&num_poisoned_pages);
+ if (!TestSetPageHWPoison(page))
+ atomic_long_inc(&num_poisoned_pages);
}
}
unset:
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [patch added to the 3.12 stable tree] xen/console: Update console event channel on resume
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
` (6 preceding siblings ...)
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mm: soft-offline: fix num_poisoned_pages counting on concurrent events Jiri Slaby
@ 2015-05-15 14:28 ` Jiri Slaby
7 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 14:28 UTC (permalink / raw)
To: stable; +Cc: Boris Ostrovsky, David Vrabel, Jiri Slaby
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
This patch has been added to the 3.12 stable tree. If you have any
objections, please let us know.
===============
commit b9d934f27c91b878c4b2e64299d6e419a4022f8d upstream.
After a resume the hypervisor/tools may change console event
channel number. We should re-query it.
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/hvc/hvc_xen.c | 18 +++++++++++++++++-
1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/drivers/tty/hvc/hvc_xen.c b/drivers/tty/hvc/hvc_xen.c
index c193af6a628f..b4805adc50af 100644
--- a/drivers/tty/hvc/hvc_xen.c
+++ b/drivers/tty/hvc/hvc_xen.c
@@ -299,11 +299,27 @@ static int xen_initial_domain_console_init(void)
return 0;
}
+static void xen_console_update_evtchn(struct xencons_info *info)
+{
+ if (xen_hvm_domain()) {
+ uint64_t v;
+ int err;
+
+ err = hvm_get_parameter(HVM_PARAM_CONSOLE_EVTCHN, &v);
+ if (!err && v)
+ info->evtchn = v;
+ } else
+ info->evtchn = xen_start_info->console.domU.evtchn;
+}
+
void xen_console_resume(void)
{
struct xencons_info *info = vtermno_to_xencons(HVC_COOKIE);
- if (info != NULL && info->irq)
+ if (info != NULL && info->irq) {
+ if (!xen_initial_domain())
+ xen_console_update_evtchn(info);
rebind_evtchn_irq(info->evtchn, info->irq);
+ }
}
static void xencons_disconnect_backend(struct xencons_info *info)
--
2.3.7
^ permalink raw reply related [flat|nested] 13+ messages in thread
* Re: [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug Jiri Slaby
@ 2015-05-15 14:51 ` Johan Hovold
2015-05-15 19:51 ` Jiri Slaby
0 siblings, 1 reply; 13+ messages in thread
From: Johan Hovold @ 2015-05-15 14:51 UTC (permalink / raw)
To: Jiri Slaby; +Cc: stable, Johan Hovold, Linus Walleij
On Fri, May 15, 2015 at 04:28:24PM +0200, Jiri Slaby wrote:
> From: Johan Hovold <johan@kernel.org>
>
> This patch has been added to the 3.12 stable tree. If you have any
> objections, please let us know.
This one depends on 01cca93a9491 ("gpio: unregister gpiochip device
before removing it") as indicated by the stable tag:
Cc: stable <stable@vger.kernel.org> # v2.6.27: 01cca93a9491
Johan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug
2015-05-15 14:51 ` Johan Hovold
@ 2015-05-15 19:51 ` Jiri Slaby
2015-05-15 20:24 ` Johan Hovold
0 siblings, 1 reply; 13+ messages in thread
From: Jiri Slaby @ 2015-05-15 19:51 UTC (permalink / raw)
To: Johan Hovold; +Cc: stable, Linus Walleij
On 05/15/2015, 04:51 PM, Johan Hovold wrote:
> On Fri, May 15, 2015 at 04:28:24PM +0200, Jiri Slaby wrote:
>> From: Johan Hovold <johan@kernel.org>
>>
>> This patch has been added to the 3.12 stable tree. If you have any
>> objections, please let us know.
>
> This one depends on 01cca93a9491 ("gpio: unregister gpiochip device
> before removing it") as indicated by the stable tag:
>
> Cc: stable <stable@vger.kernel.org> # v2.6.27: 01cca93a9491
I am not sure what you mean. The commit contains:
Fixes: d8f388d8dc8d ("gpio: sysfs interface")
Cc: stable <stable@vger.kernel.org> # v2.6.27: 01cca93a9491
d8f388d8dc8d is in 2.6.27
01cca93a9491 is in 3.19
Since it is fixing something in 2.6.27, I should take it to 3.12, or am
I missing something?
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug
2015-05-15 19:51 ` Jiri Slaby
@ 2015-05-15 20:24 ` Johan Hovold
2015-05-16 6:42 ` Jiri Slaby
0 siblings, 1 reply; 13+ messages in thread
From: Johan Hovold @ 2015-05-15 20:24 UTC (permalink / raw)
To: Jiri Slaby; +Cc: Johan Hovold, stable, Linus Walleij
On Fri, May 15, 2015 at 09:51:29PM +0200, Jiri Slaby wrote:
> On 05/15/2015, 04:51 PM, Johan Hovold wrote:
> > On Fri, May 15, 2015 at 04:28:24PM +0200, Jiri Slaby wrote:
> >> From: Johan Hovold <johan@kernel.org>
> >>
> >> This patch has been added to the 3.12 stable tree. If you have any
> >> objections, please let us know.
> >
> > This one depends on 01cca93a9491 ("gpio: unregister gpiochip device
> > before removing it") as indicated by the stable tag:
> >
> > Cc: stable <stable@vger.kernel.org> # v2.6.27: 01cca93a9491
>
> I am not sure what you mean. The commit contains:
> Fixes: d8f388d8dc8d ("gpio: sysfs interface")
> Cc: stable <stable@vger.kernel.org> # v2.6.27: 01cca93a9491
>
> d8f388d8dc8d is in 2.6.27
> 01cca93a9491 is in 3.19
>
> Since it is fixing something in 2.6.27, I should take it to 3.12, or am
> I missing something?
Yes, but the stable tag above means you need to backport 01cca93a9491
("gpio: unregister gpiochip device before removing it") as well.
Backports of both patches for 3.10 and 3.14 can be found in Greg's
stable queues (posted to stable list earlier today).
Johan
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug
2015-05-15 20:24 ` Johan Hovold
@ 2015-05-16 6:42 ` Jiri Slaby
0 siblings, 0 replies; 13+ messages in thread
From: Jiri Slaby @ 2015-05-16 6:42 UTC (permalink / raw)
To: Johan Hovold; +Cc: stable, Linus Walleij
On 05/15/2015, 10:24 PM, Johan Hovold wrote:
> Yes, but the stable tag above means you need to backport 01cca93a9491
> ("gpio: unregister gpiochip device before removing it") as well.
>
> Backports of both patches for 3.10 and 3.14 can be found in Greg's
> stable queues (posted to stable list earlier today).
I see now. Since I pull from Greg's 3.14 patches, I have that patch in
3.12 implicitly now.
thanks,
--
js
suse labs
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2015-05-16 6:42 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-15 14:28 [patch added to the 3.12 stable tree] ocfs2: dlm: fix race between purge and get lock resource Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] nilfs2: fix sanity check of btree level in nilfs_btree_root_broken() Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] RDMA/CMA: Canonize IPv4 on IPV6 sockets properly Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] gpio: sysfs: fix memory leaks and device hotplug Jiri Slaby
2015-05-15 14:51 ` Johan Hovold
2015-05-15 19:51 ` Jiri Slaby
2015-05-15 20:24 ` Johan Hovold
2015-05-16 6:42 ` Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mnt: Fix fs_fully_visible to verify the root directory is visible Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mm/memory-failure: call shake_page() when error hits thp tail page Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] writeback: use |1 instead of +1 to protect against div by zero Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] mm: soft-offline: fix num_poisoned_pages counting on concurrent events Jiri Slaby
2015-05-15 14:28 ` [patch added to the 3.12 stable tree] xen/console: Update console event channel on resume Jiri Slaby
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox