From 618e0b0f03dab30f7d041c67c435aeb7cb2d4eed Mon Sep 17 00:00:00 2001 From: Wouter Verhelst Date: Fri, 16 Oct 2009 10:52:18 +0200 Subject: [PATCH] Document why this is necessary. --- nbd-client.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/nbd-client.c b/nbd-client.c index 9f67da4..9d0ad10 100644 --- a/nbd-client.c +++ b/nbd-client.c @@ -316,6 +316,17 @@ int main(int argc, char *argv[]) { if(!nofork) daemon(0,0); do { if (fork()) { + /* Due to a race, the kernel NBD driver cannot + * call for a reread of the partition table + * in the handling of the NBD_DO_IT ioctl(). + * Therefore, this is done in the first open() + * of the device. We therefore make sure that + * the device is opened at least once after the + * connection was made. This has to be done in a + * separate process, since the NBD_DO_IT ioctl() + * does not return until the NBD device has + * disconnected. + */ while(check_conn(nbddev, 0)) { sleep(1); } -- 1.7.10.4