acozzette / BUSE

A block device in user space for Linux
GNU General Public License v2.0
240 stars 47 forks source link

Doesn't work on Ubuntu 16 kernel 4.10.0-37-generic #14

Open mountaniol opened 6 years ago

mountaniol commented 6 years ago

Tried to run it on Ubuntu with generic kernel 4.10.0-37-generic I stucks after one NBD_CMD_READ command. dmesg output from nbd driver is here:

[ +18.743592] nbd0: detected capacity change from 0 to 134217728 [ +0.000043] block nbd0: Attempted send on invalid socket [ +0.000004] blk_update_request: I/O error, dev nbd0, sector 0 [ +0.000003] Buffer I/O error on dev nbd0, logical block 0, async page read [ +0.000009] block nbd0: Attempted send on invalid socket [ +0.000002] blk_update_request: I/O error, dev nbd0, sector 2 [ +0.000001] Buffer I/O error on dev nbd0, logical block 1, async page read [ +0.000005] block nbd0: Attempted send on invalid socket [ +0.000001] blk_update_request: I/O error, dev nbd0, sector 4 [ +0.000002] Buffer I/O error on dev nbd0, logical block 2, async page read [ +0.000006] block nbd0: Attempted send on invalid socket [ +0.000001] blk_update_request: I/O error, dev nbd0, sector 6 [ +0.000001] Buffer I/O error on dev nbd0, logical block 3, async page read [ +0.000035] block nbd0: Attempted send on invalid socket [ +0.000004] blk_update_request: I/O error, dev nbd0, sector 0 [ +0.000003] Buffer I/O error on dev nbd0, logical block 0, async page read [ +0.000008] block nbd0: Attempted send on invalid socket [ +0.000002] blk_update_request: I/O error, dev nbd0, sector 2 [ +0.000001] Buffer I/O error on dev nbd0, logical block 1, async page read [ +0.000005] block nbd0: Attempted send on invalid socket [ +0.000001] blk_update_request: I/O error, dev nbd0, sector 4 [ +0.000001] Buffer I/O error on dev nbd0, logical block 2, async page read [ +0.000006] block nbd0: Attempted send on invalid socket [ +0.000001] blk_update_request: I/O error, dev nbd0, sector 6 [ +0.000002] Buffer I/O error on dev nbd0, logical block 3, async page read [ +0.000021] block nbd0: Attempted send on invalid socket [ +0.000003] blk_update_request: I/O error, dev nbd0, sector 0 [ +0.000002] Buffer I/O error on dev nbd0, logical block 0, async page read [ +0.000006] block nbd0: Attempted send on invalid socket [ +0.000001] blk_update_request: I/O error, dev nbd0, sector 2 [ +0.000002] Buffer I/O error on dev nbd0, logical block 1, async page read [ +0.000025] ldm_validate_partition_table(): Disk read failed. [ +0.000110] Dev nbd0: unable to read RDB block 0 [ +0.000159] nbd0: unable to read partition table [ +30.121265] block nbd0: Connection timed out, shutting down connection [ +0.000016] block nbd0: shutting down sockets [ +0.000005] blk_update_request: 38 callbacks suppressed [ +0.000004] blk_update_request: I/O error, dev nbd0, sector 0 [ +0.000007] buffer_io_error: 38 callbacks suppressed [ +0.000004] Buffer I/O error on dev nbd0, logical block 0, async page read [ +0.000013] block nbd0: Connection timed out, shutting down connection [ +0.000005] blk_update_request: I/O error, dev nbd0, sector 2 [ +0.000005] Buffer I/O error on dev nbd0, logical block 1, async page read [ +0.000005] block nbd0: Connection timed out, shutting down connection [ +0.000003] blk_update_request: I/O error, dev nbd0, sector 4 [ +0.000004] Buffer I/O error on dev nbd0, logical block 2, async page read [ +0.000004] block nbd0: Connection timed out, shutting down connection [ +0.000003] blk_update_request: I/O error, dev nbd0, sector 6 [ +0.000003] Buffer I/O error on dev nbd0, logical block 3, async page read [ +0.000035] ldm_validate_partition_table(): Disk read failed. [ +0.000007] Dev nbd0: unable to read RDB block 0 [ +0.000011] nbd0: unable to read partition table [ +0.000011] nbd0: partition table beyond EOD, truncated

silverjam commented 6 years ago

Seeing this too, it looks like the second call to re-open /dev/nbd0 blocks the server from starting up. If I comment out that part I can get busexmp.c to start up:

diff --git a/buse.c b/buse.c
index 4d52fe3..d5212f2 100644
--- a/buse.c
+++ b/buse.c
@@ -148,11 +148,11 @@ int buse_main(const char* dev_file, const struct buse_operations *aop, void *use
   /* The parent opens the device file at least once, to make sure the
    * partition table is updated. Then it closes it and starts serving up
    * requests. */
-
+#if 0
   tmp_fd = open(dev_file, O_RDONLY);
   assert(tmp_fd != -1);
   close(tmp_fd);
-
+#endif
   close(sp[1]);
   sk = sp[0];