summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* js: Allow serving files > 4GB in sizeHEADmasterJeremy Kerr2019-03-271-8/+15
| | | | | | | | | | | | | | Currently, the javascript NBD server only handles files of sizes that are representable in 32 bits. Although we can't do full 64-bit offsets with Javascript's number representation, we should be able to handle up to Number.MAX_SAFE_INTEGER. This change adds support for using the top-32 bit field in file sizes and read request offsets. Reported-by: Lei YU <mine260309@gmail.com> Signed-off-by: Jeremy Kerr <jk@ozlabs.org> Change-Id: I41dee58c3913cba49c5cd73ebdd5d6fb56786d25
* client: fix gcc8 stringop-truncation warningsBrad Bishop2018-10-291-1/+1
| | | | | | | | | | | | In function 'open_nbd_socket.isra.2', | inlined from 'main' at ../git/nbd-proxy.c:835:7: | ../git/nbd-proxy.c:102:2: error: 'strncpy' specified bound 108 equals destination size [-Werror=stringop-truncation] | strncpy(addr.sun_path, path, sizeof(addr.sun_path)); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Change-Id: I9f412d789f4e5ef1dffe05b37d903a5375fea8ec Signed-off-by: Brad Bishop <bradleyb@fuzziesquirrel.com>
* nbd-proxy: run start hook asynchronouslyJeremy Kerr2018-08-131-14/+45
| | | | | | | | | | | | | | | | Currently, we run the start hook synchronously, and wait() for it to complete. This means that the proxy process will be blocked during the execution of that hook, and no servicing any read/write requests from the nbd device. If any part of the hook implementation needs to access the device, it'll block waiting for the device (which is waiting for the nbd-proxy, which is waiting for the hook). This change runs the hook (for the "start" action) in the background, while still servicing requests. This allows hooks to access the device. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: replace hook dir with a single executableJeremy Kerr2018-08-132-84/+24
| | | | | | | | | | A future change will run the executable asynchronously. With a directory of hooks, this gets overly complicated. Replace the directory-of-hooks concept with a single hook. The hook itself can then spawn multiple hooks if required (eg, with run-parts). Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: listen for udev change event before running start hookJeremy Kerr2018-08-103-6/+133
| | | | | | | | | | | | | | | | Currently, we run the start state-change hook as soon as the nbd session has been established. However, at that point the nbd device isn't connected, as we haven't processed any read/write operations on the block device. This change defers running the start script until we know that the device is initialised - when we see a udev change event occur. To do this, we establish a udev monitor. Once we see that state change, we run the state change hooks and shut down the udev monitor. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: clear errors from checking hook presenceJeremy Kerr2018-08-101-3/+7
| | | | | | | We don't want to report an error if a hook is inacessable (and is the last hook we check), so clear rc in these conditions. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* autotools: use localstatedir, not runstatedirJeremy Kerr2018-08-101-1/+1
| | | | | | .. runstatedir is only present in autoconf 2.70+ Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: use CLOEXECJeremy Kerr2018-08-091-10/+5
| | | | | | | | We spawn a couple of subprocesses, and want to make sure we don't leak file descriptors to those. Rather than closing before exec, set CLOEXEC on sockets and internal pipes. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: Add state hook facilityJeremy Kerr2018-08-092-3/+131
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: Add metadata facilityJeremy Kerr2018-08-092-3/+41
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: Add getopt-based option parsingJeremy Kerr2018-08-091-2/+26
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: allow default configurationsJeremy Kerr2018-08-091-16/+42
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: add configuration facilityJeremy Kerr2018-08-096-9/+463
| | | | | | | | | | Add a little configuration facility. We'll later add a method to integrate this with UI-side configuration, so it's implmented as json. We add a (temporarily required) argument to specify which configuration to use. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* nbd-proxy: Specify nbd socket timeoutJeremy Kerr2018-07-271-0/+5
| | | | | | | For non-local connections, we need a longer timeout than the kernel default. Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* autotools: Add macros for AX_APPEND_COMPILE_FLAGSJeremy Kerr2018-07-265-0/+250
| | | | Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
* Initial js/nbd commitJeremy Kerr2018-07-267-0/+1100
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
OpenPOWER on IntegriCloud