[Devel] [PATCH rh7] ploop: io_direct: delay f_op->fsync() until FLUSH|FUA (v2)

2016-05-26 Thread Maxim Patlasov
Once we converted extent to initialized it can be part of uncompleted
journal transaction, so we have to force transaction commit at some point.

Instead of forcing transaction commit immediately, the patch delays it
until an incoming bio with FLUSH|FUA arrives. Then, as the very first
step of processing such a bio, we sends corresponding preq to fsync_thread
to perform f_op->fsync().

As a very unlikely case, it is also possible that processing a FLUSH|FUA
bio itself results in converting extents. Then, the patch calls f_op->fsync()
immediately after conversion to preserve FUA semantics.

Changed in v2 (thanks to dmonakhov@):
- simplified bitwise arithmetic in  preq_is_special() helper;
- reject fastmap for REQ_FUA bio-s if PLOOP_IO_FSYNC_DELAYED.

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

Signed-off-by: Maxim Patlasov 
---
 drivers/block/ploop/dev.c   |   72 ---
 drivers/block/ploop/io_direct.c |   28 +++
 include/linux/ploop/ploop.h |   12 +++
 3 files changed, 84 insertions(+), 28 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 654b60b..861ce86 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -1942,46 +1942,64 @@ err:
 
 /* Main preq state machine */
 
