[Devel] [PATCH rh7] Resurrect proc fairsched files

2016-06-24 Thread Vladimir Davydov
They are still required by userspace, which checks for their presence.
Leave them empty.

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

Signed-off-by: Vladimir Davydov 
---
 kernel/ve/veowner.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/kernel/ve/veowner.c b/kernel/ve/veowner.c
index 86065072a9ca..757dde99ef0f 100644
--- a/kernel/ve/veowner.c
+++ b/kernel/ve/veowner.c
@@ -36,12 +36,38 @@
 struct proc_dir_entry *proc_vz_dir;
 EXPORT_SYMBOL(proc_vz_dir);
 
+static int proc_fairsched_open(struct inode *inode, struct file *file)
+{
+   return 0;
+}
+
+static ssize_t proc_fairsched_read(struct file *file, char __user *buf,
+  size_t size, loff_t *ppos)
+{
+   return 0;
+}
+
+static struct file_operations proc_fairsched_operations = {
+   .open   = proc_fairsched_open,
+   .read   = proc_fairsched_read,
+   .llseek = noop_llseek,
+};
+
 static void prepare_proc(void)
 {
proc_vz_dir = proc_mkdir_mode("vz", S_ISVTX | S_IRUGO | S_IXUGO, NULL);
if (!proc_vz_dir)
panic("Can't create /proc/vz dir\n");
+
+   /* Legacy files. They are not really needed and should be removed
+* sooner or later, but leave the stubs for now as they may be required
+* by userspace */
+
proc_mkdir_mode("container", 0, proc_vz_dir);
+   proc_mkdir_mode("fairsched", 0, proc_vz_dir);
+
+   proc_create("fairsched", S_ISVTX, NULL, &proc_fairsched_operations);
+   proc_create("fairsched2", S_ISVTX, NULL, &proc_fairsched_operations);
 }
 #endif
 
-- 
2.1.4

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


[Devel] [PATCH RHEL7 COMMIT] ve/fairsched: Resurrect proc fairsched files

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit 97fbb9ebeb80c4698ee3384bf2f7b3bcfab7ded7
Author: Vladimir Davydov 
Date:   Fri Jun 24 14:18:40 2016 +0400

ve/fairsched: Resurrect proc fairsched files

They are still required by userspace, which checks for their presence.
Leave them empty.

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

Signed-off-by: Vladimir Davydov 
---
 kernel/ve/veowner.c | 26 ++
 1 file changed, 26 insertions(+)

diff --git a/kernel/ve/veowner.c b/kernel/ve/veowner.c
index 8606507..757dde9 100644
--- a/kernel/ve/veowner.c
+++ b/kernel/ve/veowner.c
@@ -36,12 +36,38 @@
 struct proc_dir_entry *proc_vz_dir;
 EXPORT_SYMBOL(proc_vz_dir);
 
+static int proc_fairsched_open(struct inode *inode, struct file *file)
+{
+   return 0;
+}
+
+static ssize_t proc_fairsched_read(struct file *file, char __user *buf,
+  size_t size, loff_t *ppos)
+{
+   return 0;
+}
+
+static struct file_operations proc_fairsched_operations = {
+   .open   = proc_fairsched_open,
+   .read   = proc_fairsched_read,
+   .llseek = noop_llseek,
+};
+
 static void prepare_proc(void)
 {
proc_vz_dir = proc_mkdir_mode("vz", S_ISVTX | S_IRUGO | S_IXUGO, NULL);
if (!proc_vz_dir)
panic("Can't create /proc/vz dir\n");
+
+   /* Legacy files. They are not really needed and should be removed
+* sooner or later, but leave the stubs for now as they may be required
+* by userspace */
+
proc_mkdir_mode("container", 0, proc_vz_dir);
+   proc_mkdir_mode("fairsched", 0, proc_vz_dir);
+
+   proc_create("fairsched", S_ISVTX, NULL, &proc_fairsched_operations);
+   proc_create("fairsched2", S_ISVTX, NULL, &proc_fairsched_operations);
 }
 #endif
 
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ve/net: enable IPPROTO_ICMP inside Containers

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit a387508fcb761c893c0e70bf20356f5bd879a8dd
Author: Vasily Averin 
Date:   Fri Jun 24 14:22:24 2016 +0400

ve/net: enable IPPROTO_ICMP inside Containers

iputils-ping 20150815 fails inside containers because socket(PF_INET,
SOCK_DGRAM, IPPROTO_ICMP) is restricted by vz_security_protocol_check()

The patch enables creation of such sockets inside containers.
By default sys_socket still fails because default setting of sysctl
net.ipv4.ping_group_range, however it's enough for iputils-ping 20150815.
Its fallback handles this situation and successfully creates RAW socket.

In mainlune it is enabled in MS kernel v3.13+, see:
commit fd2d5356d902 ("ipv4: Allow unprivileged users to use per net 
sysctls")
in future we're going backport this patch and add its save/restore into 
criu.

https://bugs.openvz.org/browse/OVZ-6744
https://jira.sw.ru/browse/PSBM-47413

Signed-off-by:  Vasily Averin 
Acked-by: Pavel Tikhomirov 
---
 kernel/ve/ve.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index d196e3e..b5399e1 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -227,6 +227,7 @@ int vz_security_protocol_check(struct net *net, int 
protocol)
 
switch (protocol) {
case  IPPROTO_IP:
+   case  IPPROTO_ICMP:
case  IPPROTO_TCP:
case  IPPROTO_UDP:
case  IPPROTO_RAW:
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ploop: skip redundant fsync for REQ_FUA in post_submit

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit 9374d303ce1038ae4af1fcfb018b3b0185b6123e
Author: Dmitry Monakhov 
Date:   Fri Jun 24 14:25:03 2016 +0400

ploop: skip redundant fsync for REQ_FUA in post_submit

Signed-off-by: Dmitry Monakhov 
Acked-by: Maxim Patlasov 
---
 drivers/block/ploop/io_direct.c | 24 ++--
 1 file changed, 14 insertions(+), 10 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 50c0ed1..e92fb64 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -522,27 +522,31 @@ dio_post_submit(struct ploop_io *io, struct ploop_request 
* preq)
struct ploop_device *plo = preq->plo;
sector_t sec = (sector_t)preq->iblock << preq->plo->cluster_log;
loff_t clu_siz = 1 << (preq->plo->cluster_log + 9);
+   int force_sync = preq->req_rw & REQ_FUA;
int err;
 
file_start_write(io->files.file);
 
-   /* Here io->io_count is even ... */
-   spin_lock_irq(&plo->lock);
-   io->io_count++;
-   set_bit(PLOOP_IO_FSYNC_DELAYED, &io->io_state);
-   spin_unlock_irq(&plo->lock);
-
+   if (!force_sync) {
+   /* Here io->io_count is even ... */
+   spin_lock_irq(&plo->lock);
+   io->io_count++;
+   set_bit(PLOOP_IO_FSYNC_DELAYED, &io->io_state);
+   spin_unlock_irq(&plo->lock);
+   }
err = io->files.file->f_op->fallocate(io->files.file,
  FALLOC_FL_CONVERT_UNWRITTEN,
  (loff_t)sec << 9, clu_siz);
 
/* highly unlikely case: FUA coming to a block not provisioned yet */
-   if (!err && (preq->req_rw & REQ_FUA))
+   if (!err && force_sync)
err = io->ops->sync(io);
 
-   spin_lock_irq(&plo->lock);
-   io->io_count++;
-   spin_unlock_irq(&plo->lock);
+   if (!force_sync) {
+   spin_lock_irq(&plo->lock);
+   io->io_count++;
+   spin_unlock_irq(&plo->lock);
+   }
/* and here io->io_count is even (+2) again. */
 
file_end_write(io->files.file);
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ve/fs: namespace -- Don't fail on permissions if @ve->devmnt_list is empty

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit b24d0d2aae02d1eeb033518dc2060c9e93c386d3
Author: Cyrill Gorcunov 
Date:   Fri Jun 24 14:26:56 2016 +0400

ve/fs: namespace -- Don't fail on permissions if @ve->devmnt_list is empty

In commit 7eeb5b4afa8db5a2f2e1e47ab6b84e55fc8c5661 I addressed
first half of a problem, but I happen to work with dirty copy
of libvzctl where mount_opts cgroup has been c/r'ed manually,
so I missed the case where @devmnt_list is empty on restore
(just like it is in vanilla libvzctl). So fix the second half.

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

Reported-by: Igor Sukhih 
Signed-off-by: Cyrill Gorcunov 
Reviewed-by: Vladimir Davydov 

CC: Konstantin Khorenko 
---
 fs/namespace.c | 18 ++
 1 file changed, 14 insertions(+), 4 deletions(-)

diff --git a/fs/namespace.c b/fs/namespace.c
index 3df0ac5..66e892c 100644
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -1954,10 +1954,20 @@ again:
goto again;
case 1:
if (*data_pp) {
-   ve_printk(VE_LOG_BOTH, KERN_WARNING "VE%s: no allowed "
- "mount options found for device %u:%u\n",
- ve->ve_name, MAJOR(dev), MINOR(dev));
-   err = -EPERM;
+   /*
+* Same as in chunk above but for case where
+* ve->devmnt_list is empty. Depending on
+* the way userspace tool restore container
+* it might be nonempty as well.
+*/
+   if (ve->is_pseudosuper) {
+   err = 0;
+   } else {
+   ve_printk(VE_LOG_BOTH, KERN_WARNING "VE%s: no 
allowed "
+ "mount options found for device 
%u:%u\n",
+ ve->ve_name, MAJOR(dev), MINOR(dev));
+   err = -EPERM;
+   }
} else
err = 0;
break;
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ve/net: ipip: enable in container

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit 976dd76adc39ba0926e3d764dc39dfa2873ccdb0
Author: Vladimir Davydov 
Date:   Fri Jun 24 14:30:29 2016 +0400

ve/net: ipip: enable in container

Currently, we fail to init ipip per-net in a ve, because it has neither
NETIF_F_VIRTUAL nor NETIF_F_NETNS_LOCAL:

 ipip_init_net
  ip_tunnel_init_net
   __ip_tunnel_create
register_netdevice
 ve_is_dev_movable

In PCS6 ipip has NETIF_F_NETNS_LOCAL, so everything works fine there,
but this restriction was removed in RH7 kernel, so we fail to start a
container if ipip is loaded (or load ipip if there are containers
running).

Mark ipip as NETIF_F_VIRTUAL to fix this issue.

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

Signed-off-by: Vladimir Davydov 
Tested-by: Evgenii Shatokhin 
---
 net/ipv4/ipip.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index e556a1d..7842dcb 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -301,6 +301,7 @@ static void ipip_tunnel_setup(struct net_device *dev)
netif_keep_dst(dev);
 
dev->features   |= IPIP_FEATURES;
+   dev->features   |= NETIF_F_VIRTUAL;
dev->hw_features|= IPIP_FEATURES;
ip_tunnel_setup(dev, ipip_net_id);
 }
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ve/net: sit: fix crash on newlink if VE_FEATURE_SIT is disabled

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit 32763e4fcaf5b502efafd257fea4e4b0436ea0fd
Author: Vladimir Davydov 
Date:   Fri Jun 24 14:30:30 2016 +0400

ve/net: sit: fix crash on newlink if VE_FEATURE_SIT is disabled

In this case net_generic returns NULL. We must handle this gracefully.

Signed-off-by: Vladimir Davydov 
Tested-by: Evgenii Shatokhin 
---
 net/ipv6/sit.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 2a73b52..6b1ae3b 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -1441,6 +1441,9 @@ static int ipip6_newlink(struct net *src_net, struct 
net_device *dev,
 #endif
int err;
 
+   if (net_generic(net, sit_net_id) == NULL)
+   return -EACCES;
+
nt = netdev_priv(dev);
ipip6_netlink_parms(data, &nt->parms);
 
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ve/net: ipip: fix crash on newlink if VE_FEATURE_IPIP is disabled

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit c935ea6ca0d4d0aeed3857bff8d507f2f2a63176
Author: Vladimir Davydov 
Date:   Fri Jun 24 14:30:30 2016 +0400

ve/net: ipip: fix crash on newlink if VE_FEATURE_IPIP is disabled

In this case net_generic returns NULL. We must handle this gracefully.

Signed-off-by: Vladimir Davydov 
Tested-by: Evgenii Shatokhin 
---
 net/ipv4/ipip.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/ipv4/ipip.c b/net/ipv4/ipip.c
index 7842dcb..b1004fb 100644
--- a/net/ipv4/ipip.c
+++ b/net/ipv4/ipip.c
@@ -357,6 +357,9 @@ static int ipip_newlink(struct net *src_net, struct 
net_device *dev,
 {
struct ip_tunnel_parm p;
 
+   if (net_generic(dev_net(dev), ipip_net_id) == NULL)
+   return -EACCES;
+
ipip_netlink_parms(data, &p);
return ip_tunnel_newlink(dev, tb, &p);
 }
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ve/net: ip_vti: skip per net init in ve

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit cded649a61aff2ad6a2d0f521b18501f6f5c1f31
Author: Vladimir Davydov 
Date:   Fri Jun 24 14:30:29 2016 +0400

ve/net: ip_vti: skip per net init in ve

ip_vti devices lack NETIF_F_VIRTUAL, so they can't be created inside a
container. Problem is a device of this kind is created on net ns init if
the module is loaded, as a result a container start fails with EPERM.

We could allow ip_vti inside container (as well as other net devices,
which I would really like to do), but this is insecure and might break
migration, so let's keep it disabled and fix the issue by silently
skipping ip_vti per net init if running inside a ve.

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

Signed-off-by: Vladimir Davydov 
Tested-by: Evgenii Shatokhin 
---
 net/ipv4/ip_vti.c | 15 +++
 1 file changed, 15 insertions(+)

diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
index ce80a9a..3158100 100644
--- a/net/ipv4/ip_vti.c
+++ b/net/ipv4/ip_vti.c
@@ -58,6 +58,9 @@ static int vti_input(struct sk_buff *skb, int nexthdr, __be32 
spi,
struct net *net = dev_net(skb->dev);
struct ip_tunnel_net *itn = net_generic(net, vti_net_id);
 
+   if (itn == NULL)
+   return -EINVAL;
+
tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,
  iph->saddr, iph->daddr, 0);
if (tunnel != NULL) {
@@ -256,6 +259,9 @@ static int vti4_err(struct sk_buff *skb, u32 info)
int protocol = iph->protocol;
struct ip_tunnel_net *itn = net_generic(net, vti_net_id);
 
+   if (itn == NULL)
+   return -1;
+
tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, TUNNEL_NO_KEY,
  iph->daddr, iph->saddr, 0);
if (!tunnel)
@@ -413,6 +419,9 @@ static int __net_init vti_init_net(struct net *net)
int err;
struct ip_tunnel_net *itn;
 
+   if (!ve_is_super(net->owner_ve))
+   return net_assign_generic(net, vti_net_id, NULL);
+
err = ip_tunnel_init_net(net, vti_net_id, &vti_link_ops, "ip_vti0");
if (err)
return err;
@@ -424,6 +433,9 @@ static int __net_init vti_init_net(struct net *net)
 static void __net_exit vti_exit_net(struct net *net)
 {
struct ip_tunnel_net *itn = net_generic(net, vti_net_id);
+
+   if (itn == NULL)
+   return;
ip_tunnel_delete_net(itn, &vti_link_ops);
 }
 
@@ -473,6 +485,9 @@ static int vti_newlink(struct net *src_net, struct 
net_device *dev,
 {
struct ip_tunnel_parm parms;
 
+   if (net_generic(dev_net(dev), vti_net_id) == NULL)
+   return -EACCES;
+
vti_netlink_parms(data, &parms);
return ip_tunnel_newlink(dev, tb, &parms);
 }
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] ploop: deadcode cleanup in dio_submit()

2016-06-24 Thread Konstantin Khorenko
The commit is pushed to "branch-rh7-3.10.0-327.18.2.vz7.14.x-ovz" and will 
appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.18.2.vz7.14.19
-->
commit 55e7ee0745a5ad542e7a4e25d65ea0967440c078
Author: Dmitry Monakhov 
Date:   Fri Jun 24 14:25:04 2016 +0400

ploop: deadcode cleanup in dio_submit()

(rw & REQ_FUA) branch is impossible because REQ_FUA was cleared line above.
Logic was moved to ploop_req_delay_fua_possible() long time ago.

Signed-off-by: Dmitry Monakhov 
Acked-by: Maxim Patlasov 
---
 drivers/block/ploop/io_direct.c | 9 -
 1 file changed, 9 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index e92fb64..50cdbf7 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -114,15 +114,6 @@ dio_submit(struct ploop_io *io, struct ploop_request * 
preq,
rw &= ~(REQ_FLUSH | REQ_FUA);
 
 
-   /* In case of eng_state != COMPLETE, we'll do FUA in
-* ploop_index_update(). Otherwise, we should mark
-* last bio as FUA here. */
-   if (rw & REQ_FUA) {
-   rw &= ~REQ_FUA;
-   if (preq->eng_state == PLOOP_E_COMPLETE)
-   postfua = 1;
-   }
-
bio_list_init(&bl);
 
if (iblk == PLOOP_ZERO_INDEX)
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [NEW KERNEL] 3.10.0-327.18.2.vz7.14.20 (rhel7)

2016-06-24 Thread builder
Changelog:

OpenVZ kernel rh7-3.10.0-327.18.2.vz7.14.20

* binfmt_misc: allow to mount fs inside a Container with root ns
  capability. Required for CRIU on dump stage.
* fairsched: temporarily resurrect proc fairsched files
* net: enable IPPROTO_ICMP inside Containers
* ploop: cleanups and dead code removal
* fs: another hunk to ignore permissions on fs mount inside a Container
  while running in @pseudosuper mode. Required for CRIU.
* net: enable IPIP support inside a Container. Requires additional
  Container feature set for the Container.
  Migration of such a Container is a separate case.
* net: disable IP_VTI support inside a Container.
  To be reworked in case someone really needs it.
* net: fix kernel crashes on attempts to use IPIP/SIT if they are disabled.


Generated changelog:

* Fri Jun 24 2016 Konstantin Khorenko  
[3.10.0-327.18.2.vz7.14.20]
- ve/net: sit: fix crash on newlink if VE_FEATURE_SIT is disabled (Vladimir 
Davydov)
- ve/net: ipip: fix crash on newlink if VE_FEATURE_IPIP is disabled (Vladimir 
Davydov)
- ve/net: ip_vti: skip per net init in ve (Vladimir Davydov) [PSBM-48698]
- ve/net: ipip: enable in container (Vladimir Davydov) [PSBM-48608]
- ve/fs: namespace -- Don't fail on permissions if @ve->devmnt_list is empty 
(Cyrill Gorcunov) [PSBM-48188]
- ploop: deadcode cleanup in dio_submit() (Dmitry Monakhov)
- ploop: skip redundant fsync for REQ_FUA in post_submit (Dmitry Monakhov)
- ve/net: enable IPPROTO_ICMP inside Containers (Vasily Averin) [OVZ-6744 
PSBM-47413]
- ve/fairsched: Resurrect proc fairsched files (Vladimir Davydov) [PSBM-48824]
- ve/binfmt_misc: Allow mount if capable(CAP_SYS_ADMIN) (Kirill Tkhai) 
[PSBM-47737]


Built packages: 
http://kojistorage.eng.sw.ru/packages/vzkernel/3.10.0/327.18.2.vz7.14.20/
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


Re: [Devel] [PATCH rh7 0/9] ploop: fix barriers for reloc requests

2016-06-24 Thread Dmitry Monakhov
Maxim Patlasov  writes:

> The series firstly fixes a few issues in handling
> barriers in ordinary requests (what was overlooked
> in previous patch -- see commit c2247f3745).
>
> Then there are a few minor rework w/o functional
> changes that alleviate main patches (last two ones).
>
> And finally the series fixes handling barriers
> for RELOC_A|S requests.
>
> The main complexity comes from the following bug:
> for direct_io it's not enough to send FUA to flush
> all nullified cluster block. See details in
> "fix barriers for PLOOP_E_RELOC_NULLIFY" patch.
>
Ok. Max I can not fully agree the way you orginize fix for RELOC bug
(especially for kaio). But it does all major things
1) Removes _FORCE_XXX crap
2) Cleanup barrier stuff
3) Fix RELOC_XXX code flow.

Let's keep style things aside for now, and commit that fix.
So ACK whole series. And let optimize/fix sylistic stuff leter.
> ---
>
> Dmitry Monakhov (3):
>   ploop: deadcode cleanup
>   ploop: minor rework of ->write_page() io method
>   ploop: generalize issue_flush
>
> Maxim Patlasov (6):
>   ploop: minor rework of ploop_req_delay_fua_possible
>   ploop: resurrect delayed_fua for io_kaio
>   ploop: resurrect delay_fua for io_direct
>   ploop: remove preflush from dio_submit
>   ploop: fix barriers for PLOOP_E_RELOC_NULLIFY
>   ploop: fixup barrier handling during relocation
>
>
>  drivers/block/ploop/dev.c   |   16 ++--
>  drivers/block/ploop/io_direct.c |   48 -
>  drivers/block/ploop/io_kaio.c   |   26 ++--
>  drivers/block/ploop/map.c   |   50 
> ---
>  include/linux/ploop/ploop.h |   20 +++-
>  5 files changed, 71 insertions(+), 89 deletions(-)
>
> --
> Signature


signature.asc
Description: PGP signature
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


Re: [Devel] [PATCH rh7 6/9] ploop: remove preflush from dio_submit

2016-06-24 Thread Dmitry Monakhov
Maxim Patlasov  writes:

> After commit c2247f3745 fixing barriers for ordinary
> requests and previous patch fixing delay_fua,
> that legacy code in dio_submit processing
> (preq->req_rw & REQ_FLUSH) by setting REQ_FLUSH in
> the first outgoing bio must die: it is incorrect
> anyway (we don't wait for completion of the first
> bio before sending others).
Wow. This is so true. BTW: Reasonable way to handle FLUSH
is to queue such preq to preflush_queue similar to fsync_queue for
fsync_thread infrastructure

>
> Signed-off-by: Maxim Patlasov 
> ---
>  drivers/block/ploop/io_direct.c |7 ---
>  1 file changed, 7 deletions(-)
>
> diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
> index 1ea2008..ee3cd5c 100644
> --- a/drivers/block/ploop/io_direct.c
> +++ b/drivers/block/ploop/io_direct.c
> @@ -89,15 +89,12 @@ dio_submit(struct ploop_io *io, struct ploop_request * 
> preq,
>   sector_t sec, nsec;
>   int err;
>   struct bio_list_walk bw;
> - int preflush;
>   int postfua = 0;
>   int write = !!(rw & REQ_WRITE);
>   int delayed_fua = 0;
>  
>   trace_submit(preq);
>  
> - preflush = !!(rw & REQ_FLUSH);
> -
>   if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state))
>   postfua = 1;
>  
> @@ -236,10 +233,6 @@ flush_bio:
>   b->bi_private = preq;
>   b->bi_end_io = dio_endio_async;
>  
> - if (unlikely(preflush)) {
> - rw2 |= REQ_FLUSH;
> - preflush = 0;
> - }
>   if (unlikely(postfua && !bl.head))
>   rw2 |= REQ_FUA;
>  


