Re: [PATCH AUTOSEL 5.3 15/71] rbd: fix response length parameter for encoded strings

2019-10-01 Thread Ilya Dryomov
() doesn't > allocate space for length. Fix both to be consistent. > > Signed-off-by: Dongsheng Yang > Reviewed-by: Ilya Dryomov > Signed-off-by: Ilya Dryomov > Signed-off-by: Sasha Levin > --- > drivers/block/rbd.c | 10 ++ > 1 file changed, 6 insertions(+)

Re: [PATCHSET v2] io_uring IO interface

2019-01-11 Thread Ilya Dryomov
On Fri, Jan 11, 2019 at 10:51 AM Roman Penyaev wrote: > > Hi Jens, > > That is interesting. Recently I sent an rfc related to epoll uring: > > https://lore.kernel.org/lkml/20190109164025.24554-1-rpeny...@suse.de > > which can be mapped to userspace and all ready events can be consumed > from it d

[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': > drivers/block/rbd.c:1397:1: error:

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': > drivers/block/rbd.c:1397:1: error:

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 > VLA warnings. Also, as

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 text >>> >>> Signed-off-by: Colin Ian King >>> ---

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 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. > > David (CCed) has blkt

[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:

[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 --- block/blk-core.c | 56 ++-- 1 file changed, 38 insertions(+), 18 deletions(-) diff --git a/block/blk-core.c b

[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): blo

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 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, >> both userspace- and kernel-trig

[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:

[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

[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 Reviewed-by: Sagi Grimberg --- block/blk-core.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block

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 wrote: > On Thu, Nov 9, 2017 at 7:44 PM, Ilya Dryomov 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

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 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. > > David (CCed) has blkt

[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 ++- bloc

[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:

[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 --- block/blk-core.c | 23 ++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/block/blk-core.c b/block/blk-core.c index

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

2017-10-24 Thread Ilya Dryomov
On Thu, Oct 19, 2017 at 2:14 AM, Al Viro wrote: > On Wed, Oct 18, 2017 at 02:38:38PM +0200, Ilya Dryomov wrote: >> 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. >> >> (Curre

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

2017-10-24 Thread Ilya Dryomov
On Mon, Oct 16, 2017 at 3:59 PM, Ilya Dryomov 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: > - another code flow change

[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 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, I don't think we want to &

[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 Cc: "Martin K. Petersen" Cc: Hannes Reinecke Signed-off-by: Ilya Dryomov --- block/blk-lib.c | 45 +

[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 --- block/blk-lib.c | 63 + 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index

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

2017-10-16 Thread Ilya Dryomov
089&w=2 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 wrote: > On Fri, Oct 6, 2017 at 2:05 PM, Christoph Hellwig 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

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 wrote: > On Thu, Oct 5, 2017 at 6:33 PM, Christoph Hellwig wrote: >> Does the patch below fix the warning for you? >> >> -- >> From 28aae7104425433d39e6142adcd5b88dc5b0ad5f Mon Sep 17 00:00:00 2001 >> From: Chris

Re: false positive lockdep splat with loop device

2017-10-10 Thread Ilya Dryomov
On Thu, Oct 5, 2017 at 6:33 PM, Christoph Hellwig wrote: > Does the patch below fix the warning for you? > > -- > From 28aae7104425433d39e6142adcd5b88dc5b0ad5f Mon Sep 17 00:00:00 2001 > From: Christoph Hellwig > Date: Thu, 5 Oct 2017 18:31:02 +0200 > Subject: block: use DECLARE_COMPLETION_ONSTAC

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 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, zeroo

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 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 ->no_write_sam

[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 --- block/blk-lib.c | 63 + 1 file changed, 37 insertions(+), 26 deletions(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index

[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 Cc: "Martin K. Petersen" Cc: Hannes Reinecke Signed-off-by: Ilya Dryomov --- block/blk-lib.c | 41 +

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

2017-10-04 Thread Ilya Dryomov
ditional 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&m=150471953327942&w=2 https://marc.info/?l=linux-block&m=150601399031909&w=2 Thanks,

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 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 ->no_write_sam

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

2017-10-01 Thread Ilya Dryomov
On Thu, Sep 21, 2017 at 7:12 PM, Ilya Dryomov 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 discussion at > > ht

[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 Cc: "Martin K. Petersen" Cc: Hannes Reinecke Signed-off-by: Ilya Dryomov --- block/blk-lib.c | 27 +-- 1 f

[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&m=150471953327942&w=2 Thanks, Ily

[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 --- block/blk-lib.c | 58 +++-- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/block/blk-lib.c b/block/blk-lib.c index

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 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 ->no_write_same &

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 wrote: > On Wed, Sep 6, 2017 at 7:38 PM, 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 ->no_write_same &

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 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 WRITE SAME > failing w

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 b

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

2017-09-06 Thread Ilya Dryomov
lkdev_issue_write_same for zeroing") Cc: Christoph Hellwig Cc: "Martin K. Petersen" Cc: Hannes Reinecke Cc: sta...@vger.kernel.org # 4.12+ Signed-off-by: Ilya Dryomov --- block/blk-lib.c | 49 + 1 file changed, 33 insertions(+), 16

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 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 > --- > drivers/block/nbd.c | 1 + > 1 file c

[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 --- drivers/block/nbd.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block

[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 --- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index e7

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 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. >>> >>> Fixes: 5ea8d10

[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 --- drivers/block/nbd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index 9a

[PATCH] block: get rid of blk_integrity_revalidate()

2017-04-18 Thread Ilya Dryomov
drivers that call blk_integrity_register() and use integrity infrastructure won't interfere with drivers that don't but still want stable pages. Fixes: 25520d55cdb6 ("block: Inline blk_integrity in struct gendisk") Cc: "Martin K. Petersen" Cc: Dan Williams Cc: Christoph Hellwig

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 wrote: >>>>>> "Ilya" == Ilya Dryomov writes: > > Ilya, > > Ilya> Given the above, I'm not sure what the baseline is -- > Ilya> blk_integrity code isn't invoked for data-only lbafs. Co

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 wrote: >>>>>> "Ilya" == Ilya Dryomov writes: > > Ilya, > > Ilya> Well, blk_integrity_revalidate() doesn't clear the profile, it > Ilya> just clears the stable pages flag. Whoever calls &

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 wrote: >>>>>> "Ilya" == Ilya Dryomov writes: > > Ilya, > > Ilya> could you please explain blk_integrity_revalidate() and > Ilya> its GENHD_FL_UP check in particular? We have t

blk_integrity_revalidate() clears BDI_CAP_STABLE_WRITES

2017-02-20 Thread Ilya Dryomov
Hello, rbd requires stable pages if ceph message data CRCs are enabled. To that end we set BDI_CAP_STABLE_WRITES in rbd_init_disk(), but since commit 25520d55cdb6 ("block: Inline blk_integrity in struct gendisk", went into 4.4) this bit is almost immediately cleared: add_disk register_disk