[PATCH] blk-mq: I/O and timer unplugs are inverted in blktrace

2018-09-26 Thread Ilya Dryomov
lk-mq-sched: add framework for MQ capable IO schedulers") Signed-off-by: Ilya Dryomov --- block/blk-mq.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 85a1c1a59c72..e3c39ea8e17b 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c

Re: [PATCH] [v2] rbd: avoid Wreturn-type warnings

2018-04-04 Thread Ilya Dryomov
On Wed, Apr 4, 2018 at 2:53 PM, Arnd Bergmann wrote: > A new set of warnings appeared in next-20180403 in some configurations > when gcc cannot see that rbd_assert(0) leads to an unreachable code > path: > > drivers/block/rbd.c: In function 'rbd_img_is_write': >

Re: [PATCH] rbd: add missing return statements

2018-04-04 Thread Ilya Dryomov
On Wed, Apr 4, 2018 at 11:49 AM, Arnd Bergmann wrote: > A new set of warnings appeared in next-20180403 in some configurations > when gcc cannot see that rbd_assert(0) leads to an unreachable code > path: > > drivers/block/rbd.c: In function 'rbd_img_is_write': >

Re: [PATCH] rbd: remove VLA usage

2018-03-30 Thread Ilya Dryomov
On Fri, Mar 30, 2018 at 9:17 PM, Gustavo A. R. Silva wrote: > In preparation to enabling -Wvla, remove the use of stack VLA. > > In this particular case, variable buf_size is replaced with a constant > expression that can be computed at preprocessing time. This avoids two

Re: [PATCH] rbd: fix spelling mistake: "reregisteration" -> "re-registration"

2018-03-20 Thread Ilya Dryomov
On Tue, Mar 20, 2018 at 11:39 AM, Colin Ian King wrote: > On 20/03/18 10:35, Dongsheng Yang wrote: >> Hi Colin, >> >> On 03/19/2018 09:33 PM, Colin King wrote: >>> From: Colin Ian King >>> >>> Trivial fix to spelling mistake in rdb_warn message

Re: [PATCH v3 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro()

2018-01-18 Thread Ilya Dryomov
On Thu, Jan 11, 2018 at 2:09 PM, Ilya Dryomov <idryo...@gmail.com> wrote: > Hello, > > I was doing some cleanup work on rbd BLKROSET handler and discovered > that we ignore partition rw/ro setting (hd_struct->policy) for pretty > much everything but straight writes. >

[PATCH v3 2/2] block: add bdev_read_only() checks to common helpers

2018-01-11 Thread Ilya Dryomov
Similar to blkdev_write_iter(), return -EPERM if the partition is read-only. This covers ioctl(), fallocate() and most in-kernel users but isn't meant to be exhaustive -- everything else will be caught in generic_make_request_checks(), fail with -EIO and can be fixed later. Signed-off-by: Ilya

[PATCH v3 1/2] block: fail op_is_write() requests to read-only partitions

2018-01-11 Thread Ilya Dryomov
(), which is used by quite a few drivers for things like snapshots, read-only backing files/images, etc. Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- block/blk-core.c | 56 ++-- 1 file changed, 38 insertions(+), 18 deletions(-) diff

[PATCH v3 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro()

2018-01-11 Thread Ilya Dryomov
bviously more important, but perhaps it's time to revisit that as well?) v2 -> v3: - lookup part only once; combine read-only check with existing should_fail_request check v1 -> v2: - added unlikely() per Sagi's suggestion Thanks, Ilya Ilya Dryomov (2): block: fail op_is_

Re: [PATCH v2 1/2] block: fail op_is_write() requests to read-only partitions

2018-01-10 Thread Ilya Dryomov
On Wed, Jan 10, 2018 at 5:34 PM, Jens Axboe <ax...@kernel.dk> wrote: > On 1/10/18 9:18 AM, Ilya Dryomov wrote: >> Regular block device writes go through blkdev_write_iter(), which does >> bdev_read_only(), while zeroout/discard/etc requests are never checked, >>

[PATCH v2 2/2] block: add bdev_read_only() checks to common helpers

2018-01-10 Thread Ilya Dryomov
Similar to blkdev_write_iter(), return -EPERM if the partition is read-only. This covers ioctl(), fallocate() and most in-kernel users but isn't meant to be exhaustive -- everything else will be caught in generic_make_request_checks(), fail with -EIO and can be fixed later. Signed-off-by: Ilya

[PATCH v2 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro()

2018-01-10 Thread Ilya Dryomov
bviously more important, but perhaps it's time to revisit that as well?) v1 -> v2: - added unlikely() per Sagi's suggestion Thanks, Ilya Ilya Dryomov (2): block: fail op_is_write() requests to read-only partitions block: add bdev_read_only() checks to common helpe

[PATCH v2 1/2] block: fail op_is_write() requests to read-only partitions

2018-01-10 Thread Ilya Dryomov
(), which is used by quite a few drivers for things like snapshots, read-only backing files/images, etc. Signed-off-by: Ilya Dryomov <idryo...@gmail.com> Reviewed-by: Sagi Grimberg <s...@grimberg.me> --- block/blk-core.c | 23 ++- 1 file changed, 22 insertions(+)

Re: [PATCH 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro()

2017-11-27 Thread Ilya Dryomov
On Thu, Nov 16, 2017 at 10:02 AM, Ilya Dryomov <idryo...@gmail.com> wrote: > On Thu, Nov 9, 2017 at 7:44 PM, Ilya Dryomov <idryo...@gmail.com> wrote: >> Hello, >> >> I was doing some cleanup work on rbd BLKROSET handler and discovered >> that we ignore par

Re: [PATCH 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro()

2017-11-16 Thread Ilya Dryomov
On Thu, Nov 9, 2017 at 7:44 PM, Ilya Dryomov <idryo...@gmail.com> wrote: > Hello, > > I was doing some cleanup work on rbd BLKROSET handler and discovered > that we ignore partition rw/ro setting (hd_struct->policy) for pretty > much everything but straight writes. >

[PATCH 0/2] block: enforce ioctl(BLKROSET) and set_disk_ro()

2017-11-09 Thread Ilya Dryomov
bviously more important, but perhaps it's time to revisit that as well?) Thanks, Ilya Ilya Dryomov (2): block: fail op_is_write() requests to read-only partitions block: add bdev_read_only() checks to common helpers block/blk-core.c | 23 ++- block/blk-lib.

[PATCH 2/2] block: add bdev_read_only() checks to common helpers

2017-11-09 Thread Ilya Dryomov
Similar to blkdev_write_iter(), return -EPERM if the partition is read-only. This covers ioctl(), fallocate() and most in-kernel users but isn't meant to be exhaustive -- everything else will be caught in generic_make_request_checks(), fail with -EIO and can be fixed later. Signed-off-by: Ilya

[PATCH 1/2] block: fail op_is_write() requests to read-only partitions

2017-11-09 Thread Ilya Dryomov
(), which is used by quite a few drivers for things like snapshots, read-only backing files/images, etc. Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- block/blk-core.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/blo

Re: [PATCH v3 0/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-25 Thread Ilya Dryomov
On Mon, Oct 16, 2017 at 3:59 PM, Ilya Dryomov <idryo...@gmail.com> wrote: > Hi Christoph, Martin, > > blkdev_issue_zeroout() now checks for any error. This required a minor > refactor, so I dropped the stable tag, Jens can add it back if needed. > > v2 -> v3: &

[PATCH] block: move CAP_SYS_ADMIN check in blkdev_roset()

2017-10-18 Thread Ilya Dryomov
Check for CAP_SYS_ADMIN before calling into the driver, similar to blkdev_flushbuf(). This is safer and can spare a check in the driver. (Currently BLKROSET is overridden by md and rbd, rbd is missing the check. md has the check, but it covers a lot more than BLKROSET.) Signed-off-by: Ilya

Re: [PATCH v2 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-16 Thread Ilya Dryomov
On Mon, Oct 16, 2017 at 1:44 PM, Christoph Hellwig <h...@infradead.org> wrote: > On Fri, Oct 06, 2017 at 02:31:20PM +0200, Ilya Dryomov wrote: >> This would unconditionally overwrite any WRITE ZEROS error. If we get >> e.g. -EIO, and manual zeroing is not allowed,

[PATCH v3 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-16 Thread Ilya Dryomov
s indicating lack of offload support. Fixes: c20cfc27a473 ("block: stop using blkdev_issue_write_same for zeroing") Cc: Christoph Hellwig <h...@lst.de> Cc: "Martin K. Petersen" <martin.peter...@oracle.com> Cc: Hannes Reinecke <h...@suse.com> Signed-off-by: Ilya

[PATCH v3 1/2] block: factor out __blkdev_issue_zero_pages()

2017-10-16 Thread Ilya Dryomov
blkdev_issue_zeroout() will use this in !BLKDEV_ZERO_NOFALLBACK case. Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- block/blk-lib.c | 63 + 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/block/blk-lib.c b/blo

[PATCH v3 0/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-16 Thread Ilya Dryomov
Thanks, Ilya Ilya Dryomov (2): block: factor out __blkdev_issue_zero_pages() block: cope with WRITE ZEROES failing in blkdev_issue_zeroout() block/blk-lib.c | 108 +--- 1 file changed, 72 insertions(+), 36 deletions(-) -- 2.4.3

Re: [PATCH v2 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-16 Thread Ilya Dryomov
On Fri, Oct 6, 2017 at 2:31 PM, Ilya Dryomov <idryo...@gmail.com> wrote: > On Fri, Oct 6, 2017 at 2:05 PM, Christoph Hellwig <h...@infradead.org> wrote: >> On Thu, Oct 05, 2017 at 09:32:33PM +0200, Ilya Dryomov wrote: >>> This is to avoid returning -EREMOTEIO

Re: false positive lockdep splat with loop device

2017-10-10 Thread Ilya Dryomov
On Tue, Oct 10, 2017 at 11:16 AM, Ilya Dryomov <idryo...@gmail.com> wrote: > On Thu, Oct 5, 2017 at 6:33 PM, Christoph Hellwig <h...@infradead.org> wrote: >> Does the patch below fix the warning for you? >> >> -- >> From 28aae7104425433d39e6142adcd5b88dc5

Re: [PATCH v2 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-06 Thread Ilya Dryomov
On Fri, Oct 6, 2017 at 2:05 PM, Christoph Hellwig <h...@infradead.org> wrote: > On Thu, Oct 05, 2017 at 09:32:33PM +0200, Ilya Dryomov wrote: >> This is to avoid returning -EREMOTEIO in the following case: device >> doesn't support WRITE SAME but scsi_disk::max_ws_blocks != 0,

Re: [PATCH v2 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-05 Thread Ilya Dryomov
On Thu, Oct 5, 2017 at 7:13 PM, Christoph Hellwig <h...@infradead.org> wrote: > On Wed, Oct 04, 2017 at 05:03:16PM +0200, Ilya Dryomov wrote: >> sd_config_write_same() ignores ->max_ws_blocks == 0 and resets it to >> permit trying WRITE SAME on older SCSI devices, unless -

[PATCH v2 1/2] block: factor out __blkdev_issue_zero_pages()

2017-10-04 Thread Ilya Dryomov
blkdev_issue_zeroout() will use this in !BLKDEV_ZERO_NOFALLBACK case. Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- block/blk-lib.c | 63 + 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/block/blk-lib.c b/blo

[PATCH v2 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-04 Thread Ilya Dryomov
s indicating lack of offload support. Fixes: c20cfc27a473 ("block: stop using blkdev_issue_write_same for zeroing") Cc: Christoph Hellwig <h...@lst.de> Cc: "Martin K. Petersen" <martin.peter...@oracle.com> Cc: Hannes Reinecke <h...@suse.com> Signed-off-by: Ilya

[PATCH v2 0/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-04 Thread Ilya Dryomov
nal checks to blkdev_issue_zeroout() and __blkdev_issue_zero_pages(), the latter is no longer void Previous patch(es) and discussion at https://marc.info/?l=linux-block=150471953327942=2 https://marc.info/?l=linux-block=150601399031909=2 Thanks, Ilya Ilya Dryomov (2): bl

Re: [PATCH 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-04 Thread Ilya Dryomov
On Tue, Oct 3, 2017 at 10:04 AM, Christoph Hellwig <h...@infradead.org> wrote: > On Thu, Sep 21, 2017 at 07:12:52PM +0200, Ilya Dryomov wrote: >> sd_config_write_same() ignores ->max_ws_blocks == 0 and resets it to >> permit trying WRITE SAME on older SCSI devices, unless -

Re: [PATCH 0/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-10-02 Thread Ilya Dryomov
On Thu, Sep 21, 2017 at 7:12 PM, Ilya Dryomov <idryo...@gmail.com> wrote: > Hi Christoph, Martin, > > blkdev_issue_zeroout() now checks for any error. This required a minor > refactor, so I dropped the stable tag, Jens can add it back if needed. > > Previous patch and d

[PATCH 2/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-09-21 Thread Ilya Dryomov
s indicating lack of offload support. Fixes: c20cfc27a473 ("block: stop using blkdev_issue_write_same for zeroing") Cc: Christoph Hellwig <h...@lst.de> Cc: "Martin K. Petersen" <martin.peter...@oracle.com> Cc: Hannes Reinecke <h...@suse.com> Signed-off-by: Ilya

[PATCH 0/2] block: cope with WRITE ZEROES failing in blkdev_issue_zeroout()

2017-09-21 Thread Ilya Dryomov
Hi Christoph, Martin, blkdev_issue_zeroout() now checks for any error. This required a minor refactor, so I dropped the stable tag, Jens can add it back if needed. Previous patch and discussion at https://marc.info/?l=linux-block=150471953327942=2 Thanks, Ilya Ilya

[PATCH 1/2] block: factor out __blkdev_issue_zero_pages()

2017-09-21 Thread Ilya Dryomov
blkdev_issue_zeroout() will use this in !BLKDEV_ZERO_NOFALLBACK case. Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- block/blk-lib.c | 58 +++-- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/block/blk-lib.c b/blo

Re: [PATCH] block: cope with WRITE SAME failing in blkdev_issue_zeroout()

2017-09-20 Thread Ilya Dryomov
On Tue, Sep 19, 2017 at 10:32 PM, Christoph Hellwig <h...@lst.de> wrote: > On Wed, Sep 06, 2017 at 07:38:10PM +0200, Ilya Dryomov wrote: >> sd_config_write_same() ignores ->max_ws_blocks == 0 and resets it to >> permit trying WRITE SAME on older SCSI devices, unless -

Re: [PATCH] block: cope with WRITE SAME failing in blkdev_issue_zeroout()

2017-09-19 Thread Ilya Dryomov
On Wed, Sep 13, 2017 at 11:50 AM, Ilya Dryomov <idryo...@gmail.com> wrote: > On Wed, Sep 6, 2017 at 7:38 PM, Ilya Dryomov <idryo...@gmail.com> wrote: >> sd_config_write_same() ignores ->max_ws_blocks == 0 and resets it to >> permit trying WRITE SAME on older SCSI d

Re: [PATCH] block: cope with WRITE SAME failing in blkdev_issue_zeroout()

2017-09-13 Thread Ilya Dryomov
On Wed, Sep 6, 2017 at 7:38 PM, Ilya Dryomov <idryo...@gmail.com> wrote: > sd_config_write_same() ignores ->max_ws_blocks == 0 and resets it to > permit trying WRITE SAME on older SCSI devices, unless ->no_write_same > is set. This means blkdev_issue_zeroout() must cope with

Re: [PATCH V2 0/3] block/loop: handle discard/zeroout error

2017-09-07 Thread Ilya Dryomov
Hi Shaohua, You wrote: > BTW: blkdev_issue_zeroout retries if we immediately find the device doesn't > support zeroout, but it doesn't retry if submit_bio_wait returns -EOPNOTSUPP. > Is this correct behavior? I sent a patch for that yesterday, see "[PATCH] block: cope with WRITE SAME failing in

[PATCH] block: cope with WRITE SAME failing in blkdev_issue_zeroout()

2017-09-06 Thread Ilya Dryomov
_issue_write_same for zeroing") Cc: Christoph Hellwig <h...@lst.de> Cc: "Martin K. Petersen" <martin.peter...@oracle.com> Cc: Hannes Reinecke <h...@suse.com> Cc: sta...@vger.kernel.org # 4.12+ Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- block/blk-lib.c |

Re: [PATCH v2 2/2] nbd: don't leak nbd_config

2017-05-29 Thread Ilya Dryomov
On Tue, May 23, 2017 at 5:49 PM, Ilya Dryomov <idryo...@gmail.com> wrote: > nbd_config is allocated in nbd_alloc_config(), but never freed. > > Fixes: 5ea8d10802ec ("nbd: separate out the config information") > Signed-off-by: Ilya Dryomov <idryo...@gmail.com>

[PATCH v2 1/2] nbd: nbd_reset() call in nbd_dev_add() is redundant

2017-05-23 Thread Ilya Dryomov
There is nothing to clear -- nbd_device has just been allocated. Fold nbd_reset() into its other caller, nbd_config_put(). Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- drivers/block/nbd.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers

[PATCH v2 2/2] nbd: don't leak nbd_config

2017-05-23 Thread Ilya Dryomov
nbd_config is allocated in nbd_alloc_config(), but never freed. Fixes: 5ea8d10802ec ("nbd: separate out the config information") Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/nbd.c b/dri

Re: [PATCH] nbd: don't leak nbd_config

2017-05-23 Thread Ilya Dryomov
On Tue, May 23, 2017 at 4:16 PM, Jens Axboe <ax...@fb.com> wrote: > On 05/23/2017 08:14 AM, Josef Bacik wrote: >> On Tue, May 23, 2017 at 12:38:31PM +0200, Ilya Dryomov wrote: >>> nbd_config is allocated in nbd_alloc_config(), but never freed. >>> >>&g

[PATCH] nbd: don't leak nbd_config

2017-05-23 Thread Ilya Dryomov
nbd_config is allocated in nbd_alloc_config(), but never freed. Fixes: 5ea8d10802ec ("nbd: separate out the config information") Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/nbd.c b/dri

[PATCH] block: get rid of blk_integrity_revalidate()

2017-04-18 Thread Ilya Dryomov
i...@intel.com> Cc: Christoph Hellwig <h...@lst.de> Cc: Mike Snitzer <snit...@redhat.com> Cc: sta...@vger.kernel.org # 4.4+, needs backporting Signed-off-by: Ilya Dryomov <idryo...@gmail.com> --- I don't have any integrity-capable disks or nvme separate-metadata cards, so I c

Re: blk_integrity_revalidate() clears BDI_CAP_STABLE_WRITES

2017-03-10 Thread Ilya Dryomov
On Thu, Mar 2, 2017 at 4:24 AM, Martin K. Petersen <martin.peter...@oracle.com> wrote: >>>>>> "Ilya" == Ilya Dryomov <idryo...@gmail.com> writes: > > Ilya, > > Ilya> Given the above, I'm not sure what the baseline is -- > Ilya> blk_

Re: blk_integrity_revalidate() clears BDI_CAP_STABLE_WRITES

2017-02-28 Thread Ilya Dryomov
On Fri, Feb 24, 2017 at 12:49 AM, Martin K. Petersen <martin.peter...@oracle.com> wrote: >>>>>> "Ilya" == Ilya Dryomov <idryo...@gmail.com> writes: > > Ilya, > > Ilya> Well, blk_integrity_revalidate() doesn't clear the profile, it > Ilya

Re: blk_integrity_revalidate() clears BDI_CAP_STABLE_WRITES

2017-02-22 Thread Ilya Dryomov
On Wed, Feb 22, 2017 at 5:41 AM, Martin K. Petersen <martin.peter...@oracle.com> wrote: >>>>>> "Ilya" == Ilya Dryomov <idryo...@gmail.com> writes: > > Ilya, > > Ilya> could you please explain blk_integrity_revalidate() and > Ilya> its GE