[PATCH v2] sparse: use force attribute for vm_fault_t casts

2022-05-14 Thread Vasily Averin
:58: sparse: got restricted vm_fault_t [assigned] [usertype] ret vm_fault_t type is bitwise and requires __force attribute for any casts. Signed-off-by: Vasily Averin --- v2: improved according to the recommendations of Matthew Wilcox: - __force cast moved into internal functions

[PATCH] sparse: use force attribute for vm_fault_t casts

2022-05-14 Thread Vasily Averin
:58: sparse: got restricted vm_fault_t [assigned] [usertype] ret vm_fault_t type is bitwise and requires __force attribute for any casts. Signed-off-by: Vasily Averin --- fs/dax.c | 22 +++--- include/linux/mm_types.h | 30 -- 2 files

[PATCH] tracing: remove WARN_ON in start_thread()

2020-11-18 Thread Vasily Averin
er_start+0xc9/0xd0 Fixes: 978defee11a5 ("tracing: Do a WARN_ON() if start_thread() in hwlat is called when thread exists") Signed-off-by: Vasily Averin --- kernel/trace/trace_hwlat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/trace_hwlat.c b/kerne

Re: [PATCH] fuse_writepages_fill: simplified "if-else if" constuction

2020-07-14 Thread Vasily Averin
On 7/14/20 3:24 PM, Miklos Szeredi wrote: > On Thu, Jun 25, 2020 at 11:30 AM Vasily Averin wrote: >> >> fuse_writepages_fill uses following construction: >> if (wpa && ap->num_pages && >> (A || B || C)) { >>

Re: [PATCH] fuse_writepages_fill() optimization to avoid WARN_ON in tree_insert

2020-07-14 Thread Vasily Averin
On 7/13/20 7:14 PM, Miklos Szeredi wrote: > On Mon, Jul 13, 2020 at 10:02 AM Vasily Averin wrote: >> >> On 7/11/20 7:01 AM, Miklos Szeredi wrote: >>> On Thu, Jun 25, 2020 at 11:02 AM Vasily Averin wrote: >>>> >>>> In current implementatio

Re: [5.8RC4][bugreport]WARNING: CPU: 28 PID: 211236 at fs/fuse/file.c:1684 tree_insert+0xaf/0xc0 [fuse]

2020-07-13 Thread Vasily Averin
;` for debug >> purpose? >> Now this line is often called when I start the container. >> > > That odd, but I can't send an email to the author of the commit. > mpatlasov wasn't found at virtuozzo.com. Reported problem is not fixed yet in 5.8-rc kernels Please take look at https://lkml.org/lkml/2020/7/13/265 Thank you, Vasily Averin

Re: [PATCH] fuse_writepages_fill() optimization to avoid WARN_ON in tree_insert

2020-07-13 Thread Vasily Averin
On 7/11/20 7:01 AM, Miklos Szeredi wrote: > On Thu, Jun 25, 2020 at 11:02 AM Vasily Averin wrote: >> >> In current implementation fuse_writepages_fill() tries to share the code: >> for new wpa it calls tree_insert() with num_pages = 0 >> then switches to common code

[PATCH] fuse_writepages ignores errors from fuse_writepages_fill

2020-06-25 Thread Vasily Averin
Signed-off-by: Vasily Averin --- fs/fuse/file.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index c023f7f0..5986739 100644 --- a/fs/fuse/file.c +++ b/fs/fuse/file.c @@ -2148,10 +2148,8 @@ static int fuse_writepages(struct address_space *mapping,

[PATCH] fuse_writepages_fill: simplified "if-else if" constuction

2020-06-25 Thread Vasily Averin
ot;if" and "else if" calls the same action and can be merged. Signed-off-by: Vasily Averin --- fs/fuse/file.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index cf267bd..c023f7f0 100644 --- a/fs/fuse/file.c +++ b

[PATCH] fuse_writepages_fill() optimization to avoid WARN_ON in tree_insert

2020-06-25 Thread Vasily Averin
ill() to call tree_insert() with num_pages = 1 and avoids its subsequent increment and an extra spin_lock(>lock) for newly added wpa. Fixes: 6b2fb79963fb ("fuse: optimize writepages search") Reported-by: kernel test robot Signed-off-by: Vasily Averin --- fs/

Re: [fuse] 6b2fb79963: WARNING:at_fs/fuse/file.c:#tree_insert[fuse]

2020-06-25 Thread Vasily Averin
On 6/16/20 3:35 PM, Miklos Szeredi wrote: > On Mon, Jun 15, 2020 at 7:59 AM Vasily Averin wrote: >> >> On 6/15/20 3:50 AM, kernel test robot wrote: >>> FYI, we noticed the following commit (built with gcc-9): >>> >>> commit: 6b2fb79963fbed7

Re: [fuse] 6b2fb79963: WARNING:at_fs/fuse/file.c:#tree_insert[fuse]

2020-06-15 Thread Vasily Averin
gt;ia.ap.num_pages - 1; ... + WARN_ON(!wpa->ia.ap.num_pages); Miklos, do you have any objections if I return to our initial proposal? Am I missed something and it is not allowed now? Thank you, Vasily Averin diff --git a/fs/fuse/file.c b/fs/fuse/file.c index e573b0c..b8c

Re: [PATCH] lib/lz4: smatch warning in LZ4_decompress_generic()

2020-06-06 Thread Vasily Averin
Dear Yann, could you please consult us about your lz4 pacth https://github.com/lz4/lz4/commit/1a191b3f8d26b50a7c1d41590b529ec308d768cd Please see details below. Thank you, Vasily Averin On 6/6/20 5:36 PM, Gao Xiang wrote: > On Sat, Jun 06, 2020 at 04:28:02PM +0300, Vasily Averin wr

[PATCH] lib/lz4: smatch warning in LZ4_decompress_generic()

2020-06-06 Thread Vasily Averin
r module") Signed-off-by: Vasily Averin --- lib/lz4/lz4_decompress.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/lz4/lz4_decompress.c b/lib/lz4/lz4_decompress.c index 0c9d3ad..f7f7dca 100644 --- a/lib/lz4/lz4_decompress.c +++ b/lib/lz4/lz4_decompress.c @@ -

Re: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index

2020-05-12 Thread Vasily Averin
On 5/12/20 12:21 PM, Jiri Slaby wrote: > On 08. 05. 20, 12:01, Vasily Averin wrote: >> On 5/8/20 9:07 AM, Vasily Averin wrote: >>> On 5/8/20 6:36 AM, Matthew Wilcox wrote: >>>> On Thu, May 07, 2020 at 05:02:42PM -0700, Andrew Morton wrote: >>>>>

Re: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index

2020-05-08 Thread Vasily Averin
On 5/8/20 9:07 AM, Vasily Averin wrote: > On 5/8/20 6:36 AM, Matthew Wilcox wrote: >> On Thu, May 07, 2020 at 05:02:42PM -0700, Andrew Morton wrote: >>> Here's how I resolved things. Please check? >>> >>> static struct kern_ipc_perm *sysvipc_find_ipc(

Re: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index

2020-05-08 Thread Vasily Averin
looks like xa_find() can return index < pos xa_find in our case will call xas_find_marked() that have following description * If no marked entry is found and the array is smaller than @max, @xas is * set to the bounds state and xas->xa_index is set to the smallest index * not yet in the array. This all

Re: [PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index

2020-05-07 Thread Vasily Averin
Dear Andrew, could you please handle it, it fixes broken ipcs in last mainline and stable kernels, and on all its derivatives. Thank you, Vasily Averin On 5/6/20 6:59 PM, Waiman Long wrote: > On 5/6/20 2:25 AM, Vasily Averin wrote: >> new_pos should jump through hole of u

[PATCH] ipc/util.c: sysvipc_find_ipc() incorrectly updates position index

2020-05-06 Thread Vasily Averin
new_pos should jump through hole of unused ids, pos can be updated inside "for" cycle. Cc: sta...@vger.kernel.org Fixes: 89163f93c6f9 ("ipc/util.c: sysvipc_find_ipc() should increase position index") Signed-off-by: Vasily Averin --- ipc/util.c | 12 ++-- 1 file c

Re: [PATCH 7/7] sysvipc_find_ipc should increase position index

2020-05-05 Thread Vasily Averin
root 64400 Thank you, Vasily Averin

Re: [PATCH 1/1] drm/qxl: add mutex_lock/mutex_unlock to ensure the order in which resources are rele

2020-04-29 Thread Vasily Averin
if (ret) - qxl_release_backoff_reserve_list(release); <<<< - else - qxl_release_fence_buffer_objects(release); - out_free_bos: out_free_release: Thank you, Vasily Averin

[PATCH] fuse: lost unlock_page in fuse_writepage()

2019-09-13 Thread Vasily Averin
unlock_page() was lost in fuse_writepage() Fixes commit ff17be086477 ("fuse: writepage: skip already in flight") # 3.13+ Signed-off-by: Vasily Averin --- fs/fuse/file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index 5ae2828beb00..91c99724d

[PATCH] fuse: BUG_ON correction in fuse_dev_splice_write()

2019-08-19 Thread Vasily Averin
commit 963545357202 ("fuse: reduce allocation size for splice_write") changed size of bufs array, so BUG_ON which checks the index of the array shold also be fixed. Fixes: 963545357202 ("fuse: reduce allocation size for splice_write") Signed-off-by: Vasily Averin --

Re: [PATCH] fuse: BUG_ON's correction in fuse_dev_splice_write()

2019-08-19 Thread Vasily Averin
On 8/1/19 2:01 PM, Miklos Szeredi wrote: > On Tue, Jul 23, 2019 at 8:33 AM Vasily Averin wrote: >> >> commit 963545357202 ("fuse: reduce allocation size for splice_write") >> changed size of bufs array, so first BUG_ON should be corrected too. >> Second

[PATCH] fuse: redundant get_fuse_inode() calls in fuse_writepages_fill()

2019-08-18 Thread Vasily Averin
Currently fuse_writepages_fill() calls get_fuse_inode() few times with the same argument. Signed-off-by: Vasily Averin --- fs/fuse/file.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c index e076c2cf65b0..bc9b64ef7b5d 100644 --- a/fs/fuse

[PATCH] fuse: BUG_ON's correction in fuse_dev_splice_write()

2019-07-23 Thread Vasily Averin
ot;fuse: reduce allocation size for splice_write") Signed-off-by: Vasily Averin --- fs/fuse/dev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/fuse/dev.c b/fs/fuse/dev.c index ea8237513dfa..311c7911271c 100644 --- a/fs/fuse/dev.c +++ b/fs/fuse/dev.c @@ -2064,8 +2064

[tip:locking/urgent] futex: Cleanup generic SMP variant of arch_futex_atomic_op_inuser()

2019-07-22 Thread tip-bot for Vasily Averin
Commit-ID: f9adc23ee91e6f561bb70c6147d8d45bd164d62f Gitweb: https://git.kernel.org/tip/f9adc23ee91e6f561bb70c6147d8d45bd164d62f Author: Vasily Averin AuthorDate: Tue, 16 Jul 2019 09:22:03 +0300 Committer: Thomas Gleixner CommitDate: Mon, 22 Jul 2019 11:20:10 +0200 futex: Cleanup

Re: [PATCH] fuse: cleanup fuse_wait_on_page_writeback

2019-07-22 Thread Vasily Averin
I forget to add this patch was used in OpenVZ kernels last few years. On 7/22/19 10:17 AM, Vasily Averin wrote: > From: Maxim Patlasov > fuse_wait_on_page_writeback() always returns zero and nobody cares. > Let's make it void. > > Signed-off-by: Maxim Patlasov > Signed-off

[PATCH] fuse: cleanup fuse_wait_on_page_writeback

2019-07-22 Thread Vasily Averin
From: Maxim Patlasov fuse_wait_on_page_writeback() always returns zero and nobody cares. Let's make it void. Signed-off-by: Maxim Patlasov Signed-off-by: Vasily Averin --- fs/fuse/file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/fuse/file.c b/fs/fuse/file.c

[PATCH] connector: remove redundant input callback from cn_dev

2019-07-17 Thread Vasily Averin
A small cleanup: this callback is never used. Originally fixed by Stanislav Kinsburskiy for OpenVZ7 bug OVZ-6877 cc: stanislav.kinsburs...@gmail.com Signed-off-by: Vasily Averin --- drivers/connector/connector.c | 6 +- include/linux/connector.h | 1 - 2 files changed, 1 insertion

Re: [PATCH v3 1/3] kernel/notifier.c: avoid duplicate registration

2019-07-17 Thread Vasily Averin
is configured with softlockup_panic and the same > hook is repeatedly registered on the panic_notifier_list, it > will cause a loop panic. > > Add a check in notifier_chain_register() to avoid duplicate registration > > Signed-off-by: Xiaoming Ni Reviewed-by: Vasily Aver

Re: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration

2019-07-17 Thread Vasily Averin
On 7/16/19 5:07 PM, Xiaoming Ni wrote: > On 2019/7/16 18:20, Vasily Averin wrote: >> On 7/16/19 5:00 AM, Xiaoming Ni wrote: >>> On 2019/7/15 13:38, Vasily Averin wrote: >>>> On 7/14/19 5:45 AM, Xiaoming Ni wrote: >>>>> On 2019/7/12 22:07, gre...@lin

Re: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration

2019-07-16 Thread Vasily Averin
On 7/16/19 5:00 AM, Xiaoming Ni wrote: > On 2019/7/15 13:38, Vasily Averin wrote: >> On 7/14/19 5:45 AM, Xiaoming Ni wrote: >>> On 2019/7/12 22:07, gre...@linuxfoundation.org wrote: >>>> On Fri, Jul 12, 2019 at 09:11:57PM +0800, Xiaoming Ni wrote: >>>>

[PATCH v2] futex: generic arch_futex_atomic_op_inuser() cleanup

2019-07-16 Thread Vasily Averin
generic smp version of arch_futex_atomic_op_inuser() always returns -ENOSYS Signed-off-by: Vasily Averin --- include/asm-generic/futex.h | 21 + 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/include/asm-generic/futex.h b/include/asm-generic/futex.h index

Re: [PATCH] generic arch_futex_atomic_op_inuser() cleanup

2019-07-15 Thread Vasily Averin
Looks like this code is dead and therefore looks strange. I've found it during manual code review and decided to send patch to pay your attention to this problem. Probably it's better to remove this code at all? On 7/15/19 1:27 PM, Vasily Averin wrote: > Access to 'op' variable does not requ

[PATCH] generic arch_futex_atomic_op_inuser() cleanup

2019-07-15 Thread Vasily Averin
Access to 'op' variable does not require pagefault_disable(), 'ret' variable should be initialized before using, 'oldval' variable can be replaced by constant. Signed-off-by: Vasily Averin --- include/asm-generic/futex.h | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git

Re: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration

2019-07-14 Thread Vasily Averin
On 7/14/19 5:45 AM, Xiaoming Ni wrote: > On 2019/7/12 22:07, gre...@linuxfoundation.org wrote: >> On Fri, Jul 12, 2019 at 09:11:57PM +0800, Xiaoming Ni wrote: >>> On 2019/7/11 21:57, Vasily Averin wrote: >>>> On 7/11/19 4:55 AM, Nixiaoming wrote: >>>>>

Re: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration

2019-07-11 Thread Vasily Averin
On 7/11/19 4:55 AM, Nixiaoming wrote: > On Wed, July 10, 2019 1:49 PM Vasily Averin wrote: >> On 7/10/19 6:09 AM, Xiaoming Ni wrote: >>> Registering the same notifier to a hook repeatedly can cause the hook >>> list to form a ring or lose other members of the list.

Re: [PATCH v3 0/3] kernel/notifier.c: avoid duplicate registration

2019-07-09 Thread Vasily Averin
On 7/10/19 6:09 AM, Xiaoming Ni wrote: > Registering the same notifier to a hook repeatedly can cause the hook > list to form a ring or lose other members of the list. I think is not enough to _prevent_ 2nd register attempt, it's enough to detect just attempt and generate warning to mark host in

Re: [PATCH] notifiers: double register detection

2019-03-12 Thread Vasily Averin
similar problem on OpenVz kernel. Mistakes with notifiers register can happen for example during subsystem initilazation from different namespaces, or because of lost unregister in roll-back path on initialization failures. Thank you, Vasily Averin On 3/12/19 11:06 AM, Vasily Averin wrote

[PATCH] notifiers: double register detection

2019-03-12 Thread Vasily Averin
By design notifiers can be registerd once only, 2nd register attempt called by mistake silently corrupts notifiers list. Proposed check cannot prevent described problem, however it allows to detect its reason quickly without coredump analyze. Signed-off-by: Vasily Averin --- kernel/notifier.c

Re: [PATCH] mm: cleancache: fix corruption on missed inode invalidation

2018-11-15 Thread Vasily Averin
On 11/16/18 1:31 AM, Andrew Morton wrote: > On Mon, 12 Nov 2018 12:57:34 +0300 Pavel Tikhomirov > wrote: > >> If all pages are deleted from the mapping by memory reclaim and also >> moved to the cleancache: >> >> __delete_from_page_cache >> (no shadow case) >> unaccount_page_cache_page >>

Re: [PATCH] mm: cleancache: fix corruption on missed inode invalidation

2018-11-15 Thread Vasily Averin
On 11/16/18 1:31 AM, Andrew Morton wrote: > On Mon, 12 Nov 2018 12:57:34 +0300 Pavel Tikhomirov > wrote: > >> If all pages are deleted from the mapping by memory reclaim and also >> moved to the cleancache: >> >> __delete_from_page_cache >> (no shadow case) >> unaccount_page_cache_page >>

[PATCH v3] ext4: missing !bh check in ext4_xattr_inode_write()

2018-11-08 Thread Vasily Averin
system corruption (although that would be highly unlikely given that we had *just* allocated the blocks and so the metadata blocks in question probably would still be in the cache). Fixes e50e5129f384 ("ext4: xattr-in-inode support") Cc: sta...@kernel.org # 4.13 Signed-off-by: Vas

[PATCH v3] ext4: missing !bh check in ext4_xattr_inode_write()

2018-11-08 Thread Vasily Averin
system corruption (although that would be highly unlikely given that we had *just* allocated the blocks and so the metadata blocks in question probably would still be in the cache). Fixes e50e5129f384 ("ext4: xattr-in-inode support") Cc: sta...@kernel.org # 4.13 Signed-off-by: Vas

[PATCH v2] ext4: missing !bh check in ext4_xattr_inode_write()

2018-11-07 Thread Vasily Averin
system corruption (although that would be highly unlikely given that we had *just* allocated the blocks and so the metadata blocks in question probably would still be in the cache). Fixes e50e5129f384 ("ext4: xattr-in-inode support") Cc: sta...@kernel.org # 4.13 Signed-off-by: Vas

[PATCH v2] ext4: missing !bh check in ext4_xattr_inode_write()

2018-11-07 Thread Vasily Averin
system corruption (although that would be highly unlikely given that we had *just* allocated the blocks and so the metadata blocks in question probably would still be in the cache). Fixes e50e5129f384 ("ext4: xattr-in-inode support") Cc: sta...@kernel.org # 4.13 Signed-off-by: Vas

[PATCH v2] ext4: lost brelse in __ext4_read_dirblock()

2018-11-07 Thread Vasily Averin
Fixes dc6982ff4db1 ("ext4: refactor code to read directory blocks ...") Cc: sta...@kernel.org # 3.9 Signed-off-by: Vasily Averin --- fs/ext4/namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index d388cce72db2..6a6b90363ef1 100644 ---

[PATCH v2] ext4: lost brelse in __ext4_read_dirblock()

2018-11-07 Thread Vasily Averin
Fixes dc6982ff4db1 ("ext4: refactor code to read directory blocks ...") Cc: sta...@kernel.org # 3.9 Signed-off-by: Vasily Averin --- fs/ext4/namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index d388cce72db2..6a6b90363ef1 100644 ---

Re: [PATCH 1/7] ext4: lost brelse in __ext4_read_dirblock()

2018-11-07 Thread Vasily Averin
I was wrong here, but brelse is lost in next error in this function. I'll resend new patch. On 11/7/18 6:25 PM, Theodore Y. Ts'o wrote: > On Wed, Oct 31, 2018 at 10:12:18PM +0300, Vasily Averin wrote: >> Fixes dc6982ff4db1 ("ext4: refactor code to read directory blocks ...")

Re: [PATCH 1/7] ext4: lost brelse in __ext4_read_dirblock()

2018-11-07 Thread Vasily Averin
I was wrong here, but brelse is lost in next error in this function. I'll resend new patch. On 11/7/18 6:25 PM, Theodore Y. Ts'o wrote: > On Wed, Oct 31, 2018 at 10:12:18PM +0300, Vasily Averin wrote: >> Fixes dc6982ff4db1 ("ext4: refactor code to read directory blocks ...")

Re: [PATCH] ext4: remove code duplication in free_ind_block()

2018-11-05 Thread Vasily Averin
extend_credit_for_blkdel() and ext4_free_blocks(). In the same situation free_ind_blocks() returns without calling of these functions. Is it OK? Thank you, Vasily Averin On 11/6/18 9:13 AM, Vasily Averin wrote: > free_ind_block(), free_dind_blocks() and free_tind_blocks() are replaced > by a single rec

Re: [PATCH] ext4: remove code duplication in free_ind_block()

2018-11-05 Thread Vasily Averin
extend_credit_for_blkdel() and ext4_free_blocks(). In the same situation free_ind_blocks() returns without calling of these functions. Is it OK? Thank you, Vasily Averin On 11/6/18 9:13 AM, Vasily Averin wrote: > free_ind_block(), free_dind_blocks() and free_tind_blocks() are replaced > by a single rec

[PATCH] ext4: remove code duplication in free_ind_block()

2018-11-05 Thread Vasily Averin
free_ind_block(), free_dind_blocks() and free_tind_blocks() are replaced by a single recursive function. Signed-off-by: Vasily Averin --- fs/ext4/migrate.c | 115 +- 1 file changed, 32 insertions(+), 83 deletions(-) diff --git a/fs/ext4/migrate.c b

[PATCH] ext4: remove code duplication in free_ind_block()

2018-11-05 Thread Vasily Averin
free_ind_block(), free_dind_blocks() and free_tind_blocks() are replaced by a single recursive function. Signed-off-by: Vasily Averin --- fs/ext4/migrate.c | 115 +- 1 file changed, 32 insertions(+), 83 deletions(-) diff --git a/fs/ext4/migrate.c b

[PATCH v2] mm: use kvzalloc for swap_info_struct allocation

2018-11-05 Thread Vasily Averin
ge. Switch to kvzmalloc allows to avoid unexpected allocation failures. Acked-by: Aaron Lu Signed-off-by: Vasily Averin --- mm/swapfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 644f746e167a..8688ae65ef58 100644 --- a/mm/swapfile.

[PATCH v2] mm: use kvzalloc for swap_info_struct allocation

2018-11-05 Thread Vasily Averin
ge. Switch to kvzmalloc allows to avoid unexpected allocation failures. Acked-by: Aaron Lu Signed-off-by: Vasily Averin --- mm/swapfile.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/swapfile.c b/mm/swapfile.c index 644f746e167a..8688ae65ef58 100644 --- a/mm/swapfile.

[PATCH v2] ext4: remove code duplication in update_ind/bind/tind_extent_range

2018-11-05 Thread Vasily Averin
update_ind/bind/tind_extent_page() differs by one variable and can be replaced by unified function. These functions are called by similar way and their caller function can be simplified too. v2: minor style changes, thanks to Andreas Dilger Reviewed-by: Andreas Dilger Signed-off-by: Vasily

[PATCH v2] ext4: remove code duplication in update_ind/bind/tind_extent_range

2018-11-05 Thread Vasily Averin
update_ind/bind/tind_extent_page() differs by one variable and can be replaced by unified function. These functions are called by similar way and their caller function can be simplified too. v2: minor style changes, thanks to Andreas Dilger Reviewed-by: Andreas Dilger Signed-off-by: Vasily

Re: [PATCH 2/2] mm: avoid unnecessary swap_info_struct allocation

2018-11-05 Thread Vasily Averin
, Vasily Averin wrote: > On 11/5/18 3:57 AM, Huang, Ying wrote: >> Vasily Averin writes: >> >>> Currently newly allocated swap_info_struct can be quickly freed. >>> This patch avoid uneccessary high-order page allocation and helps >>> to decrease the memory press

Re: [PATCH 2/2] mm: avoid unnecessary swap_info_struct allocation

2018-11-05 Thread Vasily Averin
, Vasily Averin wrote: > On 11/5/18 3:57 AM, Huang, Ying wrote: >> Vasily Averin writes: >> >>> Currently newly allocated swap_info_struct can be quickly freed. >>> This patch avoid uneccessary high-order page allocation and helps >>> to decrease the memory press

Re: [LKP] [ext4 resize] 1ee5ee5ec3: WARNING:at_fs/buffer.c:#__brelse

2018-11-04 Thread Vasily Averin
ong and it was dropped in v2 version of patch set. > url: > https://github.com/0day-ci/linux/commits/Vasily-Averin/ext4-resize-long-lived-errors/20181029-235050 > base: https://git.kernel.org/cgit/linux/kernel/git/tytso/ext4.git dev > > in testcase: xfstests > with fol

Re: [LKP] [ext4 resize] 1ee5ee5ec3: WARNING:at_fs/buffer.c:#__brelse

2018-11-04 Thread Vasily Averin
ong and it was dropped in v2 version of patch set. > url: > https://github.com/0day-ci/linux/commits/Vasily-Averin/ext4-resize-long-lived-errors/20181029-235050 > base: https://git.kernel.org/cgit/linux/kernel/git/tytso/ext4.git dev > > in testcase: xfstests > with fol

Re: [PATCH 2/2] mm: avoid unnecessary swap_info_struct allocation

2018-11-04 Thread Vasily Averin
On 11/5/18 3:57 AM, Huang, Ying wrote: > Vasily Averin writes: > >> Currently newly allocated swap_info_struct can be quickly freed. >> This patch avoid uneccessary high-order page allocation and helps >> to decrease the memory pressure. > > I think swapon/s

Re: [PATCH 2/2] mm: avoid unnecessary swap_info_struct allocation

2018-11-04 Thread Vasily Averin
On 11/5/18 3:57 AM, Huang, Ying wrote: > Vasily Averin writes: > >> Currently newly allocated swap_info_struct can be quickly freed. >> This patch avoid uneccessary high-order page allocation and helps >> to decrease the memory pressure. > > I think swapon/s

Re: [PATCH 1/2] mm: use kvzalloc for swap_info_struct allocation

2018-11-04 Thread Vasily Averin
On 11/5/18 3:50 AM, Huang, Ying wrote: > Vasily Averin writes: > >> commit a2468cc9bfdf ("swap: choose swap device according to numa node") >> increased size of swap_info_struct up to 44 Kbytes, now it requires >> 4th order page. > > Why swap

Re: [PATCH 1/2] mm: use kvzalloc for swap_info_struct allocation

2018-11-04 Thread Vasily Averin
On 11/5/18 3:50 AM, Huang, Ying wrote: > Vasily Averin writes: > >> commit a2468cc9bfdf ("swap: choose swap device according to numa node") >> increased size of swap_info_struct up to 44 Kbytes, now it requires >> 4th order page. > > Why swap

[PATCH 2/2] mm: avoid unnecessary swap_info_struct allocation

2018-11-04 Thread Vasily Averin
Currently newly allocated swap_info_struct can be quickly freed. This patch avoid uneccessary high-order page allocation and helps to decrease the memory pressure. Signed-off-by: Vasily Averin --- mm/swapfile.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff

[PATCH 1/2] mm: use kvzalloc for swap_info_struct allocation

2018-11-04 Thread Vasily Averin
commit a2468cc9bfdf ("swap: choose swap device according to numa node") increased size of swap_info_struct up to 44 Kbytes, now it requires 4th order page. Switch to kvzmalloc allows to avoid unexpected allocation failures. Signed-off-by: Vasily Averin --- mm/swapfile.c | 6 +++-

[PATCH 2/2] mm: avoid unnecessary swap_info_struct allocation

2018-11-04 Thread Vasily Averin
Currently newly allocated swap_info_struct can be quickly freed. This patch avoid uneccessary high-order page allocation and helps to decrease the memory pressure. Signed-off-by: Vasily Averin --- mm/swapfile.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff

[PATCH 1/2] mm: use kvzalloc for swap_info_struct allocation

2018-11-04 Thread Vasily Averin
commit a2468cc9bfdf ("swap: choose swap device according to numa node") increased size of swap_info_struct up to 44 Kbytes, now it requires 4th order page. Switch to kvzmalloc allows to avoid unexpected allocation failures. Signed-off-by: Vasily Averin --- mm/swapfile.c | 6 +++-

[PATCH] ext4: missing !bh check in ext4_xattr_inode_write()

2018-11-04 Thread Vasily Averin
ext4_getblk() called with map_flags=0 can return NULL, it can lead to oops on bh dereferemce Fixes e50e5129f384 ("ext4: xattr-in-inode support") Cc: sta...@kernel.org # 4.13 Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ext4

[PATCH] ext4: missing !bh check in ext4_xattr_inode_write()

2018-11-04 Thread Vasily Averin
ext4_getblk() called with map_flags=0 can return NULL, it can lead to oops on bh dereferemce Fixes e50e5129f384 ("ext4: xattr-in-inode support") Cc: sta...@kernel.org # 4.13 Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/ext4

[PATCH] ext4: remove code duplication in update_ind/bind/tind_extent_range

2018-11-04 Thread Vasily Averin
update_ind/bind/tind_extent_page() differs by one variable and can be replaced by unified function. These functions are called by similar way and their caller function can be simplified too. Signed-off-by: Vasily Averin --- fs/ext4/migrate.c | 111

[PATCH] ext4: remove code duplication in update_ind/bind/tind_extent_range

2018-11-04 Thread Vasily Averin
update_ind/bind/tind_extent_page() differs by one variable and can be replaced by unified function. These functions are called by similar way and their caller function can be simplified too. Signed-off-by: Vasily Averin --- fs/ext4/migrate.c | 111

[PATCH 7/7] ext4: lost brelse in ext4_expand_extra_isize_ea()

2018-10-31 Thread Vasily Averin
Fixes de05ca852679 ("ext4: move call to ext4_error() into ...") # 4.17 Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 5c9bc0d85cc0..0b9688683526 100644 --- a/fs/ex

[PATCH 7/7] ext4: lost brelse in ext4_expand_extra_isize_ea()

2018-10-31 Thread Vasily Averin
Fixes de05ca852679 ("ext4: move call to ext4_error() into ...") # 4.17 Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index 5c9bc0d85cc0..0b9688683526 100644 --- a/fs/ex

[PATCH 5/7] ext4: bs.bh cleanup before re-using in ext4_xattr_block_find()

2018-10-31 Thread Vasily Averin
bs.bh was taken in previous ext4_xattr_block_find() call, it should be released before re-using Fixes 7e01c8e5420b ("ext3/4: fix uninitialized bs in ...") # 2.6.26 cc: Tiger Yang Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH 5/7] ext4: bs.bh cleanup before re-using in ext4_xattr_block_find()

2018-10-31 Thread Vasily Averin
bs.bh was taken in previous ext4_xattr_block_find() call, it should be released before re-using Fixes 7e01c8e5420b ("ext3/4: fix uninitialized bs in ...") # 2.6.26 cc: Tiger Yang Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 2 ++ 1 file changed, 2 insertions(+) diff --git

[PATCH 6/7] ext4: lost brelse in ext4_xattr_move_to_block()

2018-10-31 Thread Vasily Averin
Fixes 3f2571c1f91f ("ext4: factor out xattr moving") cc: Jan Kara however issue was present in original ext4_expand_extra_isize_ea() Fixes 6dd4ee7cab7e ("ext4: Expand extra_inodes space per ...") # 2.6.23 cc: Kalpak Shah Signed-off-by: Vasily Averin --- fs/ext4/xattr.c |

[PATCH 6/7] ext4: lost brelse in ext4_xattr_move_to_block()

2018-10-31 Thread Vasily Averin
Fixes 3f2571c1f91f ("ext4: factor out xattr moving") cc: Jan Kara however issue was present in original ext4_expand_extra_isize_ea() Fixes 6dd4ee7cab7e ("ext4: Expand extra_inodes space per ...") # 2.6.23 cc: Kalpak Shah Signed-off-by: Vasily Averin --- fs/ext4/xattr.c |

[PATCH 3/7] ext4: lost release of s_journal_flag_rwsem on rollback in ext4_fill_super

2018-10-31 Thread Vasily Averin
Fixes c8585c6fcaf2 ("ext4: fix races between changing inode journal ...") # 4.7 cc: Daeho Jeong Signed-off-by: Vasily Averin --- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ed4d36506ec2..0c9e165b4e3f 100644 --- a/fs/ex

[PATCH 4/7] ext4: lost brelse in ext4_xattr_get_block()

2018-10-31 Thread Vasily Averin
Fixes dec214d00e0d ("ext4: xattr inode deduplication") # 4.13 Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index dc1aeab06dba..07c3a115f7ae 100644 --- a/fs/ext4/xattr.c +++

[PATCH 3/7] ext4: lost release of s_journal_flag_rwsem on rollback in ext4_fill_super

2018-10-31 Thread Vasily Averin
Fixes c8585c6fcaf2 ("ext4: fix races between changing inode journal ...") # 4.7 cc: Daeho Jeong Signed-off-by: Vasily Averin --- fs/ext4/super.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ed4d36506ec2..0c9e165b4e3f 100644 --- a/fs/ex

[PATCH 4/7] ext4: lost brelse in ext4_xattr_get_block()

2018-10-31 Thread Vasily Averin
Fixes dec214d00e0d ("ext4: xattr inode deduplication") # 4.13 Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index dc1aeab06dba..07c3a115f7ae 100644 --- a/fs/ext4/xattr.c +++

[PATCH 0/7] ext4 long-lived issues, part two

2018-10-31 Thread Vasily Averin
I've found one more batch of long-lived ext4 issues, most of them are lost brelse + two leaks on rollback in ext4_fill_super. Oldest one was found in 2.6.23, last one -- in 4.18. Vasily Averin (7): ext4: lost brelse in __ext4_read_dirblock() ext4: possible sbi->s_group_desc l

[PATCH 0/7] ext4 long-lived issues, part two

2018-10-31 Thread Vasily Averin
I've found one more batch of long-lived ext4 issues, most of them are lost brelse + two leaks on rollback in ext4_fill_super. Oldest one was found in 2.6.23, last one -- in 4.18. Vasily Averin (7): ext4: lost brelse in __ext4_read_dirblock() ext4: possible sbi->s_group_desc l

[PATCH 2/7] ext4: possible sbi->s_group_desc leak in ext4_fill_super

2018-10-31 Thread Vasily Averin
Fixes bfe0a5f47ada ("ext4: add more mount time checks of the superblock") # 4.18 Signed-off-by: Vasily Averin --- fs/ext4/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index a221f1cdf704..ed4d36506ec2 100644 --- a/fs/ex

[PATCH 1/7] ext4: lost brelse in __ext4_read_dirblock()

2018-10-31 Thread Vasily Averin
Fixes dc6982ff4db1 ("ext4: refactor code to read directory blocks ...") # 3.9 Signed-off-by: Vasily Averin --- fs/ext4/namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index d388cce72db2..1a21e59ede72 100644 --- a/fs/ext4/namei.c +++

[PATCH 1/7] ext4: lost brelse in __ext4_read_dirblock()

2018-10-31 Thread Vasily Averin
Fixes dc6982ff4db1 ("ext4: refactor code to read directory blocks ...") # 3.9 Signed-off-by: Vasily Averin --- fs/ext4/namei.c | 1 + 1 file changed, 1 insertion(+) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index d388cce72db2..1a21e59ede72 100644 --- a/fs/ext4/namei.c +++

[PATCH 2/7] ext4: possible sbi->s_group_desc leak in ext4_fill_super

2018-10-31 Thread Vasily Averin
Fixes bfe0a5f47ada ("ext4: add more mount time checks of the superblock") # 4.18 Signed-off-by: Vasily Averin --- fs/ext4/super.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index a221f1cdf704..ed4d36506ec2 100644 --- a/fs/ex

Re: [PATCH v2 11/11] ext4: access to uninitialized bh fields in ext4_xattr_set_handle()

2018-10-30 Thread Vasily Averin
hey *are* initialized to zero.  I did not know it, I re-checked it in generated assembler code and found that you are right and I was wrong. Please drop this patch, should I resend of rest of this patch set once again? Thank you, Vasily Averin

Re: [PATCH v2 11/11] ext4: access to uninitialized bh fields in ext4_xattr_set_handle()

2018-10-30 Thread Vasily Averin
hey *are* initialized to zero.  I did not know it, I re-checked it in generated assembler code and found that you are right and I was wrong. Please drop this patch, should I resend of rest of this patch set once again? Thank you, Vasily Averin

[PATCH v2 10/11] ext4: remove useless brelse call in ext4_xattr_inode_update_ref()

2018-10-30 Thread Vasily Averin
brelse(iloc.bh) is useless here, it is always called with iloc.bh = NULL Fixes dec214d00e0d ("ext4: xattr inode deduplication") # 4.13 cc: Tahsin Erdogan Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/ext4

[PATCH v2 11/11] ext4: access to uninitialized bh fields in ext4_xattr_set_handle()

2018-10-30 Thread Vasily Averin
can access uninitialized bh fields of on-stack located "is" and "bs" structures. Issue was inherited from ext3 and was present in first ext4 commit. Fixes ac27a0ec112a ("ext4: initial copy of files from ext3") # 2.6.19 Signed-off-by: Vasily Averin --- fs/ext4/xatt

[PATCH v2 08/11] ext4: lost brelse in ext4_orphan_add()

2018-10-30 Thread Vasily Averin
3617e579e0 ("ext4: Handle non empty on-disk orphan link") #2.6.34 cc: Dmitry Monakhov Signed-off-by: Vasily Averin --- fs/ext4/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 67a38532032a..d388cce72db2 100644 --- a/f

[PATCH v2 10/11] ext4: remove useless brelse call in ext4_xattr_inode_update_ref()

2018-10-30 Thread Vasily Averin
brelse(iloc.bh) is useless here, it is always called with iloc.bh = NULL Fixes dec214d00e0d ("ext4: xattr inode deduplication") # 4.13 cc: Tahsin Erdogan Signed-off-by: Vasily Averin --- fs/ext4/xattr.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/fs/ext4

[PATCH v2 11/11] ext4: access to uninitialized bh fields in ext4_xattr_set_handle()

2018-10-30 Thread Vasily Averin
can access uninitialized bh fields of on-stack located "is" and "bs" structures. Issue was inherited from ext3 and was present in first ext4 commit. Fixes ac27a0ec112a ("ext4: initial copy of files from ext3") # 2.6.19 Signed-off-by: Vasily Averin --- fs/ext4/xatt

[PATCH v2 08/11] ext4: lost brelse in ext4_orphan_add()

2018-10-30 Thread Vasily Averin
3617e579e0 ("ext4: Handle non empty on-disk orphan link") #2.6.34 cc: Dmitry Monakhov Signed-off-by: Vasily Averin --- fs/ext4/namei.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 67a38532032a..d388cce72db2 100644 --- a/f

[PATCH v2 09/11] ext4: iloc.bh cleanup in add_new_gdb()

2018-10-30 Thread Vasily Averin
iloc.bh was taken in ext4_reserve_inode_write() and released in ext4_mark_iloc_dirty(). It should not be released 2nd time in rollback after failed ext4_handle_dirty_metadata(gdb_bh) Fixes b40971426a83 ("ext4: add error checking to calls to ...") # 2.6.38 Signed-off-by: Vasily Averi

  1   2   3   4   >