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

Re: [Nbd] issue with nbd 3.9



Hi,

(Cc to mailinglist added back)

On Fri, Mar 06, 2015 at 12:27:23PM +0100, Christian Hesse wrote:
> The attached patch fixes the read-only problem for me. Looks like client uses
> wrongs flags, no?

Yes, but your patch is not the correct fix.

There are three flags fields: two server side (one per export, one
global) and one client side. The "cflags" field is the client side flags
field, whereas the actual field that needs to be sent to the kernel is
the server-side per-export flags field. Sending that would break loads
of other things (e.g., it would make it impossible to mark a device
read-only on purpose).

What the client wants to send to the kernel is "(global << 16) |
per-export", but due to a missing left shift it really sends "global |
per-export". What it *should* be sending is the "per-export" flags
field, only. This bug is a result of me trying to cut corners a few
years ago when I didn't want to rewrite the "negotiation" methods while
I really should have.

Since the global field only ever sent 0x1 (for "fixed newstyle"), which
just happens to map to NBD_FLAG_HAS_FLAGS in the per-export flags field
(which is always one), this bug never triggered before.

I really really need to redo the negotiation at some point, so this kind
of crap never happens again.

To list: sorry about the mess. I thought I had tested this against the
kernel when I wrote it, but apparently I was mistaken. This'll teach me
for going "ah, make distcheck works, so it must be fine, right?", which
of course is totally and utterly *wrong*.

I think I'm going to rewrite the "negotiation" methods for 3.10, and
*throw out* the oldstyle support. It's been five years since I added
newstyle, that should be plenty time for people to migrate.

Please don't use 3.9 yet. I'll come up with a proper fix ASAP. For now,
though, just stick to 3.8.

-- 
It is easy to love a country that is famous for chocolate and beer

  -- Barack Obama, speaking in Brussels, Belgium, 2014-03-26



Reply to: