Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nbd device is read-only #4

Closed
Niosop opened this issue May 3, 2016 · 7 comments
Closed

nbd device is read-only #4

Niosop opened this issue May 3, 2016 · 7 comments

Comments

@Niosop
Copy link

Niosop commented May 3, 2016

Using nbd-client version 3.7 from ubuntu 14.04.1, connecting to gonbdserver, the created nbd device is read-only. blockdev --getro returns 1.

Using blockdev --setrw will cause it --getro to return 0, but writes will fail and dmesg will show "block nbd0: Write on read-only".

Using the nbd-server package to serve the device gives a writable device. Uncommenting the Dispatch debug line shows only NBD_CMD_READs being dispatched until the final NBD_CMD_DISC.

My impression is that something during the initial setup is signaling that it's a read only device somehow.

Any ideas on what I can try to debug this? gonbdserver.conf is:

servers:
- protocol: tcp
address: 127.0.0.1:6666
exports:
- name: foo
driver: file
path: /tmp/test
workers: 2
logging:

Connecting using: nbd-client -N foo 127.0.0.1 6666 /dev/nbd0

@Niosop
Copy link
Author

Niosop commented May 4, 2016

On ubuntu 16.04, using nbd-client 3.13-262-g69a15c0-dirty, it is created properly as r/w. Closing this, but if you want any more information I can set up the old environment again to do testing.

@Niosop Niosop closed this as completed May 4, 2016
@abligh
Copy link
Owner

abligh commented May 4, 2016

Thanks for the report. I will take a look at this as i have a 14.04 environment. From memory there was in one nbd-client release a forward compatibility problem that produced this result; perhaps that got into 14.04. If so it would be useful if there was a workaround (other than upgrade nbd-client).

@abligh abligh reopened this May 4, 2016
@abligh
Copy link
Owner

abligh commented May 4, 2016

I think it's the following bug in nbd:
https://www.mail-archive.com/nbd-general@lists.sourceforge.net/msg03878.html

If I'm reading that right, the issue is that nbd-client is sending flags to the kernel that it shouldn't be, specifically the NO_ZEROES flag gonbdserver (correctly) advertises, rather than masking them off. I can probably work around that one with a back compatibility flag. I'll look at adding that today.

@abligh
Copy link
Owner

abligh commented May 4, 2016

If you still have the test environment around, any chance you could try the latest version of gonbdserver (specifically with commit 929da65) with 14.04 and add disablenozeroes: true to the server level configuration (i.e. immediately beneath 'address'). I haven't tested this but I think it should work around the issue.

@Niosop
Copy link
Author

Niosop commented May 4, 2016

I don't, blew it away to install 16.04. I will try and recreate it in the morning and let you know how it goes.

@abligh
Copy link
Owner

abligh commented May 4, 2016

I have replicated this issue, which is indeed for the reason I said above. I have confirmed that commit 929da65 fixes it. You will need to make a change to your config file as follows to support it.

--- gonbdserver.conf    2016-04-06 16:40:55.000000000 +0100
+++ gonbdserver.conf.back-compatible    2016-05-04 11:18:03.000000000 +0100
@@ -1,6 +1,7 @@
 servers:
 - protocol: tcp
   address: 127.0.0.1:6666
+  disablenozeroes: true
   exports:
   - name: foo
     driver: file

@abligh abligh closed this as completed May 4, 2016
@abligh
Copy link
Owner

abligh commented May 4, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants