Commit Graph
22 Commits
Author SHA1 Message Date
kfraser@localhost.localdomain 4eb73854d7 Fix file descriptor leak in blktapctrl
The blktapctrl process is responsible for spawning individual tapdisk
processes. It does this using the 'system' method, but unfortunately
none of its file descriptors have the close-on-exec flag set. The
parent blktapctl process opens a couple of unix domain sockets
per-tapdisk it spawns. So the first tapdisk get 2 FDs leaked to it,
the second gets 4 FDs leaked to it, the 3rd gets 6 and so on. The use
of 'system' also unneccessarily invokes the shell.

Replace system with fork/execvp, and explicitly close all file handles
up to _SC_OPEN_MAX.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2007-08-01 09:04:20 +01:00
kfraser@localhost.localdomain ff2fc71eda tools: warn_unused_result build fixes.
Note that some of the existing error checking for asprintf was wrong
for Linux.  asprintf in glibc returns -1 on error, but leaves the
pointer uninitialized.  Only the BSDs zero out the pointer on error.

Also, while fixing these warnings I saw several error paths that were
incorrect.  This patch minimally fixes the warn_unused_result; more
complete error path cleanup will be a later patch.

Signed-off-by:  Charles Coffing <ccoffing@novell.com>
2007-06-12 11:38:31 +01:00
kfraser@localhost.localdomain ecc82ca3e6 blktap: Fix compile errors
When compiling the various blktap drivers with warnings cranked up, I
get errors that return values are not checked.

Signed-off-by: Charles Coffing <ccoffing@novell.com>
2007-05-24 14:07:40 +01:00
kfraser@localhost.localdomain 541b4e900d blktap: Add one more error reason statement to blktapctrl
blktapctrl already prints out exits reasons for all goto's to
open_failed except of not finding a device number for blktap0
This patch adds just that message so the user will get more info than
just "Unable to start blktapctrl"
Common source of this issue is that blktap is missing/failed to
load/...

Signed-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>
2007-05-24 10:50:07 +01:00
Brendan Cully 5d93b6f183 Put blktap character device back into /dev/xen.
Changeset 14895:800aa9f5cec9 accidentally moved it into /var/run/tap
along with the control FIFOs.
Signed-off-by: Brendan Cully <brendan@cs.ubc.ca>
2007-05-02 09:42:43 -07:00
Jake Wires 34cb794701 [TAPDISK] Move tapdisk control files from /dev/xen to /var/run/tap
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-04-23 17:15:38 -07:00
Jake Wires c4f51da19f [TAPDISK] Use incremental cookies and fix blktapctrl::test_path parameter typo.
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-04-23 15:37:53 -07:00
Jake Wires a3d17a18e5 [TAPDISK] honor read-only attributes when creating tap-based VBDs
Signed-off-by: Jake Wires <jwires@xensource.com>
2007-02-23 17:26:07 -08:00
Ewan Mellor 62184014df Set FD_CLOEXEC on the pidfile fd, so that tapdisk does not get it.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-12-14 10:31:31 +00:00
Ewan Mellor 0a85a374e0 Steal the write_pidfile function from xenstored_core, and use it to ensure
that blktapctrl only starts once.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
2006-12-13 11:23:01 +00:00
kfraser@localhost.localdomain bc79267989 [BLKTAP] Use lartge enough types to express parameters of large block devices.
While the kernel side of blktap drivers is using 64-bit sector numbers
correctly when reporting disk sizing, the userspace parts where this
dat is actually generated is truncating at 32-bit. There are 3 variables
related to disk sizing which are used in the kernel/userspace code
'size', 'sector size' & 'info'. In kernel space these are treated as being
unsigned long long, unsigned long, and unsigned int, respectively. In
the blktap userspace code this were all varyingly long, unsigned long.
This mismatch caused 32-bit wraparound on large disks. The attached
patch updates the blktap userspace to use the same data types as
kernel space for all these params, thus both fixing the 32-bit bug &
giving the code consistency.

This patch has been tested both by comparing /proc/partitions in the
guest, with the image size seen in the host, and by using Stephen
Tweedie's 'verify-data' tool on a variety of multi-TB sized disks.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2006-11-28 13:50:32 +00:00
Andrew Warfield 3cfbe70d32 [BLKTAP] Little error handling fix to blktapctrl.c.
Signed-off-by: Andrew Warfield <andy@xensource.com>
2006-11-15 12:50:17 -08:00
kfraser@localhost.localdomain 720860012a [BLKTAP] Various cleanups necessary for ia64 support.
- remove magic number 8 and 64.
  page size / sector size is 8 on x86, however on ia64 page size is
  16kb.
  blkring size is 64 on x86. however it's 128 on ia64.
- replace 0xFFFF with INVALID_GRANT_HANDLE
- don't map io ring into user space with uncachable.
  kernel access the page with cacable and tapdisk uses memory barrier
  so that it isn't necessary.
- remove printk warning and inserted new line.
- remove unused variable, page.
- add one BUG()

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
2006-11-07 11:01:35 +00:00
kfraser@localhost.localdomain 9f29e9da09 [BLKTAP] Simplify linked-list insertion/deletion.
This should also avoid (bogus) compiler warnings, as reported
on IA64.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-10-25 10:56:50 +01:00
kaf24@firebug.cl.cam.ac.uk 1febf1acf7 [BLKTAP] Remove bogus extra public definition of sig_handler().
Also do not build the daemon -fPIC.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-10-08 18:05:57 +01:00
kfraser@localhost.localdomain dc2917720c [BLKTAP] Formatting and style cleanups to blktapctrl.
Signed-off-by: Keir Fraser <keir@xensource.com>
2006-10-06 15:04:42 +01:00
jchesterfield@dhcp92.uk.xensource.com 9bc9168a08 [BLKTAP] Blktapctrl: Add asynchronous watch on dom0 name entry for blktapctrl on startup. This patch cleans up the synchronisation issues between blktapctrl and xend at initialisation if the Dom0 entries have not yet been populated.
Signed-off-by: Julian Chesterfield <julian@xensource.com>
2006-10-05 10:55:13 +01:00
kfraser@localhost.localdomain bb52a4e20a [BLKTAP] Find major number by searching sysfs
instead of reading /proc/devices.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
2006-09-29 14:55:57 +01:00
Andrew Warfield 9dd368070b [BLKTAP] have blktap use a dynamic major
blktap currently uses a hardcoded major of 254 for the device.  This is
not robust in anyway and needs to be dynamic.

Note: it is better not to have the daemon create the node, and have udev
create it instead. But since the daemon currently creates the node
anyway, it is still the way this is done.  That change needs to be made
at another time.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
2006-09-28 12:47:45 -07:00
jchesterfield@dhcp92.uk.xensource.com 7005c6cd93 Switch blktapctrl.c over to using standard system daemon(3) call. Current patch was not closing all FDs and redirecting output to /dev/null, preventing tapdisk from launching correctly. 2006-08-01 17:59:27 +01:00
kfraser@localhost.localdomain 31c8886dc2 [BLKTAP] Properly daemonise the blktap control daemon. Fixes bug #709.
Signed-off-by: Harry Butterworth <butterwo@uk.ibm.com>
2006-07-31 18:07:25 +01:00
jchesterfield@dhcp92.uk.xensource.com 0da81aa1d4 Added blktap support. Includes kernel driver (enabled as CONFIG_XEN_BLKDEV_TAP=y) and userspace tools. The userspace deamon (blktapctrl) is enabled by default when xend is activated. For further information on using and configuring blktap see tools/blktap/README. 2006-07-13 10:13:26 +01:00