Re: BUG: unable to handle kernel NULL pointer dereference at 0000000000000436

2018-01-14 Thread Ming Lei
On Fri, Jan 12, 2018 at 04:21:33PM +0100, Paolo Valente wrote: > > > > Il giorno 12 gen 2018, alle ore 09:29, Paolo Valente > > ha scritto: > > > > > > > >> Il giorno 12 gen 2018, alle ore 05:18, Ming Lei ha > >> scritto: > >> > >> On Thu, Jan 11, 2018 at 08:40:54AM -0700, Jens Axboe wrot

confusion about bio_split

2018-01-14 Thread Wang Sheng-Hui
Dear, Sorry to trouble you. I'm confused by the following code in bio.c/bio_split: - struct bio *bio_split(struct bio *bio, int sectors, ... if (bio_flagged(bio, BIO_TRACE_COMPLETION)) bio_set_flag(bio, BIO_TRACE_COMPLETION); ..

[GIT PULL] block changes to improve device mapper for 4.16

2018-01-14 Thread Mike Snitzer
Hi Jens, I prepared this pull request in the hope that it may help you review and stage these changes for 4.16. I went over Ming's changes again to refine the headers and code comments for clarity to help ease review and inclussion. I've done extensive testing of the changes in this pull request

Re: blk-mq: don't clear RQF_MQ_INFLIGHT in blk_mq_rq_ctx_init()

2018-01-14 Thread Jens Axboe
On 1/14/18 10:43 AM, Mike Snitzer wrote: > On Sun, Jan 14 2018 at 12:38pm -0500, > Jens Axboe wrote: > >> On 1/13/18 10:49 AM, Ming Lei wrote: >>> In case of no IO scheduler, RQF_MQ_INFLIGHT is set in blk_mq_rq_ctx_init(), >>> but 7c3fb70f0341 clears it mistakenly, so fix it. >> >> Oops yeah, tha

[GIT PULL] NVMe fix for 4.15

2018-01-14 Thread Jens Axboe
Hi Linus, Just a single fix for nvme over fabrics that should go into 4.15. Please pull! git://git.kernel.dk/linux-block.git for-linus Ewan D. Milne (1): nvme-fabrics: initialize default host->id in nvmf_host_default() J

Re: blk-mq: don't clear RQF_MQ_INFLIGHT in blk_mq_rq_ctx_init()

2018-01-14 Thread Mike Snitzer
On Sun, Jan 14 2018 at 12:38pm -0500, Jens Axboe wrote: > On 1/13/18 10:49 AM, Ming Lei wrote: > > In case of no IO scheduler, RQF_MQ_INFLIGHT is set in blk_mq_rq_ctx_init(), > > but 7c3fb70f0341 clears it mistakenly, so fix it. > > Oops yeah, that's my bad. However, I think the below fix is cle

Re: [PATCH] blk-mq: don't clear RQF_MQ_INFLIGHT in blk_mq_rq_ctx_init()

2018-01-14 Thread Jens Axboe
On 1/13/18 10:49 AM, Ming Lei wrote: > In case of no IO scheduler, RQF_MQ_INFLIGHT is set in blk_mq_rq_ctx_init(), > but 7c3fb70f0341 clears it mistakenly, so fix it. Oops yeah, that's my bad. However, I think the below fix is cleaner and avoids a conditional. diff --git a/block/blk-mq.c b/block

Re: [PATCHSET v5] blk-mq: reimplement timeout handling

2018-01-14 Thread Ming Lei
On Sun, Jan 14, 2018 at 11:12 PM, jianchao.wang wrote: > > > On 01/13/2018 05:19 AM, Bart Van Assche wrote: >> Sorry but I only retrieved the blk-mq debugfs several minutes after the hang >> started so I'm not sure the state information is relevant. Anyway, I have >> attached >> it to this e-mail

Re: [PATCHSET v5] blk-mq: reimplement timeout handling

2018-01-14 Thread jianchao.wang
On 01/13/2018 05:19 AM, Bart Van Assche wrote: > Sorry but I only retrieved the blk-mq debugfs several minutes after the hang > started so I'm not sure the state information is relevant. Anyway, I have > attached > it to this e-mail. The most remarkable part is the following: > > ./9ddf

[PATCH v3 13/13] bcache: stop bcache device when backing device is offline

2018-01-14 Thread Coly Li
Currently bcache does not handle backing device failure, if backing device is offline and disconnected from system, its bcache device can still be accessible. If the bcache device is in writeback mode, I/O requests even can success if the requests hit on cache device. That is to say, when and how b

[PATCH v3 12/13] bcache: add io_disable to struct cached_dev

2018-01-14 Thread Coly Li
If a bcache device is configured to writeback mode, current code does not handle write I/O errors on backing devices properly. In writeback mode, write request is written to cache device, and latter being flushed to backing device. If I/O failed when writing from cache device to the backing device

[PATCH v3 11/13] bcache: add backing_request_endio() for bi_end_io of attached backing device I/O

2018-01-14 Thread Coly Li
In order to catch I/O error of backing device, a separate bi_end_io call back is required. Then a per backing device counter can record I/O errors number and retire the backing device if the counter reaches a per backing device I/O error limit. This patch adds backing_request_endio() to bcache bac

[PATCH v3 07/13] bcache: set error_limit correctly

2018-01-14 Thread Coly Li
Struct cache uses io_errors for two purposes, - Error decay: when cache set error_decay is set, io_errors is used to generate a small piece of delay when I/O error happens. - I/O errors counter: in order to generate big enough value for error decay, I/O errors counter value is stored by left sh

[PATCH v3 10/13] bcache: fix inaccurate io state for detached bcache devices

2018-01-14 Thread Coly Li
From: Tang Junhui When we run IO in a detached device, and run iostat to shows IO status, normally it will show like bellow (Omitted some fields): Device: ... avgrq-sz avgqu-sz await r_await w_await svctm %util sdd... 15.89 0.531.820.202.23 1.81 52.30 bcache0..

[PATCH v3 09/13] bcache: stop all attached bcache devices for a retired cache set

2018-01-14 Thread Coly Li
When there are too many I/O errors on cache device, current bcache code will retire the whole cache set, and detach all bcache devices. But the detached bcache devices are not stopped, which is problematic when bcache is in writeback mode. If the retired cache set has dirty data of backing devices

[PATCH v3 08/13] bcache: add CACHE_SET_IO_DISABLE to struct cache_set flags

2018-01-14 Thread Coly Li
When too many I/Os failed on cache device, bch_cache_set_error() is called in the error handling code path to retire whole problematic cache set. If new I/O requests continue to come and take refcount dc->count, the cache set won't be retired immediately, this is a problem. Further more, there are

[PATCH v3 06/13] bcache: stop dc->writeback_rate_update properly

2018-01-14 Thread Coly Li
struct delayed_work writeback_rate_update in struct cache_dev is a delayed worker to call function update_writeback_rate() in period (the interval is defined by dc->writeback_rate_update_seconds). When a metadate I/O error happens on cache device, bcache error handling routine bch_cache_set_error(

[PATCH v3 05/13] bcache: quit dc->writeback_thread when BCACHE_DEV_DETACHING is set

2018-01-14 Thread Coly Li
In patch "bcache: fix cached_dev->count usage for bch_cache_set_error()", cached_dev_get() is called when creating dc->writeback_thread, and cached_dev_put() is called when exiting dc->writeback_thread. This modification works well unless people detach the bcache device manually by 'echo 1 > /s

[PATCH v3 04/13] bcache: fix cached_dev->count usage for bch_cache_set_error()

2018-01-14 Thread Coly Li
When bcache metadata I/O fails, bcache will call bch_cache_set_error() to retire the whole cache set. The expected behavior to retire a cache set is to unregister the cache set, and unregister all backing device attached to this cache set, then remove sysfs entries of the cache set and all attached

[PATCH v3 02/13] bcache: properly set task state in bch_writeback_thread()

2018-01-14 Thread Coly Li
Kernel thread routine bch_writeback_thread() has the following code block, 447 down_write(&dc->writeback_lock); 448~450 if (check conditions) { 451 up_write(&dc->writeback_lock); 452 set_current_state(TASK_INTERRUPTIBLE); 453 454 if (kthr

[PATCH v3 01/13] bcache: set writeback_rate_update_seconds in range [1, 60] seconds

2018-01-14 Thread Coly Li
dc->writeback_rate_update_seconds can be set via sysfs and its value can be set to [1, ULONG_MAX]. It does not make sense to set such a large value, 60 seconds is long enough value considering the default 5 seconds works well for long time. Because dc->writeback_rate_update is a special delayed w

[PATCH v3 03/13] bcache: set task properly in allocator_wait()

2018-01-14 Thread Coly Li
Kernel thread routine bch_allocator_thread() references macro allocator_wait() to wait for a condition or quit to do_exit() when kthread_should_stop() is true. Here is the code block, 284 while (1) { \ 285 set_current_state(

[PATCH v3 00/13] bcache: device failure handling improvement

2018-01-14 Thread Coly Li
Hi maintainers and folks, This patch set tries to improve bcache device failure handling, includes cache device and backing device failures. The basic idea to handle failed cache device is, - Unregister cache set - Detach all backing devices which are attached to this cache set - Stop all the det

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

2018-01-14 Thread Sagi Grimberg
Reviewed-by: Sagi Grimberg

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

2018-01-14 Thread Sagi Grimberg
Reviewed-by: Sagi Grimberg