Re: [PATCH] io_uring: Try to merge io requests only for regular files

2021-03-19 Thread Dmitry Monakhov
- stable@ 19.03.2021, 08:29, "Dmitry Monakhov" : > Otherwise we may endup blocking on pipe or socket. > > Fixes: 6d5d5ac ("io_uring: extend async work merge") > Testcase: > https://github.com/dmonakhov/liburing/commit/16d171b6ef9d68e6db66650a83d98c5c721d01

[PATCH] io_uring: Try to merge io requests only for regular files

2021-03-18 Thread Dmitry Monakhov
Otherwise we may endup blocking on pipe or socket. Fixes: 6d5d5ac ("io_uring: extend async work merge") Testcase: https://github.com/dmonakhov/liburing/commit/16d171b6ef9d68e6db66650a83d98c5c721d01f6 Signed-off-by: Dmitry Monakhov --- fs/io_uring.c | 3 +++ 1 file changed, 3

Re: [PATCH 1/1] nvme-pci: add the DISABLE_WRITE_ZEROES quirk for a Samsung PM1725a

2021-03-11 Thread Dmitry Monakhov
10.03.2021, 16:41, "Christoph Hellwig" : > On Wed, Mar 10, 2021 at 02:21:56PM +0100, Christoph Hellwig wrote: >>  Can you try this patch instead? >> >>  http://lists.infradead.org/pipermail/linux-nvme/2021-February/023183.html > > Actually, please try the patch below instead, it looks like our

[RESEND][PATCH] nvme-pci: add the DISABLE_WRITE_ZEROES quirk for a Samsung PM1725a

2021-03-10 Thread Dmitry Monakhov
:(WRITE_ZEROES) flags 0x0 phys_seg 0 prio class 0 Signed-off-by: Dmitry Monakhov --- drivers/nvme/host/pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 17ab332..7249ae7 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c

Re: [PATCH] bfq: fix blkio cgroup leakage

2020-08-11 Thread Dmitry Monakhov
Paolo Valente writes: >> Il giorno 9 lug 2020, alle ore 10:19, Dmitry Monakhov >> ha scritto: >> >> Paolo Valente writes: >> >>>> Il giorno 8 lug 2020, alle ore 19:48, Dmitry Monakhov >>>> ha scritto: >>>> >

[PATCH] bfq: fix blkio cgroup leakage v4

