[Devel] [PATCH rh7] ext4: ext4_mkdir must set S_IOPS_WRAPPER bit

2016-07-25 Thread Maxim Patlasov
ext4_iget() sets this bit for directories. Let's do the same in ext4_mkdir().
Otherwise, the behaviour of vfs_rename (on top of ext4) varies depending on
how the in-core inode was born: via lookup or mkdir.

The key place in vfs_rename sensible to the change is:

>   if (flags && !rename2)
>   return -EINVAL;

Signed-off-by: Maxim Patlasov 
---
 fs/ext4/namei.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
index 0adc6df..bebe698 100644
--- a/fs/ext4/namei.c
+++ b/fs/ext4/namei.c
@@ -2413,6 +2413,7 @@ retry:
 
inode->i_op = &ext4_dir_inode_operations.ops;
inode->i_fop = &ext4_dir_operations;
+   inode->i_flags |= S_IOPS_WRAPPER;
err = ext4_init_new_dir(handle, dir, inode);
if (err)
goto out_clear_inode;

___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH rh7 2/2] ms/sched/fair: Do not announce throttled next buddy in dequeue_task_fair()

2016-07-25 Thread Andrey Ryabinin
From: Konstantin Khlebnikov 

ms commit: 754bd598be9bbc953bc709a9e8ed7f3188bfb9d7.

Hierarchy could be already throttled at this point. Throttled next
buddy could trigger a NULL pointer dereference in pick_next_task_fair().

Signed-off-by: Konstantin Khlebnikov 
Signed-off-by: Peter Zijlstra (Intel) 
Reviewed-by: Ben Segall 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Link: 
http://lkml.kernel.org/r/146608183552.21905.15924473394414832071.stgit@buzz
Signed-off-by: Ingo Molnar 

https://jira.sw.ru/browse/PSBM-50099

Signed-off-by: Andrey Ryabinin 
---
 kernel/sched/fair.c | 9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index b6f70a3..a87bacf 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -4215,15 +4215,14 @@ static void dequeue_task_fair(struct rq *rq, struct 
task_struct *p, int flags)
 
/* Don't dequeue parent if it has other entities besides us */
if (cfs_rq->load.weight) {
+   /* Avoid re-evaluating load for this entity: */
+   se = parent_entity(se);
/*
 * Bias pick_next to pick a task from this cfs_rq, as
 * p is sleeping when it is within its sched_slice.
 */
-   if (task_sleep && parent_entity(se))
-   set_next_buddy(parent_entity(se));
-
-   /* avoid re-evaluating load for this entity */
-   se = parent_entity(se);
+   if (task_sleep && se && !throttled_hierarchy(cfs_rq))
+   set_next_buddy(se);
break;
}
flags |= DEQUEUE_SLEEP;
-- 
2.7.3

___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH rh7 1/2] ms/sched/fair: Initialize throttle_count for new task-groups lazily

2016-07-25 Thread Andrey Ryabinin
From: Konstantin Khlebnikov 

ms commit: 094f469172e00d6ab0a3130b0e01c83b3cf3a98d

Cgroup created inside throttled group must inherit current throttle_count.
Broken throttle_count allows to nominate throttled entries as a next buddy,
later this leads to null pointer dereference in pick_next_task_fair().

This patch initialize cfs_rq->throttle_count at first enqueue: laziness
allows to skip locking all rq at group creation. Lazy approach also allows
to skip full sub-tree scan at throttling hierarchy (not in this patch).

Signed-off-by: Konstantin Khlebnikov 
Signed-off-by: Peter Zijlstra (Intel) 
Cc: Linus Torvalds 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: bseg...@google.com
Link: http://lkml.kernel.org/r/146608182119.21870.8439834428248129633.stgit@buzz
Signed-off-by: Ingo Molnar 

https://jira.sw.ru/browse/PSBM-50099

Signed-off-by: Andrey Ryabinin 
---
 kernel/sched/fair.c  | 20 
 kernel/sched/sched.h |  2 +-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 515685f..b6f70a3 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -3850,6 +3850,26 @@ static void check_enqueue_throttle(struct cfs_rq *cfs_rq)
if (!cfs_bandwidth_used())
return;
 
