[Devel] [PATCH RHEL7 COMMIT] fuse: fuse_prepare_write() should not wait on fuse-writeback
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.10 --> commit 97825f6e3a3da5160d57663b0dcb83f942ca67c5 Author: Maxim Patlasov Date: Mon Dec 5 12:35:42 2016 +0400 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 52bca91..641b570 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2328,13 +2328,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, &err, &req, NULL, NULL); if (req) ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH RHEL7 COMMIT] vfs: panic in guard_bio_eod() if truncated_bytes > bvec->bv_len
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.10 --> commit 37d9a5c875a6617c010882813c246875d3f86a3c Author: Pavel Tikhomirov Date: Mon Dec 5 13:08:35 2016 +0400 vfs: panic in guard_bio_eod() if truncated_bytes > bvec->bv_len 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. https://jira.sw.ru/browse/PSBM-55105 Signed-off-by: Pavel Tikhomirov Acked-by: Konstantin Khorenko khorenko@: s/WARN_ON/BUG_ON/ because we'll crash anyway a moment later or corrupt memory which is also unacceptable. --- fs/buffer.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/buffer.c b/fs/buffer.c index c45200d..13a6d56 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; + BUG_ON(truncated_bytes > bvec->bv_len); bvec->bv_len -= truncated_bytes; /* ..and clear the end of the buffer for reads */ ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH RHEL7 COMMIT] ve/net: Do not initialize netns_ct::can_alloc twice
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.10 --> commit 5270ea02fcd0e9dd5a9f7b4908eef3b7f3ee11ea Author: Kirill Tkhai Date: Mon Dec 5 13:51:00 2016 +0400 ve/net: Do not initialize netns_ct::can_alloc twice It's already initialized to zero during net creation in net_alloc(), so do not do that twice. Also, some conntrack allowing modules do not depend on nf_conntrack.ko, so it rewrites can_alloc to zero, if it's loaded later. (This may be merged with "commit af2b974e4755 "net: Primitives to enable conntrack allocation") https://jira.sw.ru/browse/PSBM-56500 Signed-off-by: Kirill Tkhai --- include/net/netns/conntrack.h | 2 +- net/netfilter/nf_conntrack_core.c | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/include/net/netns/conntrack.h b/include/net/netns/conntrack.h index 0c2a685..31596df 100644 --- a/include/net/netns/conntrack.h +++ b/include/net/netns/conntrack.h @@ -74,7 +74,7 @@ struct ct_pcpu { struct netns_ct { atomic_tcount; - boolcan_alloc; + boolcan_alloc; /* Initialized in 0 by net_alloc */ unsigned intmax; unsigned intexpect_count; unsigned intexpect_max; diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index d5a283a..8fca77e 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -1823,7 +1823,6 @@ int nf_conntrack_init_net(struct net *net) int cpu; atomic_set(&net->ct.count, 0); - net->ct.can_alloc = false; net->ct.max = init_net.ct.max; seqcount_init(&net->ct.generation); ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH 2/2] fs/ceph: honor kernel direct aio changes v2
Base patches: fs/ceph: honor kernel direct aio changes fs/ceph: add BUG_ON to iov_iter access Changes: replace opencoded iter to iovec coversion with propper helper. Signed-off-by: Dmitry Monakhov --- fs/ceph/file.c | 30 -- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/fs/ceph/file.c b/fs/ceph/file.c index 82676fa..0b72417 100644 --- a/fs/ceph/file.c +++ b/fs/ceph/file.c @@ -40,8 +40,8 @@ */ static size_t dio_get_pagev_size(const struct iov_iter *it) { -const struct iovec *iov = it->iov; -const struct iovec *iovend = iov + it->nr_segs; +const struct iovec *iov = iov_iter_iovec(it); +size_t total = iov_iter_count(it); size_t size; size = iov->iov_len - it->iov_offset; @@ -50,8 +50,10 @@ static size_t dio_get_pagev_size(const struct iov_iter *it) * and the next base are page aligned. */ while (PAGE_ALIGNED((iov->iov_base + iov->iov_len)) && - (++iov < iovend && PAGE_ALIGNED((iov->iov_base { -size += iov->iov_len; + PAGE_ALIGNED(((iov++)->iov_base))) { + size_t n = min(iov->iov_len, total); + size += n; + total -= n; } dout("dio_get_pagevlen len = %zu\n", size); return size; @@ -71,7 +73,7 @@ dio_get_pages_alloc(const struct iov_iter *it, size_t nbytes, struct page **pages; int ret = 0, idx, npages; - align = (unsigned long)(it->iov->iov_base + it->iov_offset) & + align = (unsigned long)(iov_iter_iovec(it)->iov_base + it->iov_offset) & (PAGE_SIZE - 1); npages = calc_pages_for(align, nbytes); pages = kmalloc(sizeof(*pages) * npages, GFP_KERNEL); @@ -82,10 +84,11 @@ dio_get_pages_alloc(const struct iov_iter *it, size_t nbytes, } for (idx = 0; idx < npages; ) { - void __user *data = tmp_it.iov->iov_base + tmp_it.iov_offset; + struct iovec *tmp_iov = iov_iter_iovec(&tmp_it); + void __user *data = tmp_iov->iov_base + tmp_it.iov_offset; size_t off = (unsigned long)data & (PAGE_SIZE - 1); size_t len = min_t(size_t, nbytes, - tmp_it.iov->iov_len - tmp_it.iov_offset); + tmp_iov->iov_len - tmp_it.iov_offset); int n = (len + off + PAGE_SIZE - 1) >> PAGE_SHIFT; ret = get_user_pages_fast((unsigned long)data, n, write, pages + idx); @@ -522,10 +525,9 @@ static ssize_t ceph_sync_read(struct kiocb *iocb, struct iov_iter *i, size_t left = len = ret; while (left) { - void __user *data = i->iov[0].iov_base + - i->iov_offset; - l = min(i->iov[0].iov_len - i->iov_offset, - left); + struct iovec *iov = (struct iovec *)i->data; + void __user *data = iov->iov_base + i->iov_offset; + l = min(iov->iov_len - i->iov_offset, left); ret = ceph_copy_page_vector_to_user(&pages[k], data, off, l); @@ -1121,7 +1123,7 @@ static ssize_t inline_to_iov(struct kiocb *iocb, struct iov_iter *i, while (left) { struct iovec *iov = iov_iter_iovec(i); - void __user *udata = iov->iov_base + i->iov_offset; + void __user *udata = iov->iov_base; size_t n = min(iov->iov_len - i->iov_offset, left); if (__copy_to_user(udata, kdata, n)) { @@ -1139,8 +1141,8 @@ static ssize_t inline_to_iov(struct kiocb *iocb, struct iov_iter *i, size_t left = min_t(loff_t, iocb->ki_pos + len, i_size) - pos; while (left) { - struct iovec *iov = iov_iter_iovec(i); - void __user *udata = iov->iov_base + i->iov_offset; + struct iovec *iov = (struct iovec *)i->data; + void __user *udata = iov->iov_base; size_t n = min(iov->iov_len - i->iov_offset, left); if (__clear_user(udata, n)) { -- 2.7.4 ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH 1/2] fs: constify iov_iter_count/iov_iter_iovec helpers
Signed-off-by: Dmitry Monakhov --- include/linux/fs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/linux/fs.h b/include/linux/fs.h index e30e8a1..a27bd15 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -448,13 +448,13 @@ static inline int iov_iter_has_iovec(const struct iov_iter *i) { return i->ops == &ii_iovec_ops; } -static inline struct iovec *iov_iter_iovec(struct iov_iter *i) +static inline struct iovec *iov_iter_iovec(const struct iov_iter *i) { BUG_ON(!iov_iter_has_iovec(i)); return (struct iovec *)i->data; } -static inline size_t iov_iter_count(struct iov_iter *i) +static inline size_t iov_iter_count(const struct iov_iter *i) { return i->count; } -- 2.7.4 ___ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel
[Devel] [PATCH vz7] ploop: pio_nfs does not require PLOOP_REQ_ISSUE_FLUSH (v2)
The flag was introduced for local case: if we modify local block-device directly, bypassing ext4, we cannot rely on fsync() and must flush the device explicitly. It is not the case for pio_nfs, so it's not necessary to set PLOOP_REQ_ISSUE_FLUSH. The patch is important because pio_nfs doesn't provide issue_flush method. Changed in v2: - rebase: after 34c7bf1755 moved set_bit and nullifying submit into ploop_entry_nullify_req(), the patch to be applied to this new place. Signed-off-by: Maxim Patlasov --- drivers/block/ploop/dev.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c index 26017eb..a15606d 100644 --- a/drivers/block/ploop/dev.c +++ b/drivers/block/ploop/dev.c @@ -2036,9 +2036,11 @@ ploop_entry_nullify_req(struct ploop_request *preq) * (see dio_submit()). So fsync of EXT4 image doesnt help us. * We need to force sync of nullified blocks. */ + if (top_delta->io.ops->issue_flush) { + preq->eng_io = &top_delta->io; + set_bit(PLOOP_REQ_ISSUE_FLUSH, &preq->state); + } - preq->eng_io = &top_delta->io; - set_bit(PLOOP_REQ_ISSUE_FLUSH, &preq->state); top_delta->io.ops->submit(&top_delta->io, preq, preq->req_rw, &sbl, preq->iblock, 1