2020-08-11 Thread Dmitry Monakhov
p blkio /proc/cgroups truncate -s 1M img losetup /dev/loop0 img echo bfq > /sys/block/loop0/queue/scheduler grep blkio /proc/cgroups for ((i=0;i /sys/fs/cgroup/blkio/a/cgroup.procs dd if=/dev/loop0 bs=4k count=1 of=/dev/null iflag=direct 2> /dev/null echo 0 > /sys/fs/cgroup/blkio

[PATCH 1/2] lib/test_lockup.c: add measure_alloc_pages_wait option

2020-08-10 Thread Dmitry Monakhov
measure_alloc_pages_wait=Y measure maximum page allocation wait time Signed-off-by: Dmitry Monakhov --- lib/test_lockup.c | 27 +-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/lib/test_lockup.c b/lib/test_lockup.c index 0f81252..867b2f4 100644

[PATCH 2/2] lib/test_lockup.c: allow cond_resched inside iteration

2020-08-10 Thread Dmitry Monakhov
MUTEX reacquire_locks=Y\ cond_resched_inside=Y measure_lockup=Y & stress-ng -c $(nproc) --timeout 10s& time mkdir /sys/fs/cgroup/blkio/a time rmdir /sys/fs/cgroup/blkio/a Signed-off-by: Dmitry Monakhov --- lib/test_lockup.c | 45 + 1 file changed

[PATCH] lib/test_lockup.c: add parameters for cond_resched inside loop

2020-08-09 Thread Dmitry Monakhov
10s& time mkdir /sys/fs/cgroup/blkio/a Signed-off-by: Dmitry Monakhov --- lib/test_lockup.c | 44 +++- 1 file changed, 43 insertions(+), 1 deletion(-) diff --git a/lib/test_lockup.c b/lib/test_lockup.c index 0f81252..3e05d6e 100644 --- a/lib/test_lock

[PATCH] block: bfq fix blkio cgroup leakage v3

2020-07-27 Thread Dmitry Monakhov
dir /sys/fs/cgroup/blkio/a grep blkio /proc/cgroups done ##TESTCASE_END: changes since v2: - use safe iteration macro to prevent freed object dereference. Signed-off-by: Dmitry Monakhov --- block/bfq-wf2q.c | 24 ++-- 1 file changed, 14 insertions(+), 10 deletions(-) diff --

[PATCH] block: bfq fix blkio cgroup leakage v2

2020-07-20 Thread Dmitry Monakhov
truncate -s 1M img losetup /dev/loop0 img echo bfq > /sys/block/loop0/queue/scheduler grep blkio /proc/cgroups for ((i=0;i /sys/fs/cgroup/blkio/a/cgroup.procs dd if=/dev/loop0 bs=4k count=1 of=/dev/null iflag=direct 2> /dev/null echo 0 > /sys/fs/cgroup/blkio/cgroup.procs rmdir /

Re: [PATCH] bfq: fix blkio cgroup leakage

2020-07-20 Thread Dmitry Monakhov
Paolo Valente writes: >> Il giorno 9 lug 2020, alle ore 10:19, Dmitry Monakhov >> ha scritto: >> >> Paolo Valente writes: >> >>>> Il giorno 8 lug 2020, alle ore 19:48, Dmitry Monakhov >>>> ha scritto: >>>> >>>>

Re: [PATCH] bfq: fix blkio cgroup leakage

2020-07-09 Thread Dmitry Monakhov
Paolo Valente writes: >> Il giorno 8 lug 2020, alle ore 19:48, Dmitry Monakhov >> ha scritto: >> >> Paolo Valente writes: >> >>> Hi, >>> sorry for the delay. The commit you propose to drop fix the issues >>> reported in [1]. >&

Re: [PATCH] bfq: fix blkio cgroup leakage

2020-07-08 Thread Dmitry Monakhov
l one. Please correct me if I'm wrong. > > I'll check it ASAP, unless you do it before me. > > Thanks, > Paolo > > [1] https://lkml.org/lkml/2020/1/31/94 > >> Il giorno 2 lug 2020, alle ore 12:57, Dmitry Monakhov >> ha scritto: >> >> commit db37a34c

Re: [PATCH] bfq: fix blkio cgroup leakage

2020-07-08 Thread Dmitry Monakhov
Dmitry Monakhov writes: Ping. Do you have any objections against this patch? > commit db37a34c563b ("block, bfq: get a ref to a group when adding it to a > service tree") > introduce leak forbfq_group and blkcg_gq objects because of get/put > imbalance. See trace

[PATCH] bfq: fix blkio cgroup leakage

2020-07-02 Thread Dmitry Monakhov
ck/loop0/queue/scheduler grep blkio /proc/cgroups for ((i=0;i /sys/fs/cgroup/blkio/a/cgroup.procs dd if=/dev/loop0 bs=4k count=1 of=/dev/null iflag=direct 2> /dev/null echo 0 > /sys/fs/cgroup/blkio/cgroup.procs rmdir /sys/fs/cgroup/blkio/a grep blkio /proc/cgroups done ##TESTCASE_E

[PATCH] bfq: fix blkio cgroup leakage

2020-06-28 Thread Dmitry Monakhov
ck/loop0/queue/scheduler grep blkio /proc/cgroups for ((i=0;i /sys/fs/cgroup/blkio/a/cgroup.procs dd if=/dev/loop0 bs=4k count=1 of=/dev/null iflag=direct 2> /dev/null echo 0 > /sys/fs/cgroup/blkio/cgroup.procs rmdir /sys/fs/cgroup/blkio/a grep blkio /proc/cgroups done ##TESTCASE_E

Re: [PATCH 0/9] block: T10/DIF Fixes and cleanups v3

2017-05-10 Thread Dmitry Monakhov
Christoph Hellwig writes: > Hi Dmitry, > > can you resend this series? Sorry for a very long delay, I'm in the middle of honeymoon and this is not a good time for a work :) > I really think we should get this into 4.12 at least. Please see updated version in the LKML list.

Re: [PATCH 0/9] block: T10/DIF Fixes and cleanups v3

2017-05-10 Thread Dmitry Monakhov
Christoph Hellwig writes: > Hi Dmitry, > > can you resend this series? Sorry for a very long delay, I'm in the middle of honeymoon and this is not a good time for a work :) > I really think we should get this into 4.12 at least. Please see updated version in the LKML list.

Re: [PATCH 3/9] bio-integrity: bio_integrity_advance must update integrity seed

2017-05-03 Thread Dmitry Monakhov
"Martin K. Petersen" <martin.peter...@oracle.com> writes: > Dmitry Monakhov <dmonak...@openvz.org> writes: > >> SCSI drivers do care about bip_seed so we must update it accordingly. > >> +bip->bip_iter.bi_sector += bytes_done >> 9; >

Re: [PATCH 3/9] bio-integrity: bio_integrity_advance must update integrity seed

2017-05-03 Thread Dmitry Monakhov
"Martin K. Petersen" writes: > Dmitry Monakhov writes: > >> SCSI drivers do care about bip_seed so we must update it accordingly. > >> +bip->bip_iter.bi_sector += bytes_done >> 9; > > This needs to count protection intervals. Otherwise things w

Re: [PATCH 1/5] bh: Prevent panic on invalid BHs

2017-04-06 Thread Dmitry Monakhov
Christoph Hellwig writes: > This look ok, but how did you manage to trigger this case? # testcases # TEST1 # Via bug in fallocate truncate -l 1G img losetup /dev/loop img mkfs.ext4 -qF /dev/loop0 mkdir m mount /dev/loop0 m # command above truncate bdevs pagecache xfs_io -c

Re: [PATCH 1/5] bh: Prevent panic on invalid BHs

2017-04-06 Thread Dmitry Monakhov
Christoph Hellwig writes: > This look ok, but how did you manage to trigger this case? # testcases # TEST1 # Via bug in fallocate truncate -l 1G img losetup /dev/loop img mkfs.ext4 -qF /dev/loop0 mkdir m mount /dev/loop0 m # command above truncate bdevs pagecache xfs_io -c "falloc -k 0 32G"

Re: [PATCH 5/5] block: truncate page cache only when necessary on fallocate

2017-04-06 Thread Dmitry Monakhov
ENOTSUPP unconditionally. IMHO (mode == FALLOC_FL_KEEP_SIZE) is sane API for thin-provision blkdevs to preallocate space in advance. Nobody use it at the moment, but it may be usefull in future. > > On Thu, Apr 06, 2017 at 04:02:49PM +0400, Dmitry Monakhov wrote: >> Signed-off-by: Dm

Re: [PATCH 5/5] block: truncate page cache only when necessary on fallocate

2017-04-06 Thread Dmitry Monakhov
MHO (mode == FALLOC_FL_KEEP_SIZE) is sane API for thin-provision blkdevs to preallocate space in advance. Nobody use it at the moment, but it may be usefull in future. > > On Thu, Apr 06, 2017 at 04:02:49PM +0400, Dmitry Monakhov wrote: >> Signed-off-by: Dmitry Monakhov >> --- &

[PATCH 2/5] block: protect bdevname from null pointer bdev

2017-04-06 Thread Dmitry Monakhov
Some callers (usually error paths) call bdevname with null bdev. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/partition-generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/partition-generic.c b/block/partition-generic.c index 7afb990..284de18

[PATCH 3/5] bio: Protect submit_bio from bdevless bio-s

2017-04-06 Thread Dmitry Monakhov
Idially this type of check should be handled at generic_make_request_checks , but it is too late for bdevless bios, bad pointer was already dereferenced at that point. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/blk-core.c | 5 + 1 file changed, 5 insertions(+)

[PATCH 2/5] block: protect bdevname from null pointer bdev

2017-04-06 Thread Dmitry Monakhov
Some callers (usually error paths) call bdevname with null bdev. Signed-off-by: Dmitry Monakhov --- block/partition-generic.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/partition-generic.c b/block/partition-generic.c index 7afb990..284de18 100644 --- a/block/partition-generic.c

[PATCH 3/5] bio: Protect submit_bio from bdevless bio-s

2017-04-06 Thread Dmitry Monakhov
Idially this type of check should be handled at generic_make_request_checks , but it is too late for bdevless bios, bad pointer was already dereferenced at that point. Signed-off-by: Dmitry Monakhov --- block/blk-core.c | 5 + 1 file changed, 5 insertions(+) diff --git a/block/blk-core.c b

[PATCH 1/5] bh: Prevent panic on invalid BHs

2017-04-06 Thread Dmitry Monakhov
ard __find_get_block from null pointer bdev. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- fs/buffer.c | 24 +++- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 9196f2a..4c8ce74 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @

[PATCH 1/5] bh: Prevent panic on invalid BHs

2017-04-06 Thread Dmitry Monakhov
ard __find_get_block from null pointer bdev. Signed-off-by: Dmitry Monakhov --- fs/buffer.c | 24 +++- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/fs/buffer.c b/fs/buffer.c index 9196f2a..4c8ce74 100644 --- a/fs/buffer.c +++ b/fs/buffer.c @@ -1355,8 +1355,12 @@ lookup_bh_

[PATCH 5/5] block: truncate page cache only when necessary on fallocate

2017-04-06 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- fs/block_dev.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 2eca00e..f4b13e1 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -2075,7 +2075,7 @@ stati

[PATCH 4/5] jbd2: use stable bdev pointer

2017-04-06 Thread Dmitry Monakhov
This prevent us from panic if someone invalidate bh under us. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- fs/jbd2/revoke.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index f9aefcd..e3b791d 100644 --- a/fs/jbd2/re

[PATCH 5/5] block: truncate page cache only when necessary on fallocate

2017-04-06 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov --- fs/block_dev.c | 9 - 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/fs/block_dev.c b/fs/block_dev.c index 2eca00e..f4b13e1 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c @@ -2075,7 +2075,7 @@ static long blkdev_fallocate(struct file

[PATCH 4/5] jbd2: use stable bdev pointer

2017-04-06 Thread Dmitry Monakhov
This prevent us from panic if someone invalidate bh under us. Signed-off-by: Dmitry Monakhov --- fs/jbd2/revoke.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/fs/jbd2/revoke.c b/fs/jbd2/revoke.c index f9aefcd..e3b791d 100644 --- a/fs/jbd2/revoke.c +++ b/fs/jbd2/revoke.c

[PATCH 0/5] falloc on blockdevice: what possibly can go whong?

2017-04-06 Thread Dmitry Monakhov
If you saw a command "fallocate -k -l 1G /dev/vda" you probably think that user want to preallocate space on thin-provision blkdev. Right? What possibly can go wrong? Unfortunately you may destroy your filesystem and kernel panic. The reason is the bug in blkdev_fallocate() which unconditionally

[PATCH 0/5] falloc on blockdevice: what possibly can go whong?

2017-04-06 Thread Dmitry Monakhov
If you saw a command "fallocate -k -l 1G /dev/vda" you probably think that user want to preallocate space on thin-provision blkdev. Right? What possibly can go wrong? Unfortunately you may destroy your filesystem and kernel panic. The reason is the bug in blkdev_fallocate() which unconditionally

[PATCH 1/9] bio-integrity: Do not allocate integrity context for bio w/o data

2017-04-04 Thread Dmitry Monakhov
blkdev_issue_flush+0x7a/0x85 blkdev_fsync+0x35/0x42 vfs_fsync_range+0x8e/0x9f vfs_fsync+0x1c/0x1e do_fsync+0x31/0x4a SyS_fsync+0x10/0x14 entry_SYSCALL_64_fastpath+0x1f/0xc2 Reviewed-by: Christoph Hellwig <h...@lst.de> Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --

[PATCH 1/9] bio-integrity: Do not allocate integrity context for bio w/o data

2017-04-04 Thread Dmitry Monakhov
blkdev_issue_flush+0x7a/0x85 blkdev_fsync+0x35/0x42 vfs_fsync_range+0x8e/0x9f vfs_fsync+0x1c/0x1e do_fsync+0x31/0x4a SyS_fsync+0x10/0x14 entry_SYSCALL_64_fastpath+0x1f/0xc2 Reviewed-by: Christoph Hellwig Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 3 +++ 1 file changed, 3

[PATCH 3/9] bio-integrity: bio_integrity_advance must update integrity seed

2017-04-04 Thread Dmitry Monakhov
SCSI drivers do care about bip_seed so we must update it accordingly. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index b5009a8..82a6ffb 100644 --- a/blo

[PATCH 3/9] bio-integrity: bio_integrity_advance must update integrity seed

2017-04-04 Thread Dmitry Monakhov
SCSI drivers do care about bip_seed so we must update it accordingly. Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 1 + 1 file changed, 1 insertion(+) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index b5009a8..82a6ffb 100644 --- a/block/bio-integrity.c +++ b/block

[PATCH 4/9] bio-integrity: fix interface for bio_integrity_trim v2

2017-04-04 Thread Dmitry Monakhov
== bio_sectors(bio) Let's just remove them completely. changes from v1: - remove 'sectors' arguments Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 11 ++- block/bio.c | 4 ++-- drivers/md/dm.c | 2 +- include/linux/bio.h | 5 ++

[PATCH 4/9] bio-integrity: fix interface for bio_integrity_trim v2

2017-04-04 Thread Dmitry Monakhov
== bio_sectors(bio) Let's just remove them completely. changes from v1: - remove 'sectors' arguments Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 11 ++- block/bio.c | 4 ++-- drivers/md/dm.c | 2 +- include/linux/bio.h | 5 ++--- 4 files changed, 7

[PATCH 8/9] bio: add bvec_iter rewind API

2017-04-04 Thread Dmitry Monakhov
tes iterator was advanced during it's evolution. Later end_io handler may easily restore original iterator by rewinding iterator to iter->bi_done. Note: this change makes sizeof (struct bvec_iter) multiple to 8 Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- include/linux

[PATCH 8/9] bio: add bvec_iter rewind API

2017-04-04 Thread Dmitry Monakhov
tes iterator was advanced during it's evolution. Later end_io handler may easily restore original iterator by rewinding iterator to iter->bi_done. Note: this change makes sizeof (struct bvec_iter) multiple to 8 Signed-off-by: Dmitry Monakhov --- include/linux/bio.h | 21 +++-- include

[PATCH 7/9] Guard bvec iteration logic v3

2017-04-04 Thread Dmitry Monakhov
. This patch does: - Return error back to caller with hope that it will react on this - Truncate iterator size Code was added long time ago here 4550dd6c, luckily no one hit it in real life :) changes since V1: - Replace BUG_ON with error logic. Signed-off-by: Dmitry Monakhov <dmo

[PATCH 7/9] Guard bvec iteration logic v3

2017-04-04 Thread Dmitry Monakhov
. This patch does: - Return error back to caller with hope that it will react on this - Truncate iterator size Code was added long time ago here 4550dd6c, luckily no one hit it in real life :) changes since V1: - Replace BUG_ON with error logic. Signed-off-by: Dmitry Monakhov --- drivers

[PATCH 6/9] T10: Move opencoded contants to common header

2017-04-04 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/t10-pi.c | 9 +++-- drivers/scsi/lpfc/lpfc_scsi.c| 5 +++-- drivers/scsi/qla2xxx/qla_isr.c | 8 drivers/target/target_core_sbc.c | 2 +- include/linux/t10-pi.h | 2 ++ 5 files c

[PATCH 6/9] T10: Move opencoded contants to common header

2017-04-04 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov --- block/t10-pi.c | 9 +++-- drivers/scsi/lpfc/lpfc_scsi.c| 5 +++-- drivers/scsi/qla2xxx/qla_isr.c | 8 drivers/target/target_core_sbc.c | 2 +- include/linux/t10-pi.h | 2 ++ 5 files changed, 13 insertions(+), 13

[PATCH 9/9] bio-integrity: Restore original iterator on verify stage

2017-04-04 Thread Dmitry Monakhov
ub.com/dmonakhov/xfstests/commit/3c6509eaa83b9c17cd0bc95d73fcdd76e1c54a85 Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index f2b9

[PATCH 5/9] bio-integrity: fold bio_integrity_enabled to bio_integrity_prep

2017-04-04 Thread Dmitry Monakhov
it in to one function. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- Documentation/block/data-integrity.txt | 3 -- block/bio-integrity.c | 88 ++ block/blk-core.c | 5 +- block/bl

[PATCH 9/9] bio-integrity: Restore original iterator on verify stage

2017-04-04 Thread Dmitry Monakhov
ub.com/dmonakhov/xfstests/commit/3c6509eaa83b9c17cd0bc95d73fcdd76e1c54a85 Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 22 +++--- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index f2b9f09..f08096d 100644 --- a

[PATCH 5/9] bio-integrity: fold bio_integrity_enabled to bio_integrity_prep

2017-04-04 Thread Dmitry Monakhov
it in to one function. Signed-off-by: Dmitry Monakhov --- Documentation/block/data-integrity.txt | 3 -- block/bio-integrity.c | 88 ++ block/blk-core.c | 5 +- block/blk-mq.c | 8 +--- drivers

[PATCH 0/9] block: T10/DIF Fixes and cleanups v3

2017-04-04 Thread Dmitry Monakhov
This patch set fix various problems spotted during T10/DIF integrity machinery testing. TOC: ## Fix various bugs in T10/DIF/DIX infrastructure 0001-bio-integrity-Do-not-allocate-integrity-context-for 0002-bio-integrity-bio_trim-should-truncate-integrity-vec

[PATCH 0/9] block: T10/DIF Fixes and cleanups v3

2017-04-04 Thread Dmitry Monakhov
This patch set fix various problems spotted during T10/DIF integrity machinery testing. TOC: ## Fix various bugs in T10/DIF/DIX infrastructure 0001-bio-integrity-Do-not-allocate-integrity-context-for 0002-bio-integrity-bio_trim-should-truncate-integrity-vec

[PATCH 2/9] bio-integrity: bio_trim should truncate integrity vector accordingly

2017-04-04 Thread Dmitry Monakhov
Reviewed-by: Christoph Hellwig <h...@lst.de> Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio.c | 4 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index e75878f..fa84323 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1907,6 +190

[PATCH 2/9] bio-integrity: bio_trim should truncate integrity vector accordingly

2017-04-04 Thread Dmitry Monakhov
Reviewed-by: Christoph Hellwig Signed-off-by: Dmitry Monakhov --- block/bio.c | 4 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index e75878f..fa84323 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1907,6 +1907,10 @@ void bio_trim(struct bio *bio, int offset, int

Re: [PATCH 7/7] Guard bvec iteration logic v2

2017-04-04 Thread Dmitry Monakhov
Ming Lei <tom.leim...@gmail.com> writes: > On Mon, Apr 3, 2017 at 3:23 PM, Dmitry Monakhov <dmonak...@openvz.org> wrote: >> Currently if some one try to advance bvec beyond it's size we simply >> dump WARN_ONCE and continue to iterate beyond bvec array boundaries. &

Re: [PATCH 7/7] Guard bvec iteration logic v2

2017-04-04 Thread Dmitry Monakhov
Ming Lei writes: > On Mon, Apr 3, 2017 at 3:23 PM, Dmitry Monakhov wrote: >> Currently if some one try to advance bvec beyond it's size we simply >> dump WARN_ONCE and continue to iterate beyond bvec array boundaries. >> This simply means that we endup dereferencing/cor

Re: [PATCH 2/7] bio-integrity: save original iterator for verify stage

2017-04-04 Thread Dmitry Monakhov
Christoph Hellwig writes: > This is a pretty big increase in the bio_integrity_payload size, > but I guess we can't get around it.. Yes, everybody hate this solution, me too, but I've stated with other approach and it is appeaded to be very ugly. My idea was that we have

Re: [PATCH 2/7] bio-integrity: save original iterator for verify stage

2017-04-04 Thread Dmitry Monakhov
Christoph Hellwig writes: > This is a pretty big increase in the bio_integrity_payload size, > but I guess we can't get around it.. Yes, everybody hate this solution, me too, but I've stated with other approach and it is appeaded to be very ugly. My idea was that we have two types of iterator

[PATCH 1/7] bio-integrity: Do not allocate integrity context for bio w/o data

2017-04-03 Thread Dmitry Monakhov
blkdev_issue_flush+0x7a/0x85 blkdev_fsync+0x35/0x42 vfs_fsync_range+0x8e/0x9f vfs_fsync+0x1c/0x1e do_fsync+0x31/0x4a SyS_fsync+0x10/0x14 entry_SYSCALL_64_fastpath+0x1f/0xc2 Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 3 +++ 1 file changed, 3 inse

[PATCH 1/7] bio-integrity: Do not allocate integrity context for bio w/o data

2017-04-03 Thread Dmitry Monakhov
blkdev_issue_flush+0x7a/0x85 blkdev_fsync+0x35/0x42 vfs_fsync_range+0x8e/0x9f vfs_fsync+0x1c/0x1e do_fsync+0x31/0x4a SyS_fsync+0x10/0x14 entry_SYSCALL_64_fastpath+0x1f/0xc2 Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block

[PATCH 3/7] bio-integrity: bio_trim should truncate integrity vector accordingly

2017-04-03 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio.c | 4 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index e75878f..fa84323 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1907,6 +1907,10 @@ void bio_trim(struct bio *bio, int offset, in

[PATCH 3/7] bio-integrity: bio_trim should truncate integrity vector accordingly

2017-04-03 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov --- block/bio.c | 4 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index e75878f..fa84323 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1907,6 +1907,10 @@ void bio_trim(struct bio *bio, int offset, int size) bio_advance(bio

[PATCH 4/7] bio-integrity: fix interface for bio_integrity_trim

2017-04-03 Thread Dmitry Monakhov
it completely. TODO: add xfstests testcase here Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 8 +--- block/bio.c | 4 ++-- drivers/md/dm.c | 2 +- include/linux/bio.h | 5 ++--- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a

[PATCH 4/7] bio-integrity: fix interface for bio_integrity_trim

2017-04-03 Thread Dmitry Monakhov
it completely. TODO: add xfstests testcase here Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 8 +--- block/bio.c | 4 ++-- drivers/md/dm.c | 2 +- include/linux/bio.h | 5 ++--- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/block/bio-integrity.c b

[PATCH 2/7] bio-integrity: save original iterator for verify stage

2017-04-03 Thread Dmitry Monakhov
bio->bi_iter.bi_size == 0 The simplest way to fix that is to save original data vector and treat is as immutable. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 6 -- include/linux/bio.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git

[PATCH 5/7] bio-integrity: add bio_integrity_setup helper

2017-04-03 Thread Dmitry Monakhov
Currently all integrity prep hooks are open-coded, and if prepare fails we ignore it's code and fail bio with EIO. Let's return real error to upper layer, so later caller may react accordingly. For example retry in case of ENOMEM. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> ---

[PATCH 2/7] bio-integrity: save original iterator for verify stage

2017-04-03 Thread Dmitry Monakhov
bio->bi_iter.bi_size == 0 The simplest way to fix that is to save original data vector and treat is as immutable. Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 6 -- include/linux/bio.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/block/bio-integrity.c b/blo

[PATCH 5/7] bio-integrity: add bio_integrity_setup helper

2017-04-03 Thread Dmitry Monakhov
Currently all integrity prep hooks are open-coded, and if prepare fails we ignore it's code and fail bio with EIO. Let's return real error to upper layer, so later caller may react accordingly. For example retry in case of ENOMEM. Signed-off-by: Dmitry Monakhov --- block/blk-core.c | 5

[PATCH 0/7] block: T10/DIF Fixes and cleanups v2

2017-04-03 Thread Dmitry Monakhov
This patch set fix various problems spotted during T10/DIF integrity machinery testing. TOC: ## Fix various bugs in T10/DIF/DIX infrastructure 0001-bio-integrity-Do-not-allocate-integrity-context-for-fsync 0002-bio-integrity-save-original-iterator-for-verify-stage

[PATCH 6/7] T10: Move opencoded contants to common header

2017-04-03 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/t10-pi.c | 9 +++-- drivers/scsi/lpfc/lpfc_scsi.c| 5 +++-- drivers/scsi/qla2xxx/qla_isr.c | 8 drivers/target/target_core_sbc.c | 2 +- include/linux/t10-pi.h | 3 +++ 5 files c

[PATCH 7/7] Guard bvec iteration logic v2

2017-04-03 Thread Dmitry Monakhov
. This patch does: - Return error back to caller with hope that it will react on this - Truncate iterator size Code was added long time ago here 4550dd6c, luckily no one hit it in real life :) changes since V1: - Replace BUG_ON with error logic. Signed-off-by: Dmitry Monakhov <dmo

[PATCH 0/7] block: T10/DIF Fixes and cleanups v2

2017-04-03 Thread Dmitry Monakhov
This patch set fix various problems spotted during T10/DIF integrity machinery testing. TOC: ## Fix various bugs in T10/DIF/DIX infrastructure 0001-bio-integrity-Do-not-allocate-integrity-context-for-fsync 0002-bio-integrity-save-original-iterator-for-verify-stage

[PATCH 6/7] T10: Move opencoded contants to common header

2017-04-03 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov --- block/t10-pi.c | 9 +++-- drivers/scsi/lpfc/lpfc_scsi.c| 5 +++-- drivers/scsi/qla2xxx/qla_isr.c | 8 drivers/target/target_core_sbc.c | 2 +- include/linux/t10-pi.h | 3 +++ 5 files changed, 14 insertions(+), 13

[PATCH 7/7] Guard bvec iteration logic v2

2017-04-03 Thread Dmitry Monakhov
. This patch does: - Return error back to caller with hope that it will react on this - Truncate iterator size Code was added long time ago here 4550dd6c, luckily no one hit it in real life :) changes since V1: - Replace BUG_ON with error logic. Signed-off-by: Dmitry Monakhov --- drivers

[PATCH 3/8] bio-integrity: save original iterator for verify stage

2017-03-30 Thread Dmitry Monakhov
bio->bi_iter.bi_size == 0 The simplest way to fix that is to save original data vector and treat is as immutable. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 6 -- include/linux/bio.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git

[PATCH 3/8] bio-integrity: save original iterator for verify stage

2017-03-30 Thread Dmitry Monakhov
bio->bi_iter.bi_size == 0 The simplest way to fix that is to save original data vector and treat is as immutable. Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 6 -- include/linux/bio.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/block/bio-integrity.c b/blo

[PATCH 4/8] bio-integrity: bio_trim should truncate integrity vector accordingly

2017-03-30 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio.c | 4 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index e75878f..fa84323 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1907,6 +1907,10 @@ void bio_trim(struct bio *bio, int offset, in

[PATCH 4/8] bio-integrity: bio_trim should truncate integrity vector accordingly

2017-03-30 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov --- block/bio.c | 4 1 file changed, 4 insertions(+) diff --git a/block/bio.c b/block/bio.c index e75878f..fa84323 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1907,6 +1907,10 @@ void bio_trim(struct bio *bio, int offset, int size) bio_advance(bio

[PATCH 7/8] T10: Move opencoded contants to common header

2017-03-30 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/t10-pi.c | 9 +++-- drivers/scsi/lpfc/lpfc_scsi.c| 4 ++-- drivers/scsi/qla2xxx/qla_isr.c | 8 drivers/target/target_core_sbc.c | 2 +- include/linux/t10-pi.h | 3 +++ 5 files c

[PATCH 7/8] T10: Move opencoded contants to common header

2017-03-30 Thread Dmitry Monakhov
Signed-off-by: Dmitry Monakhov --- block/t10-pi.c | 9 +++-- drivers/scsi/lpfc/lpfc_scsi.c| 4 ++-- drivers/scsi/qla2xxx/qla_isr.c | 8 drivers/target/target_core_sbc.c | 2 +- include/linux/t10-pi.h | 3 +++ 5 files changed, 13 insertions(+), 13

[PATCH 5/8] bio-integrity: fix interface for bio_integrity_trim

2017-03-30 Thread Dmitry Monakhov
it completely. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 8 +--- block/bio.c | 4 ++-- drivers/md/dm.c | 2 +- include/linux/bio.h | 5 ++--- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/block/bio-integrity.c b/blo

[PATCH 1/8] Guard bvec iteration logic

2017-03-30 Thread Dmitry Monakhov
:) Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- include/linux/bvec.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 89b65b8..86b914f 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -70,8

[PATCH 6/8] bio-integrity: add bio_integrity_setup helper

2017-03-30 Thread Dmitry Monakhov
Currently all integrity prep hooks are open-coded, and if prepare fails we ignore it's code and fail bio with EIO. Let's return real error to upper layer, so later caller may react accordingly. For example retry in case of ENOMEM. Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> ---

[PATCH 5/8] bio-integrity: fix interface for bio_integrity_trim

2017-03-30 Thread Dmitry Monakhov
it completely. Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 8 +--- block/bio.c | 4 ++-- drivers/md/dm.c | 2 +- include/linux/bio.h | 5 ++--- 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/block/bio-integrity.c b/block/bio-integrity.c index

[PATCH 1/8] Guard bvec iteration logic

2017-03-30 Thread Dmitry Monakhov
:) Signed-off-by: Dmitry Monakhov --- include/linux/bvec.h | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/include/linux/bvec.h b/include/linux/bvec.h index 89b65b8..86b914f 100644 --- a/include/linux/bvec.h +++ b/include/linux/bvec.h @@ -70,8 +70,7 @@ static inline void

[PATCH 6/8] bio-integrity: add bio_integrity_setup helper

2017-03-30 Thread Dmitry Monakhov
Currently all integrity prep hooks are open-coded, and if prepare fails we ignore it's code and fail bio with EIO. Let's return real error to upper layer, so later caller may react accordingly. For example retry in case of ENOMEM. Signed-off-by: Dmitry Monakhov --- block/blk-core.c | 5

[PATCH 8/8] tcm_fileio: Prevent information leak for short reads

2017-03-30 Thread Dmitry Monakhov
/?l=linux-scsi=149087996913448=2 Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- drivers/target/target_core_file.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 8

[PATCH 8/8] tcm_fileio: Prevent information leak for short reads

2017-03-30 Thread Dmitry Monakhov
/?l=linux-scsi=149087996913448=2 Signed-off-by: Dmitry Monakhov --- drivers/target/target_core_file.c | 21 +++-- 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_file.c b/drivers/target/target_core_file.c index 87aa376..d69908d 100644

[PATCH 2/8] bio-integrity: Do not allocate integrity context for bio w/o data

2017-03-30 Thread Dmitry Monakhov
blkdev_issue_flush+0x7a/0x85 blkdev_fsync+0x35/0x42 vfs_fsync_range+0x8e/0x9f vfs_fsync+0x1c/0x1e do_fsync+0x31/0x4a SyS_fsync+0x10/0x14 entry_SYSCALL_64_fastpath+0x1f/0xc2 Signed-off-by: Dmitry Monakhov <dmonak...@openvz.org> --- block/bio-integrity.c | 3 +++ 1 file changed, 3 inse

[PATCH 2/8] bio-integrity: Do not allocate integrity context for bio w/o data

2017-03-30 Thread Dmitry Monakhov
blkdev_issue_flush+0x7a/0x85 blkdev_fsync+0x35/0x42 vfs_fsync_range+0x8e/0x9f vfs_fsync+0x1c/0x1e do_fsync+0x31/0x4a SyS_fsync+0x10/0x14 entry_SYSCALL_64_fastpath+0x1f/0xc2 Signed-off-by: Dmitry Monakhov --- block/bio-integrity.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/block

[PATCH 0/8] block: T10/DIF Fixes and cleanups

2017-03-30 Thread Dmitry Monakhov
This patch set fix various problems spotted during T10/DIF integrity machinery testing. TOC: ## General bulletproof protection for block layer 0001 Guard bvec iteration logic ## Fix various bugs in T10/DIF/DIX infrastructure 0002 bio integrity: Do not allocate integrity context for 0003 bio

[PATCH 0/8] block: T10/DIF Fixes and cleanups

2017-03-30 Thread Dmitry Monakhov
This patch set fix various problems spotted during T10/DIF integrity machinery testing. TOC: ## General bulletproof protection for block layer 0001 Guard bvec iteration logic ## Fix various bugs in T10/DIF/DIX infrastructure 0002 bio integrity: Do not allocate integrity context for 0003 bio

Re: scsi_debug: shared dev context, BUG or FEATURE?

2017-03-28 Thread Dmitry Monakhov
"Martin K. Petersen" <martin.peter...@oracle.com> writes: > Dmitry Monakhov <dmonak...@openvz.org> writes: > > Dmitry, > >> scsi_debug has very strange structure from one point it supports >> dynamic number of devices but from other point context is c

Re: scsi_debug: shared dev context, BUG or FEATURE?

2017-03-28 Thread Dmitry Monakhov
"Martin K. Petersen" writes: > Dmitry Monakhov writes: > > Dmitry, > >> scsi_debug has very strange structure from one point it supports >> dynamic number of devices but from other point context is common for >> all devices: > >> So basically w

scsi_debug: shared dev context, BUG or FEATURE?

2017-03-27 Thread Dmitry Monakhov
Hi scsi_debug has very strange structure from one point it supports dynamic number of devices but from other point context is common for all devices: - dif_storep (array of t10 dif tuples) - map_storep (block map for thinprovision) - fake_storep (in memory data storage) - sdebug_q_arr (queue

scsi_debug: shared dev context, BUG or FEATURE?

2017-03-27 Thread Dmitry Monakhov
Hi scsi_debug has very strange structure from one point it supports dynamic number of devices but from other point context is common for all devices: - dif_storep (array of t10 dif tuples) - map_storep (block map for thinprovision) - fake_storep (in memory data storage) - sdebug_q_arr (queue

[PATCH] block: Invalidate cache on discard v2

2017-03-22 Thread Dmitry Monakhov
It is reasonable drop page cache on discard, otherwise that pages may be written by writeback second later, so thin provision devices will not be happy. This seems to be a security leak in case of secure discard case. Also add check for queue_discard flag on early stage. Signed-off-by: Dmitry

  1   2   3   4   5   >