+static inline bool preq_is_special(struct ploop_request * preq)
+{
+   unsigned long state = READ_ONCE(preq->state);
+
+   return state & (PLOOP_REQ_MERGE_FL |
+   PLOOP_REQ_RELOC_A_FL |
+   PLOOP_REQ_RELOC_S_FL |
+   PLOOP_REQ_DISCARD_FL |
+   PLOOP_REQ_ZERO_FL);
+}
+
 static void
 ploop_entry_request(struct ploop_request * preq)
 {
struct ploop_device * plo   = preq->plo;
struct ploop_delta  * top_delta = ploop_top_delta(plo);
+   struct ploop_io * top_io= &top_delta->io;
struct ploop_delta  * delta;
int level;
int err;
iblock_t iblk;
 
-   /* Control request. */
-   if (unlikely(preq->bl.head == NULL &&
-!test_bit(PLOOP_REQ_MERGE, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_A, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_S, &preq->state) &&
-!test_bit(PLOOP_REQ_DISCARD, &preq->state) &&
-!test_bit(PLOOP_REQ_ZERO, &preq->state))) {
-   complete(plo->quiesce_comp);
-   wait_for_completion(&plo->relax_comp);
-   ploop_complete_request(preq);
-   complete(&plo->relaxed_comp);
-   return;
-   }
+   if (!preq_is_special(preq)) {
+   /* Control request */
+   if (unlikely(preq->bl.head == NULL)) {
+   complete(plo->quiesce_comp);
+   wait_for_completion(&plo->relax_comp);
+   ploop_complete_request(preq);
+   complete(&plo->relaxed_comp);
+   return;
+   }
 
-   /* Empty flush. */
-   if (unlikely(preq->req_size == 0 &&
-!test_bit(PLOOP_REQ_MERGE, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_A, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_S, &preq->state) &&
-!test_bit(PLOOP_REQ_ZERO, &preq->state))) {
-   if (preq->req_rw & REQ_FLUSH) {
-   if (top_delta->io.ops->issue_flush) {
-   top_delta->io.ops->issue_flush(&top_delta->io, 
preq);
-   return;
-   }
+   /* Need to fsync before start handling FLUSH */
+   if ((preq->req_rw & REQ_FLUSH) &&
+   test_bit(PLOOP_IO_FSYNC_DELAYED, &top_io->io_state) &&
+   !test_bit(PLOOP_REQ_FSYNC_DONE, &preq->state)) {
+   spin_lock_irq(&plo->lock);
+   list_add_tail(&preq->list, &top_io->fsync_queue);
+   if (waitqueue_active(&top_io->fsync_waitq))
+   wake_up_interruptible(&top_io->fsync_waitq);
+   spin_unlock_irq(&plo->lock);
+   return;
}
 
-   preq->eng_state = PLOOP_E_COMPLETE;
-   ploop_complete_request(preq);
-   return;
+   /* Empty flush or unknown zero-size request */
+   if (preq->req_size == 0) {
+   if (preq->req_rw & REQ_FLUSH &&
+   !test_bit(PLOOP_REQ_FSYNC_DONE, &preq->state)) {
+   if (top_io->ops->issue_flush) {
+   top_io->ops->issue_flush(top_io, preq);
+   return;
+   }
+   }
+
+   preq->eng_state = PLOOP_E_COMPLETE;
+   ploop_complete_requ

Re: [Devel] [PATCH rh7] ploop: io_direct: delay f_op->fsync() until FLUSH|FUA

2016-05-26 Thread Maxim Patlasov

On 05/26/2016 07:58 AM, Dmitry Monakhov wrote:

Maxim Patlasov  writes:


Once we converted extent to initialized it can be part of uncompleted
journal transaction, so we have to force transaction commit at some point.

Instead of forcing transaction commit immediately, the patch delays it
until an incoming bio with FLUSH|FUA arrives. Then, as the very first
step of processing such a bio, we sends corresponding preq to fsync_thread
to perform f_op->fsync().

As a very unlikely case, it is also possible that processing a FLUSH|FUA
bio itself results in converting extents. Then, the patch calls f_op->fsync()
immediately after conversion to preserve FUA semantics.

ACK. With minor comments. See below:


Thank you for thoughtful review, Dima!


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

Signed-off-by: Maxim Patlasov 
---
  drivers/block/ploop/dev.c   |   70 ---
  drivers/block/ploop/io_direct.c |   28 +++-
  include/linux/ploop/ploop.h |6 +++
  3 files changed, 76 insertions(+), 28 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index 654b60b..03fc289 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -1942,46 +1942,62 @@ err:
  
  /* Main preq state machine */
  
+static inline bool preq_is_special(struct ploop_request * preq)

+{
+   return test_bit(PLOOP_REQ_MERGE, &preq->state) ||
+   test_bit(PLOOP_REQ_RELOC_A, &preq->state) ||
+   test_bit(PLOOP_REQ_RELOC_S, &preq->state) ||
+   test_bit(PLOOP_REQ_DISCARD, &preq->state) ||
+   test_bit(PLOOP_REQ_ZERO, &preq->state);

Oh. It looks awful. Please use one atomic read here and other places.
#define PLOOP_REQ_RELOC_A_FL (1 << PLOOP_REQ_RELOC_A)
#define PLOOP_REQ_RELOC_S_FL (1 << PLOOP_REQ_RELOC_S)

unsigned long state = READ_ONCE(preq->state);
...
 if (state & (PLOOP_REQ_RELOC_A_FL|PLOOP_REQ_RELOC_B_FL) ...


OK. I'll fix this place in v2 of the patch and other places later in a 
separate "clean-up" patch.



+}
+
  static void
  ploop_entry_request(struct ploop_request * preq)
  {
struct ploop_device * plo   = preq->plo;
struct ploop_delta  * top_delta = ploop_top_delta(plo);
+   struct ploop_io * top_io= &top_delta->io;
struct ploop_delta  * delta;
int level;
int err;
iblock_t iblk;
  
-	/* Control request. */

-   if (unlikely(preq->bl.head == NULL &&
-!test_bit(PLOOP_REQ_MERGE, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_A, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_S, &preq->state) &&
-!test_bit(PLOOP_REQ_DISCARD, &preq->state) &&
-!test_bit(PLOOP_REQ_ZERO, &preq->state))) {
-   complete(plo->quiesce_comp);
-   wait_for_completion(&plo->relax_comp);
-   ploop_complete_request(preq);
-   complete(&plo->relaxed_comp);
-   return;
-   }
+   if (!preq_is_special(preq)) {
+   /* Control request */
+   if (unlikely(preq->bl.head == NULL)) {
+   complete(plo->quiesce_comp);
+   wait_for_completion(&plo->relax_comp);
+   ploop_complete_request(preq);
+   complete(&plo->relaxed_comp);
+   return;
+   }
  
-	/* Empty flush. */

-   if (unlikely(preq->req_size == 0 &&
-!test_bit(PLOOP_REQ_MERGE, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_A, &preq->state) &&
-!test_bit(PLOOP_REQ_RELOC_S, &preq->state) &&
-!test_bit(PLOOP_REQ_ZERO, &preq->state))) {
-   if (preq->req_rw & REQ_FLUSH) {
-   if (top_delta->io.ops->issue_flush) {
-   top_delta->io.ops->issue_flush(&top_delta->io, 
preq);
-   return;
-   }
+   /* Need to fsync before start handling FLUSH */
+   if ((preq->req_rw & REQ_FLUSH) &&
+   test_bit(PLOOP_IO_FSYNC_DELAYED, &top_io->io_state) &&
+   !test_bit(PLOOP_REQ_FSYNC_DONE, &preq->state)) {
+   spin_lock_irq(&plo->lock);
+   list_add_tail(&preq->list, &top_io->fsync_queue);
+   if (waitqueue_active(&top_io->fsync_waitq))
+   wake_up_interruptible(&top_io->fsync_waitq);
+   spin_unlock_irq(&plo->lock);
+   return;
}
  
-		preq->eng_state = PLOOP_E_COMPLETE;

-   ploop_complete_request(preq);
-   return;
+   /* Empty flush or unknown zero-size request */

Do you know any zero size requests instead of FLUSH?


No. The comment only tells explicitly what always existed in ploop: 
simply ignore such requests (if t

Re: [Devel] [PATCH rh7] ploop: io_direct: delay f_op->fsync() until FLUSH|FUA

2016-05-26 Thread Dmitry Monakhov
Maxim Patlasov  writes:

> Once we converted extent to initialized it can be part of uncompleted
> journal transaction, so we have to force transaction commit at some point.
>
> Instead of forcing transaction commit immediately, the patch delays it
> until an incoming bio with FLUSH|FUA arrives. Then, as the very first
> step of processing such a bio, we sends corresponding preq to fsync_thread
> to perform f_op->fsync().
>
> As a very unlikely case, it is also possible that processing a FLUSH|FUA
> bio itself results in converting extents. Then, the patch calls f_op->fsync()
> immediately after conversion to preserve FUA semantics.
ACK. With minor comments. See below:
>
> https://jira.sw.ru/browse/PSBM-47026
>
> Signed-off-by: Maxim Patlasov 
> ---
>  drivers/block/ploop/dev.c   |   70 
> ---
>  drivers/block/ploop/io_direct.c |   28 +++-
>  include/linux/ploop/ploop.h |6 +++
>  3 files changed, 76 insertions(+), 28 deletions(-)
>
> diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
> index 654b60b..03fc289 100644
> --- a/drivers/block/ploop/dev.c
> +++ b/drivers/block/ploop/dev.c
> @@ -1942,46 +1942,62 @@ err:
>  
>  /* Main preq state machine */
>  
> +static inline bool preq_is_special(struct ploop_request * preq)
> +{
> + return test_bit(PLOOP_REQ_MERGE, &preq->state) ||
> + test_bit(PLOOP_REQ_RELOC_A, &preq->state) ||
> + test_bit(PLOOP_REQ_RELOC_S, &preq->state) ||
> + test_bit(PLOOP_REQ_DISCARD, &preq->state) ||
> + test_bit(PLOOP_REQ_ZERO, &preq->state);
Oh. It looks awful. Please use one atomic read here and other places.
#define PLOOP_REQ_RELOC_A_FL (1 << PLOOP_REQ_RELOC_A)
#define PLOOP_REQ_RELOC_S_FL (1 << PLOOP_REQ_RELOC_S)

unsigned long state = READ_ONCE(preq->state);
...
if (state & (PLOOP_REQ_RELOC_A_FL|PLOOP_REQ_RELOC_B_FL) ...
> +}
> +
>  static void
>  ploop_entry_request(struct ploop_request * preq)
>  {
>   struct ploop_device * plo   = preq->plo;
>   struct ploop_delta  * top_delta = ploop_top_delta(plo);
> + struct ploop_io * top_io= &top_delta->io;
>   struct ploop_delta  * delta;
>   int level;
>   int err;
>   iblock_t iblk;
>  
> - /* Control request. */
> - if (unlikely(preq->bl.head == NULL &&
> -  !test_bit(PLOOP_REQ_MERGE, &preq->state) &&
> -  !test_bit(PLOOP_REQ_RELOC_A, &preq->state) &&
> -  !test_bit(PLOOP_REQ_RELOC_S, &preq->state) &&
> -  !test_bit(PLOOP_REQ_DISCARD, &preq->state) &&
> -  !test_bit(PLOOP_REQ_ZERO, &preq->state))) {
> - complete(plo->quiesce_comp);
> - wait_for_completion(&plo->relax_comp);
> - ploop_complete_request(preq);
> - complete(&plo->relaxed_comp);
> - return;
> - }
> + if (!preq_is_special(preq)) {
> + /* Control request */
> + if (unlikely(preq->bl.head == NULL)) {
> + complete(plo->quiesce_comp);
> + wait_for_completion(&plo->relax_comp);
> + ploop_complete_request(preq);
> + complete(&plo->relaxed_comp);
> + return;
> + }
>  
> - /* Empty flush. */
> - if (unlikely(preq->req_size == 0 &&
> -  !test_bit(PLOOP_REQ_MERGE, &preq->state) &&
> -  !test_bit(PLOOP_REQ_RELOC_A, &preq->state) &&
> -  !test_bit(PLOOP_REQ_RELOC_S, &preq->state) &&
> -  !test_bit(PLOOP_REQ_ZERO, &preq->state))) {
> - if (preq->req_rw & REQ_FLUSH) {
> - if (top_delta->io.ops->issue_flush) {
> - top_delta->io.ops->issue_flush(&top_delta->io, 
> preq);
> - return;
> - }
> + /* Need to fsync before start handling FLUSH */
> + if ((preq->req_rw & REQ_FLUSH) &&
> + test_bit(PLOOP_IO_FSYNC_DELAYED, &top_io->io_state) &&
> + !test_bit(PLOOP_REQ_FSYNC_DONE, &preq->state)) {
> + spin_lock_irq(&plo->lock);
> + list_add_tail(&preq->list, &top_io->fsync_queue);
> + if (waitqueue_active(&top_io->fsync_waitq))
> + wake_up_interruptible(&top_io->fsync_waitq);
> + spin_unlock_irq(&plo->lock);
> + return;
>   }
>  
> - preq->eng_state = PLOOP_E_COMPLETE;
> - ploop_complete_request(preq);
> - return;
> + /* Empty flush or unknown zero-size request */
Do you know any zero size requests instead of FLUSH?
> + if (preq->req_size == 0) {
> + if (preq->req_rw & REQ_FLUSH &&
> + !test_bit(PLOOP_REQ_FSYNC_DONE, &preq->state)) {

> + if (top_i

[Devel] [PATCH RHEL7 COMMIT] ms/kvm:vmx: more complete state update on APICv on/off

2016-05-26 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.8
-->
commit c3b41fa251547cfe278f19a62f2241f15378aa82
Author: Roman Kagan 
Date:   Thu May 26 18:42:20 2016 +0400

ms/kvm:vmx: more complete state update on APICv on/off

The function to update APICv on/off state (in particular, to deactivate
it when enabling Hyper-V SynIC) is incomplete: it doesn't adjust
APICv-related fields among secondary processor-based VM-execution
controls.  As a result, Windows 2012 guests get stuck when SynIC-based
auto-EOI interrupt intersected with e.g. an IPI in the guest.

In addition, the MSR intercept bitmap isn't updated every time "virtualize
x2APIC mode" is toggled.  This path can only be triggered by a malicious
guest, because Windows didn't use x2APIC but rather their own synthetic
APIC access MSRs; however a guest running in a SynIC-enabled VM could
switch to x2APIC and thus obtain direct access to host APIC MSRs
(CVE-2016-4440).

The patch fixes those omissions.

Signed-off-by: Roman Kagan 
Reported-by: Steve Rutherford 
Reported-by: Yang Zhang 
Signed-off-by: Paolo Bonzini 
(cherry picked from commit 3ce424e45411cf5a13105e0386b6ecf6eeb4f66f)

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

Signed-off-by: Roman Kagan 
---
 arch/x86/kvm/vmx.c | 48 ++--
 1 file changed, 30 insertions(+), 18 deletions(-)

diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index 06ae2d3..aecf056 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -2100,7 +2100,9 @@ static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu)
 {
unsigned long *msr_bitmap;
 
-   if (irqchip_in_kernel(vcpu->kvm) && apic_x2apic_mode(vcpu->arch.apic)) {
+   if (cpu_has_secondary_exec_ctrls() &&
+(vmcs_read32(SECONDARY_VM_EXEC_CONTROL) &
+ SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE)) {
if (is_long_mode(vcpu))
msr_bitmap = vmx_msr_bitmap_longmode_x2apic;
else
@@ -4276,6 +4278,19 @@ static void vmx_refresh_apicv_exec_ctrl(struct kvm_vcpu 
*vcpu)
struct vcpu_vmx *vmx = to_vmx(vcpu);
 
vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, vmx_pin_based_exec_ctrl(vmx));
+   if (cpu_has_secondary_exec_ctrls()) {
+   if (kvm_vcpu_apicv_active(vcpu))
+   vmcs_set_bits(SECONDARY_VM_EXEC_CONTROL,
+ SECONDARY_EXEC_APIC_REGISTER_VIRT |
+ SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);
+   else
+   vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL,
+   SECONDARY_EXEC_APIC_REGISTER_VIRT |
+   SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY);
+   }
+
+   if (cpu_has_vmx_msr_bitmap())
+   vmx_set_msr_bitmap(vcpu);
 }
 
 static u32 vmx_exec_control(struct vcpu_vmx *vmx)
@@ -5859,23 +5874,20 @@ static __init int hardware_setup(void)
memcpy(vmx_msr_bitmap_longmode_x2apic,
vmx_msr_bitmap_longmode, PAGE_SIZE);
 
-   if (enable_apicv) {
-   for (msr = 0x800; msr <= 0x8ff; msr++)
-   vmx_disable_intercept_msr_read_x2apic(msr);
-
-   /* According SDM, in x2apic mode, the whole id reg is used.
-* But in KVM, it only use the highest eight bits. Need to
-* intercept it */
-   vmx_enable_intercept_msr_read_x2apic(0x802);
-   /* TMCCT */
-   vmx_enable_intercept_msr_read_x2apic(0x839);
-   /* TPR */
-   vmx_disable_intercept_msr_write_x2apic(0x808);
-   /* EOI */
-   vmx_disable_intercept_msr_write_x2apic(0x80b);
-   /* SELF-IPI */
-   vmx_disable_intercept_msr_write_x2apic(0x83f);
-   }
+   for (msr = 0x800; msr <= 0x8ff; msr++)
+   vmx_disable_intercept_msr_read_x2apic(msr);
+
+   /* According SDM, in x2apic mode, the whole id reg is used.  But in
+* KVM, it only use the highest eight bits. Need to intercept it */
+   vmx_enable_intercept_msr_read_x2apic(0x802);
+   /* TMCCT */
+   vmx_enable_intercept_msr_read_x2apic(0x839);
+   /* TPR */
+   vmx_disable_intercept_msr_write_x2apic(0x808);
+   /* EOI */
+   vmx_disable_intercept_msr_write_x2apic(0x80b);
+   /* SELF-IPI */
+   vmx_disable_intercept_msr_write_x2apic(0x83f);
 
if (enable_ept) {
kvm_mmu_set_mask_ptes(0ull,
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH RHEL7 COMMIT] pfcache: pick page from peer mapping after readahead

2016-05-26 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.8
-->
commit 703ec96aa535fb1c9f15b5c9a2df3765e16e8711
Author: Vladimir Davydov 
Date:   Thu May 26 18:38:28 2016 +0400

pfcache: pick page from peer mapping after readahead

There's a mistake in pick_peer_page. This function is called before
issuing read from pagefault and file read paths, in order to retrieve
the page from peer's mapping and thus save us io and page cache. In this
function we first lookup the page in the peer's mapping. If it fails, we
start readahead for the peer's mapping. Then we should retry lookup from
peer's mapping to get page allocated by the readahead, but instead we do
lookup from the original mapping, which obviously fails as we only call
pick_peer_page if there's no page in original mapping's cache. So we
fall back on reading a page for the original mapping instead of using
pages from pfcache.

Found in the scope of https://jira.sw.ru/browse/PSBM-47541

Signed-off-by: Vladimir Davydov 
---
 mm/memory.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/memory.c b/mm/memory.c
index 7ba5f6f..c3a3655 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -4697,7 +4697,7 @@ struct page *pick_peer_page(struct address_space 
*mapping, pgoff_t index,
page = find_get_page(peer, index);
if (!page) {
page_cache_sync_readahead(peer, ra, file, index, ra_size);
-   page = find_get_page(mapping, index);
+   page = find_get_page(peer, index);
if (!page)
goto out;
}
___
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel


[Devel] [PATCH -E] scripts: add dump files save script

2016-05-26 Thread Stanislav Kinsburskiy
This script can be added to vz-rst as action script and will save dump.log and
restore.log in format:

   dump--.tgz

in /vz/private//dump directory.

Signed-off-by: Stanislav Kinsburskiy 
---
 scripts/vz-save-dump.sh |   10 ++
 1 file changed, 10 insertions(+)
 create mode 100755 scripts/vz-save-dump.sh

diff --git a/scripts/vz-save-dump.sh b/scripts/vz-save-dump.sh
new file mode 100755
index 000..830629c
--- /dev/null
+++ b/scripts/vz-save-dump.sh
@@ -0,0 +1,10 @@
+#!/bin/bash
+
+[[ "post-resume" == "$CRTOOLS_SCRIPT_ACTION" ]] || exit 0
+
+set -o pipefail
+
+dir="/vz/private/$VEID/dump"
+suffix=$(date +%F-%T)
+
+tar -C ${dir}/Dump/ -czf ${dir}/dump-$suffix.tgz dump.log restore.log > 
/dev/null

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


[Devel] [PATCH v2] scripts: add /usr/libexec/criu/scripts/spfs-release-replace.sh to vz-rst

2016-05-26 Thread Stanislav Kinsburskiy
Add one more spfs-related restore script (this time for "post-restore" stage),
which is required to release spfs manager replace processes (they are waiting
for it to proceed with actual remount and replacement).

v2:
Use for loop over scripts

Signed-off-by: Stanislav Kinsburskiy 
---
 scripts/vz-rst.in |9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/scripts/vz-rst.in b/scripts/vz-rst.in
index 654cdd3..bfff71a 100755
--- a/scripts/vz-rst.in
+++ b/scripts/vz-rst.in
@@ -78,10 +78,11 @@ if [ -f "$autofs_actions_path" ]; then
 fi
 
 # SPFS actions
-spfs_actions_path=/usr/libexec/criu/scripts/spfs-change-mode.sh
-if [ -f "$spfs_actions_path" ]; then
-   spfs_actions="--action-script $spfs_actions_path"
-fi
+spfs_scripts="/usr/libexec/criu/scripts/spfs-change-mode.sh\
+   /usr/libexec/criu/scripts/spfs-release-replace.sh"
+for script in $spfs_scripts; do
+   [ -f "$script" ] && spfs_actions=$spfs_actions"--action-script $script "
+done
 
 criu restore -v$CRIU_LOGLEVEL  \
--file-locks\

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


Re: [Devel] [PATCH] scripts: add /usr/libexec/criu/scripts/spfs-release-replace.sh to vz-rst

2016-05-26 Thread Igor Sukhih

On 05/25/2016 07:18 PM, Stanislav Kinsburskiy wrote:

Add one more spfs-related restore script (this time for "post-restore" stage),
which is required to release spfs manager replace processes (they are waiting
for it to proceed with actual remount and replacement).

Signed-off-by: Stanislav Kinsburskiy 
---
  scripts/vz-rst.in |   11 ---
  1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/scripts/vz-rst.in b/scripts/vz-rst.in
index 654cdd3..bfd804a 100755
--- a/scripts/vz-rst.in
+++ b/scripts/vz-rst.in
@@ -78,9 +78,14 @@ if [ -f "$autofs_actions_path" ]; then
  fi
  
  # SPFS actions

-spfs_actions_path=/usr/libexec/criu/scripts/spfs-change-mode.sh
-if [ -f "$spfs_actions_path" ]; then
-   spfs_actions="--action-script $spfs_actions_path"
+spfs_actions=""
+spfs_change_mode=/usr/libexec/criu/scripts/spfs-change-mode.sh
+if [ -f "$spfs_change_mode" ]; then
+   spfs_actions="--action-script $spfs_change_mode"
+fi
+spfs_release_replace=/usr/libexec/criu/scripts/spfs-release-replace.sh
+if [ -f "$spfs_release_replace" ]; then
+   spfs_actions="$spfs_actions --action-script $spfs_release_replace"
  fi
  


Pls redo to use 'for s in $spf_scripts; do'

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