+   /* Synchronize hierarchical throttle counter: */
+   if (unlikely(!cfs_rq->throttle_uptodate)) {
+   struct rq *rq = rq_of(cfs_rq);
+   struct cfs_rq *pcfs_rq;
+   struct task_group *tg;
+
+   cfs_rq->throttle_uptodate = 1;
+
+   /* Get closest up-to-date node, because leaves go first: */
+   for (tg = cfs_rq->tg->parent; tg; tg = tg->parent) {
+   pcfs_rq = tg->cfs_rq[cpu_of(rq)];
+   if (pcfs_rq->throttle_uptodate)
+   break;
+   }
+   if (tg) {
+   cfs_rq->throttle_count = pcfs_rq->throttle_count;
+   cfs_rq->throttled_clock_task = rq_clock_task(rq);
+   }
+   }
+
/* an active group must be handled by the update_curr()->put() path */
if (!cfs_rq->runtime_enabled || cfs_rq->curr)
return;
diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h
index 2bdf80b..d9fe825 100644
--- a/kernel/sched/sched.h
+++ b/kernel/sched/sched.h
@@ -352,7 +352,7 @@ struct cfs_rq {
 
u64 throttled_clock, throttled_clock_task;
u64 throttled_clock_task_time;
-   int throttled, throttle_count;
+   int throttled, throttle_count, throttle_uptodate;
struct list_head throttled_list;
 
struct list_head boosted_entities;
-- 
2.7.3

___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH] ve/bridge: br_dev_init: check if "bridge" feature is enabled

2016-07-25 Thread Evgenii Shatokhin
https://jira.sw.ru/browse/PSBM-50009

Currently, the feature is checked in br_ioctl_deviceless_stub() which is
called when "brctl addbr" runs. However, "ip link add br1 type bridge"
goes a different path and still succeeds even if the feature is disabled
for a CT:
rtnl_newlink
  rtnl_create_link
br_dev_setup
  register_netdevice
br_dev_init
...

Let us check the "bridge" feature in br_dev_init() instead, to cover both
cases.

Signed-off-by: Evgenii Shatokhin 
---
 net/bridge/br_device.c | 4 
 net/bridge/br_ioctl.c  | 3 ---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 5e3347b..db206a3 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -88,8 +88,12 @@ out:
 static int br_dev_init(struct net_device *dev)
 {
struct net_bridge *br = netdev_priv(dev);
+   struct net *net = dev_net(dev);
int err;
 
+   if (!(net->owner_ve->features & VE_FEATURE_BRIDGE))
+   return -EACCES;
+
br->stats = netdev_alloc_pcpu_stats(struct pcpu_sw_netstats);
if (!br->stats)
return -ENOMEM;
diff --git a/net/bridge/br_ioctl.c b/net/bridge/br_ioctl.c
index 98447b8..cd8c3a4 100644
--- a/net/bridge/br_ioctl.c
+++ b/net/bridge/br_ioctl.c
@@ -351,9 +351,6 @@ static int old_deviceless(struct net *net, void __user 
*uarg)
 
 int br_ioctl_deviceless_stub(struct net *net, unsigned int cmd, void __user 
*uarg)
 {
-   if (!(net->owner_ve->features & VE_FEATURE_BRIDGE))
-   return -ENOTTY;
-
switch (cmd) {
case SIOCGIFBR:
case SIOCSIFBR:
-- 
2.7.3

___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


Re: [Devel] Bug 124651 - ext4 bugon panic when I mmap a file

2016-07-25 Thread Dmitry Monakhov
Maxim Patlasov  writes:

> Dima,
>
>
> Just in case, does this:
>
>
> https://bugzilla.kernel.org/show_bug.cgi?id=124651
>
>
> affect us?
No. His testcase does not work 3.10.0-327.18.2.vz7.14.21
I've tested this like this:


signature.asc
Description: PGP signature
#! /bin/bash

#Testcase for https://bugzilla.kernel.org/show_bug.cgi?id=124651

echo Install debug info
yum install -y systemtap systemtap-runtime
yum install --enablerepo=virtuozzo-updates-debuginfo \
--enablerepo=virtuozzo-os-debuginfo fedora-source -y \
vzkernel-devel-$(uname -r) vzkernel-debuginfo-$(uname -r) \
vzkernel-debuginfo-common-$(uname -m)-$(uname -r) || exit 1

# Fetch source
curl https://bugzilla.kernel.org/attachment.cgi?id=224251 > /tmp/test.c || exit 1

# Original stap file not detect sb by default. So i've modified it.
base64 -d >/tmp/fail_ext4.stp <___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel