[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [Nbd] nbd-client: bug in passing flags?



On Mon, May 16, 2011 at 1:23 PM, Alex Bligh <alex@...872...> wrote:
>
>
> --On 16 May 2011 17:29:37 +0100 Alex Bligh <alex@...872...> wrote:
>
>> I think the "<< 16" on line 215 is superfluous. The flags should
>> simply be converted to host order, and assigned to "flags", so
>> they will live in least significant two bytes (where they came
>> from).
>
> In fact, unless lack of caffeine is getting to me, I don't see
> how these ever get passed to the kernel anyway. The read only
> flag, if it is set right, causes the BLKROSET ioctl to be
> executed.
>
> However, there is also a member of struct nbd_device in the
> kernel called flags. As far as I can tell, this is always zero,
> as it is never set to anything else. However, it is tested
> for NBD_READ_ONLY at line 460 of nbd.c in the kernel. Unless
> I'm missing something (quite possible) I don't think this
> check is ever activated. I need to pass the remainder of
> the flags anyway, so I proposed adding a NBD_SET_FLAGS
> ioctl to pass them through, and not checking for errors
> in the client (as older kernels won't support it).

Yeah, that's right. We don't have an ioctl to do that, so the
lo->flags are always 0. If you've got a patch I'll take a look at it.
This would be a nice thing to have in our back pockets, regardless of
whether it gets used immediately or not.

Thanks,
Paul



Reply to: