Ignore this patch. I had copied nbd_genl_connect, but there is no need
to do 2 nbd_size_set calls if both attrs are set. I am going to resubmit
a new patch.

On 05/15/2019 07:38 PM, Mike Christie wrote:
> If the device is setup with ioctl we can resize the device after the
> initial setup, but if the device is setup with netlink we cannot use the
> resize related ioctls and there is no netlink reconfigure size ATTR
> handling code.
> 
> This patch adds netlink reconfigure resize support to match the ioctl
> interface.
> 
> Signed-off-by: Mike Christie <[email protected]>
> ---
>  drivers/block/nbd.c | 9 +++++++++
>  1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 053958a8a2ba..68b9d4b2d1be 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -1939,6 +1939,15 @@ static int nbd_genl_reconfigure(struct sk_buff *skb, 
> struct genl_info *info)
>               goto out;
>       }
>  
> +     if (info->attrs[NBD_ATTR_SIZE_BYTES]) {
> +             u64 bytes = nla_get_u64(info->attrs[NBD_ATTR_SIZE_BYTES]);
> +             nbd_size_set(nbd, config->blksize,
> +                          div64_u64(bytes, config->blksize));
> +     }
> +     if (info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES]) {
> +             u64 bsize = nla_get_u64(info->attrs[NBD_ATTR_BLOCK_SIZE_BYTES]);
> +             nbd_size_set(nbd, bsize, div64_u64(config->bytesize, bsize));
> +     }
>       if (info->attrs[NBD_ATTR_TIMEOUT]) {
>               u64 timeout = nla_get_u64(info->attrs[NBD_ATTR_TIMEOUT]);
>               nbd->tag_set.timeout = timeout * HZ;
> 

Reply via email to