Re: [PATCH] nbd: fix possible sysfs duplicate warning

2019-10-10 Thread Xiubo Li
On 2019/10/10 21:56, Josef Bacik wrote: On Thu, Sep 19, 2019 at 11:44:27AM +0530, xiu...@redhat.com wrote: From: Xiubo Li 1. nbd_put takes the mutex and drops nbd->ref to 0. It then does idr_remove and drops the mutex. 2. nbd_genl_connect takes the mutex. idr_find/idr_for_each fails to f

Re: [PATCH v4 1/2] blk-mq: Avoid memory reclaim when allocating request map

2019-09-29 Thread Xiubo Li
On 2019/9/30 14:20, Damien Le Moal wrote: On 2019/09/29 22:50, Xiubo Li wrote: On 2019/9/30 13:28, Damien Le Moal wrote: On 2019/09/29 18:52, xiu...@redhat.com wrote: From: Xiubo Li For some storage drivers, such as the nbd, when there has new socket connections added, it will update the

Re: [PATCH v4 1/2] blk-mq: Avoid memory reclaim when allocating request map

2019-09-29 Thread Xiubo Li
On 2019/9/30 13:28, Damien Le Moal wrote: On 2019/09/29 18:52, xiu...@redhat.com wrote: From: Xiubo Li For some storage drivers, such as the nbd, when there has new socket connections added, it will update the hardware queue number by calling blk_mq_update_nr_hw_queues(), in which it will

Re: [PATCHv2 0/2] blk-mq: Avoid memory reclaim when allocating request map

2019-09-25 Thread Xiubo Li
On 2019/9/19 0:38, Christoph Hellwig wrote: On Mon, Sep 16, 2019 at 10:52:33AM -0600, Jens Axboe wrote: On 9/16/19 3:06 AM, Christoph Hellwig wrote: On Mon, Sep 16, 2019 at 07:46:29AM +0530, xiu...@redhat.com wrote: From: Xiubo Li To make the patch more readable and cleaner I just split

Re: [PATCH RESEND] nbd: avoid losing pointer to reallocated config->socks in nbd_add_socket

2019-09-21 Thread Xiubo Li
On 2019/9/21 0:06, Eugene Syromiatnikov wrote: In the (very unlikely) case of config->socks reallocation success and nsock allocation failure config->nsock will not get updated with the new pointer to socks array. Fix it by updating config->socks right after reallocation successfulness check. Fi

Re: [PATCH v3 0/2] blk-mq: Avoid memory reclaim when allocating

2019-09-17 Thread Xiubo Li
On 2019/9/18 7:25, Jens Axboe wrote: On 9/17/19 5:19 PM, Xiubo Li wrote: On 2019/9/18 7:11, Jens Axboe wrote: On 9/17/19 4:54 PM, Xiubo Li wrote: On 2019/9/17 22:13, Jens Axboe wrote: On 9/17/19 6:09 AM, xiu...@redhat.com wrote: From: Xiubo Li Changed in V2: - Addressed the comment from

Re: [PATCH v3 0/2] blk-mq: Avoid memory reclaim when allocating

2019-09-17 Thread Xiubo Li
On 2019/9/18 7:11, Jens Axboe wrote: On 9/17/19 4:54 PM, Xiubo Li wrote: On 2019/9/17 22:13, Jens Axboe wrote: On 9/17/19 6:09 AM, xiu...@redhat.com wrote: From: Xiubo Li Changed in V2: - Addressed the comment from Ming Lei, thanks. Changed in V3: - Switch to memalloc_noio_save/restore

Re: [PATCH v3 0/2] blk-mq: Avoid memory reclaim when allocating

2019-09-17 Thread Xiubo Li
On 2019/9/17 22:13, Jens Axboe wrote: On 9/17/19 6:09 AM, xiu...@redhat.com wrote: From: Xiubo Li Changed in V2: - Addressed the comment from Ming Lei, thanks. Changed in V3: - Switch to memalloc_noio_save/restore from Christoph's comment, thanks. This now seems to be a mix of

Re: [PATCHv2 0/2] blk-mq: Avoid memory reclaim when allocating request map

2019-09-16 Thread Xiubo Li
On 2019/9/16 17:06, Christoph Hellwig wrote: On Mon, Sep 16, 2019 at 07:46:29AM +0530, xiu...@redhat.com wrote: From: Xiubo Li To make the patch more readable and cleaner I just split them into 2 small ones to address the issue from @Ming Lei, thanks very much. I'd be much happier to

Re: [RFC PATCH] blk-mq: Avoid memory reclaim when allocating request map

2019-09-15 Thread Xiubo Li
On 2019/9/16 9:49, Ming Lei wrote: On Sun, Sep 15, 2019 at 05:56:56PM +0530, xiu...@redhat.com wrote: From: Xiubo Li For some storage drivers, such as the nbd, when there has new socket connections added, it will update the hardware queue number by calling blk_mq_update_nr_hw_queues(), in

Re: [PATCH] nbd: remove the duplicated code

2019-09-10 Thread Xiubo Li
On 2019/9/10 23:56, Mike Christie wrote: On 09/10/2019 01:36 AM, xiu...@redhat.com wrote: From: Xiubo Li The followed code will do the same check, and this part is redandant. Signed-off-by: Xiubo Li --- drivers/block/nbd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers

Re: [PATCH 2/2 v3] nbd: fix possible page fault for nbd disk

2019-09-02 Thread Xiubo Li
On 2019/9/3 5:30, Mike Christie wrote: On 08/29/2019 07:58 PM, Xiubo Li wrote: On 2019/8/30 7:49, Mike Christie wrote: On 08/22/2019 02:59 AM, xiu...@redhat.com wrote: [...] @@ -1596,6 +1614,7 @@ static int nbd_dev_add(int index) nbd->tag_set.flags = BLK_MQ_F_SHOULD_ME

Re: [PATCH 2/2 v3] nbd: fix possible page fault for nbd disk

2019-08-29 Thread Xiubo Li
On 2019/8/30 8:58, Xiubo Li wrote: On 2019/8/30 7:49, Mike Christie wrote: On 08/22/2019 02:59 AM, xiu...@redhat.com wrote: [...] + test_bit(NBD_DISCONNECT_REQUESTED, &nbd->flags)) { +    mutex_unlock(&nbd_index_mutex); + +    /* Wait untill the recv_work exit */ If that

Re: [PATCH 2/2 v3] nbd: fix possible page fault for nbd disk

2019-08-29 Thread Xiubo Li
On 2019/8/30 7:49, Mike Christie wrote: On 08/22/2019 02:59 AM, xiu...@redhat.com wrote: From: Xiubo Li When the NBD_CFLAG_DESTROY_ON_DISCONNECT flag is set and at the same time when the socket is closed due to the server daemon is restarted, just before the last DISCONNET is totally done if

Re: [PATCH v2] nbd: fix possible page fault for nbd disk

2019-08-21 Thread Xiubo Li
On 2019/8/22 0:43, Mike Christie wrote: On 08/21/2019 06:57 AM, xiu...@redhat.com wrote: From: Xiubo Li When the NBD_CFLAG_DESTROY_ON_DISCONNECT flag is set and at the same time when the socket is closed due to the server daemon is restarted, just before the last DISCONNET is totally done if

Re: [PATCH] nbd: fix possible page fault for nbd disk

2019-08-21 Thread Xiubo Li
FYI. This patch still have some problems. Will check it more. Thanks. On 2019/8/21 15:01, xiu...@redhat.com wrote: From: Xiubo Li When the NBD_CFLAG_DESTROY_ON_DISCONNECT flag is set and at the same time when the socket is closed due to the server daemon is restarted, there will be crashing

Re: [PATCH 1/2] nbd: fix crash when the blksize is zero v2

2019-05-29 Thread Xiubo Li
On 2019/5/30 4:16, Mike Christie wrote: From: Xiubo Li This will allow the blksize to be set zero and then use 1024 as default. Signed-off-by: Xiubo Li [fix to use goto out instead of return in genl_connect] Signed-off-by: Mike Christie --- V2: - Fix error handling in genl_connect. This

Re: [PATCH] nbd: fix crash when the blksize is zero

2019-05-29 Thread Xiubo Li
On 2019/5/30 2:55, Mike Christie wrote: On 05/27/2019 12:44 AM, xiu...@redhat.com wrote: From: Xiubo Li This will allow the blksize to be set zero and then use 1024 as default. Signed-off-by: Xiubo Li --- drivers/block/nbd.c | 21 ++--- 1 file changed, 18 insertions(+), 3

Re: [RFC PATCH] nbd: set the default nbds_max to 0

2019-05-29 Thread Xiubo Li
On 2019/5/29 21:48, Josef Bacik wrote: On Wed, May 29, 2019 at 04:08:36PM +0800, xiu...@redhat.com wrote: From: Xiubo Li There is one problem that when trying to check the nbd device NBD_CMD_STATUS and at the same time insert the nbd.ko module, we can randomly get some of the 16 /dev/nbd{0~15