signature.asc
Description: PGP signature
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


Re: [Devel] [PATCH rh7 9/9] ploop: fixup barrier handling during relocation

2016-06-24 Thread Dmitry Monakhov
Maxim Patlasov  writes:

> Rebase Dima's patch on top of rh7-3.10.0-327.18.2.vz7.14.19,
> but without help of delayed_flush engine:
>
> To ensure consistency on crash/power outage/hard reboot
> events, ploop must implement the following barrier logic
> for RELOC_A|S requests:
>
> 1) After we store data to new place, but before updating
> BAT on disk, we have FLUSH everything (in fact, flushing
> those data would be enough, but it is simplier to flush
> everything).
>
> 2) We should not proceed handling RELOC_A|S until we
> 100% sure new BAT value went to disk platters. So far as
> new BAT is only one page, it's OK to mark corresponding
> bio with FUA flag for io_direct case. For io_kaio, not
> having FUA api, we have to post_fsync BAT update.
>
> PLOOP_REQ_FORCE_FLUSH/PLOOP_REQ_FORCE_FUA introduced
> long time ago probably were intended to ensure the
> logic above, but they actually didn't.
>
> The patch removes PLOOP_REQ_FORCE_FLUSH/PLOOP_REQ_FORCE_FUA,
> and implements barriers in a straightforward and simple way:
> check for RELOC_A|S explicitly and make FLUSH/FUA where
> needed.
>
> Signed-off-by: Maxim Patlasov 
> ---
>  drivers/block/ploop/dev.c   |4 ++--
>  drivers/block/ploop/io_direct.c |7 ---
>  drivers/block/ploop/io_kaio.c   |8 +---
>  drivers/block/ploop/map.c   |   22 ++
>  include/linux/ploop/ploop.h |1 -
>  5 files changed, 17 insertions(+), 25 deletions(-)
>
> diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
> index 2b60dfa..40768b6 100644
> --- a/drivers/block/ploop/dev.c
> +++ b/drivers/block/ploop/dev.c
> @@ -2610,8 +2610,8 @@ restart:
>   top_delta = ploop_top_delta(plo);
>   sbl.head = sbl.tail = preq->aux_bio;
>  
> - /* Relocated data write required sync before BAT updatee */
> - set_bit(PLOOP_REQ_FORCE_FUA, &preq->state);
> + /* Relocated data write required sync before BAT update
> +  * this will happen inside index_update */
>  
>   if (test_bit(PLOOP_REQ_RELOC_S, &preq->state)) {
>   preq->eng_state = PLOOP_E_DATA_WBI;
> diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
> index c4d0f63..266f041 100644
> --- a/drivers/block/ploop/io_direct.c
> +++ b/drivers/block/ploop/io_direct.c
> @@ -89,15 +89,11 @@ dio_submit(struct ploop_io *io, struct ploop_request * 
> preq,
>   sector_t sec, nsec;
>   int err;
>   struct bio_list_walk bw;
> - int postfua = 0;
>   int write = !!(rw & REQ_WRITE);
>   int delayed_fua = 0;
>  
>   trace_submit(preq);
>  
> - if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state))
> - postfua = 1;
> -
>   if ((rw & REQ_FUA) && ploop_req_delay_fua_possible(preq)) {
>   /* Mark req that delayed flush required */
>   preq->req_rw |= (REQ_FLUSH | REQ_FUA);
> @@ -233,9 +229,6 @@ flush_bio:
>   b->bi_private = preq;
>   b->bi_end_io = dio_endio_async;
>  
> - if (unlikely(postfua && !bl.head))
> - rw2 |= REQ_FUA;
> -
>   ploop_acc_ff_out(preq->plo, rw2 | b->bi_rw);
>   submit_bio(rw2, b);
>   }
> diff --git a/drivers/block/ploop/io_kaio.c b/drivers/block/ploop/io_kaio.c
> index ed550f4..85863df 100644
> --- a/drivers/block/ploop/io_kaio.c
> +++ b/drivers/block/ploop/io_kaio.c
> @@ -69,6 +69,8 @@ static void kaio_complete_io_state(struct ploop_request * 
> preq)
>   unsigned long flags;
>   int post_fsync = 0;
>   int need_fua = !!(preq->req_rw & REQ_FUA);
> + unsigned long state = READ_ONCE(preq->state);
> + int reloc = !!(state & (PLOOP_REQ_RELOC_A_FL|PLOOP_REQ_RELOC_S_FL));
>  
>   if (preq->error || !(preq->req_rw & REQ_FUA) ||
>   preq->eng_state == PLOOP_E_INDEX_READ ||
> @@ -80,9 +82,9 @@ static void kaio_complete_io_state(struct ploop_request * 
> preq)
>   }
>  
>   /* Convert requested fua to fsync */
> - if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state) ||
> - test_and_clear_bit(PLOOP_REQ_KAIO_FSYNC, &preq->state) ||
> - (need_fua && !ploop_req_delay_fua_possible(preq))) {
This is the change I dislike the most. io_XXX should not care it is
reloc or not. Caller should rule whenether PREFLUSH/POSTFLUSH should
happen before preq completes. So IMHO this is a crunch, but correct one.

> + if (test_and_clear_bit(PLOOP_REQ_KAIO_FSYNC, &preq->state) ||
> + (need_fua && !ploop_req_delay_fua_possible(preq)) ||
> + (reloc && ploop_req_delay_fua_possible(preq))) {
>   post_fsync = 1;
>   preq->req_rw &= ~REQ_FUA;
>   }
> diff --git a/drivers/block/ploop/map.c b/drivers/block/ploop/map.c
> index 915a216..1883674 100644
> --- a/drivers/block/ploop/map.c
> +++ b/drivers/block/ploop/map.c
> @@ -909,6 +909,7 @@ void ploop_index_update(struct ploop_request * preq)
>   struct page * page;
>   s

[Devel] [PATCH libvzctl] scripts: Ask to increase verbosity in case of error

2016-06-24 Thread Cyrill Gorcunov
With nonverbose checkpoint/resume it's hard to figure
out what is gone wrong. So ask an admin to increase
verbosity.

Signed-off-by: Cyrill Gorcunov 
---
 scripts/vz-cpt.in | 3 +++
 scripts/vz-rst.in | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/scripts/vz-cpt.in b/scripts/vz-cpt.in
index e44734d..ca35f6e 100755
--- a/scripts/vz-cpt.in
+++ b/scripts/vz-cpt.in
@@ -111,6 +111,9 @@ if [ $? -ne 0 ]; then
 mv -f $dumpdir $VE_DUMP_DIR.fail
 echo Failed to checkpoint the Container
 echo All dump files and logs were saved to $VE_DUMP_DIR.fail
+   if [ "$CRIU_LOGLEVEL" -lt "4" ]; then
+   echo "Please consider running checkpoint/suspend with --verbose 
option"
+   fi
 exit 1
 else
mv $dumpdir $VE_DUMP_DIR
diff --git a/scripts/vz-rst.in b/scripts/vz-rst.in
index dbf1cad..1e96de7 100755
--- a/scripts/vz-rst.in
+++ b/scripts/vz-rst.in
@@ -129,5 +129,8 @@ if [ $? -eq 0 ]; then
echo Ok
 else
echo The restore log was saved in $VE_WORK_DIR/$VE_RESTORE_LOG_PATH
+   if [ "$CRIU_LOGLEVEL" -lt "4" ]; then
+   echo "Please consider running restore/resume with --verbose 
option"
+   fi
exit 1
 fi
-- 
2.5.5

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


Re: [Devel] [PATCH rh7 6/9] ploop: remove preflush from dio_submit

2016-06-24 Thread Maxim Patlasov

On 06/24/2016 07:42 AM, Dmitry Monakhov wrote:

Maxim Patlasov  writes:


After commit c2247f3745 fixing barriers for ordinary
requests and previous patch fixing delay_fua,
that legacy code in dio_submit processing
(preq->req_rw & REQ_FLUSH) by setting REQ_FLUSH in
the first outgoing bio must die: it is incorrect
anyway (we don't wait for completion of the first
bio before sending others).

Wow. This is so true. BTW: Reasonable way to handle FLUSH
is to queue such preq to preflush_queue similar to fsync_queue for
fsync_thread infrastructure


This would add another WAIT. Sometimes it may be beneficial (many 
incoming bio-s marked as REQ_FLUSH), sometimes not (only one bio with 
REQ_FLUSH -- so we'll mark only one of outgoing bio-s with REQ_FLUSH). 
Who knows how often we have more than one REQ_FLUSH in queue...






Signed-off-by: Maxim Patlasov 
---
  drivers/block/ploop/io_direct.c |7 ---
  1 file changed, 7 deletions(-)

diff --git a/drivers/block/ploop/io_direct.c b/drivers/block/ploop/io_direct.c
index 1ea2008..ee3cd5c 100644
--- a/drivers/block/ploop/io_direct.c
+++ b/drivers/block/ploop/io_direct.c
@@ -89,15 +89,12 @@ dio_submit(struct ploop_io *io, struct ploop_request * preq,
sector_t sec, nsec;
int err;
struct bio_list_walk bw;
-   int preflush;
int postfua = 0;
int write = !!(rw & REQ_WRITE);
int delayed_fua = 0;
  
  	trace_submit(preq);
  
-	preflush = !!(rw & REQ_FLUSH);

-
if (test_and_clear_bit(PLOOP_REQ_FORCE_FUA, &preq->state))
postfua = 1;
  
@@ -236,10 +233,6 @@ flush_bio:

b->bi_private = preq;
b->bi_end_io = dio_endio_async;
  
-		if (unlikely(preflush)) {

-   rw2 |= REQ_FLUSH;
-   preflush = 0;
-   }
if (unlikely(postfua && !bl.head))
rw2 |= REQ_FUA;
  


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