[Devel] [PATCH vz7] fuse: fuse_prepare_write() should not wait on fuse-writeback
The patch fixes a silly mistake: when fuse_prepare_write() calls __fuse_readpage(), the latter will do fuse_wait_on_page_writeback_or_invalidate anyway, so explicit fuse_wait_on_page_writeback is redundant. That silly mistake resulted in deadlock because, fuse_prepare_write used fuse_wait_on_page_writeback instead od smarter fuse_wait_on_page_writeback_or_invalidate. https://jira.sw.ru/browse/PSBM-56474 Signed-off-by: Maxim Patlasov--- fs/fuse/file.c |7 --- 1 file changed, 7 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index e5c4778..4fcf4f4 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2280,13 +2280,6 @@ static int fuse_prepare_write(struct fuse_conn *fc, struct file *file, return 0; } - /* -* Page writeback can extend beyond the liftime of the -* page-cache page, so make sure we read a properly synced -* page. -*/ - fuse_wait_on_page_writeback(page->mapping->host, page->index); - num_read = __fuse_readpage(file, page, page_len, , , NULL, NULL); if (req) ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH RH7] vfs: add warning in guard_bio_eod() if truncated_bytes > bvec->bv_len
https://jira.sw.ru/browse/PSBM-55105 In bug we crashed in zero_fill_bio when trying to zero memset bio_vec: struct bio_vec { bv_page = 0xea0004437500, bv_len = 4294948864, bv_offset = 0 } which is bigger than its bio->bi_size = 104448, guard_bio_eod might lead to these bv_len overflow and is suspicious as quiet recently in vz7.19.4 we've ported commit 2573b2539875("vfs: make guard_bh_eod() more generic") which adds bv_len reduction, and before that there were no crash. Signed-off-by: Pavel Tikhomirov--- fs/buffer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/buffer.c b/fs/buffer.c index c45200d..b820080 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -3009,6 +3009,7 @@ void guard_bio_eod(int rw, struct bio *bio) /* Truncate the bio.. */ bio->bi_size -= truncated_bytes; + WARN_ON(truncated_bytes > bvec->bv_len); bvec->bv_len -= truncated_bytes; /* ..and clear the end of the buffer for reads */ -- 2.9.3 ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH RHEL7 COMMIT] kvm/x86: skip async_pf when in guest mode
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.20.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-327.36.1.vz7.20.9 --> commit 5173f45a28cdf3d5808e236eab882273a760a363 Author: Roman KaganDate: Fri Dec 2 18:35:41 2016 +0400 kvm/x86: skip async_pf when in guest mode Async pagefault machinery assumes communication with L1 guests only: all the state -- MSRs, apf area addresses, etc, -- are for L1. However, it currently doesn't check if the vCPU is running L1 or L2, and may inject To reproduce the problem, use a host with swap enabled, run a VM on it, run a nested VM on top, and set RSS limit for L1 on the host via /sys/fs/cgroup/memory/machine.slice/machine-*.scope/memory.limit_in_bytes to swap it out (you may need to tighten and release it once or twice, or create some memory load inside L1). Very quickly L2 guest starts receiving pagefaults with bogus %cr2 (apf tokens from the host actually), and L1 guest starts accumulating tasks stuck in D state in kvm_async_pf_task_wait. To avoid that, only do async_pf stuff when executing L1 guest. Note: this patch only fixes x86; other async_pf-capable arches may also need something similar. Signed-off-by: Roman Kagan Signed-off-by: Radim KrÄmáŠ(cherry picked from commit 80e2a7bb8d7050d2ea6d8961c526a65d30d5eb08) https://jira.sw.ru/browse/PSBM-54491 --- arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/x86.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 17973ed..c82bf5f 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3481,7 +3481,7 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, if (!async) return false; /* *pfn has correct page already */ - if (!prefault && can_do_async_pf(vcpu)) { + if (!prefault && !is_guest_mode(vcpu) && can_do_async_pf(vcpu)) { trace_kvm_try_async_get_page(gva, gfn); if (kvm_find_async_pf_gfn(vcpu, gfn)) { trace_kvm_async_pf_doublefault(gva, gfn); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 78ea28c..4edeb8a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6780,7 +6780,8 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) ++vcpu->stat.request_irq_exits; } - kvm_check_async_pf_completion(vcpu); + if (!is_guest_mode(vcpu)) + kvm_check_async_pf_completion(vcpu); if (signal_pending(current)) { r = -EINTR; ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH RHEL7 COMMIT] fuse: no mtime flush on fdatasync
The commit is pushed to "branch-rh7-3.10.0-327.36.1.vz7.20.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git after rh7-3.10.0-327.36.1.vz7.20.9 --> commit 2b3926333196c731257c173f7be35d4bd8a4 Author: Maxim PatlasovDate: Fri Dec 2 18:34:57 2016 +0400 fuse: no mtime flush on fdatasync fuse_fsync_common() may skip fuse_flush_mtime() if datasync=1 because mtime is pure metadata and the content of file doesn't depend on it. https://jira.sw.ru/browse/PSBM-55919 Signed-off-by: Maxim Patlasov Acked-by: Dmitry Monakhov --- fs/fuse/file.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index d11125f..52bca91 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -691,8 +691,8 @@ int fuse_fsync_common(struct file *file, loff_t start, loff_t end, if (err) goto out; - if (test_bit(FUSE_I_MTIME_UPDATED, -_fuse_inode(inode)->state)) { + if (!datasync && test_bit(FUSE_I_MTIME_UPDATED, + _fuse_inode(inode)->state)) { err = fuse_flush_mtime(file, false); if (err) goto out; ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
Re: [Devel] [PATCH vz7] fuse: no mtime flush on fdatasync
Maxim Patlasovwrites: > fuse_fsync_common() may skip fuse_flush_mtime() if datasync=1 because > mtime is pure metadata and the content of file doesn't depend on it. > > https://jira.sw.ru/browse/PSBM-55919 > > Signed-off-by: Maxim Patlasov ACK. > --- > fs/fuse/file.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/fs/fuse/file.c b/fs/fuse/file.c > index 559dfd9..e5c4778 100644 > --- a/fs/fuse/file.c > +++ b/fs/fuse/file.c > @@ -684,8 +684,8 @@ int fuse_fsync_common(struct file *file, loff_t start, > loff_t end, > if (err) > goto out; > > - if (test_bit(FUSE_I_MTIME_UPDATED, > - _fuse_inode(inode)->state)) { > + if (!datasync && test_bit(FUSE_I_MTIME_UPDATED, > + _fuse_inode(inode)->state)) { > err = fuse_flush_mtime(file, false); > if (err) > goto out; ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH] kvm/x86: skip async_pf when in guest mode
Async pagefault machinery assumes communication with L1 guests only: all the state -- MSRs, apf area addresses, etc, -- are for L1. However, it currently doesn't check if the vCPU is running L1 or L2, and may inject To reproduce the problem, use a host with swap enabled, run a VM on it, run a nested VM on top, and set RSS limit for L1 on the host via /sys/fs/cgroup/memory/machine.slice/machine-*.scope/memory.limit_in_bytes to swap it out (you may need to tighten and release it once or twice, or create some memory load inside L1). Very quickly L2 guest starts receiving pagefaults with bogus %cr2 (apf tokens from the host actually), and L1 guest starts accumulating tasks stuck in D state in kvm_async_pf_task_wait. To avoid that, only do async_pf stuff when executing L1 guest. Note: this patch only fixes x86; other async_pf-capable arches may also need something similar. Signed-off-by: Roman KaganSigned-off-by: Radim Krčmář (cherry picked from commit 80e2a7bb8d7050d2ea6d8961c526a65d30d5eb08) Fixes: PSBM-54491 Signed-off-by: Roman Kagan --- The patch has been merged into kvm/queue but not yet pull-requested to Linus arch/x86/kvm/mmu.c | 2 +- arch/x86/kvm/x86.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c index 17973ed..c82bf5f 100644 --- a/arch/x86/kvm/mmu.c +++ b/arch/x86/kvm/mmu.c @@ -3481,7 +3481,7 @@ static bool try_async_pf(struct kvm_vcpu *vcpu, bool prefault, gfn_t gfn, if (!async) return false; /* *pfn has correct page already */ - if (!prefault && can_do_async_pf(vcpu)) { + if (!prefault && !is_guest_mode(vcpu) && can_do_async_pf(vcpu)) { trace_kvm_try_async_get_page(gva, gfn); if (kvm_find_async_pf_gfn(vcpu, gfn)) { trace_kvm_async_pf_doublefault(gva, gfn); diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 78ea28c..4edeb8a 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -6780,7 +6780,8 @@ static int __vcpu_run(struct kvm_vcpu *vcpu) ++vcpu->stat.request_irq_exits; } - kvm_check_async_pf_completion(vcpu); + if (!is_guest_mode(vcpu)) + kvm_check_async_pf_completion(vcpu); if (signal_pending(current)) { r = -EINTR; -- 2.9.3 ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel