Skip to contentSkip to conversation

blktap failure after 14895:800aa9f5cec9 (moves /dev/xen/... to /var/run/tap/...)

DISCUSSION Brendan Cully 2 participants 6 messages May 2, 2007

lore
Share & tools
lore
#0 lore raw

I don't know why I'm the only one to see this, but blktap hasn't been working for me since 14895:800aa9f5cec9. Opening /var/run/tap/blktap0 fails. I think this is because the kernel defines BLKTAP_DEV_DIR as /dev/xen in drivers/xen/blktap/blktap.c, but in that changeset the tools define it as /var/run/tap in tools/blktap/lib/blktaplib.h.

Reverting the change to blktaplib.h gives me blktap devices again. Reads and writes don't seem to make any progress. I'll keep investigating, but any clues would be welcome.

#1 lore raw
Quoted 9 lines · Brendan Cully

I don't know why I'm the only one to see this, but blktap hasn't been working for me since 14895:800aa9f5cec9. Opening /var/run/tap/blktap0 fails. I think this is because the kernel defines BLKTAP_DEV_DIR as /dev/xen in drivers/xen/blktap/blktap.c, but in that changeset the tools define it as /var/run/tap in tools/blktap/lib/blktaplib.h.

Reverting the change to blktaplib.h gives me blktap devices again. Reads and writes don't seem to make any progress. I'll keep investigating, but any clues would be welcome.

More likely it's simply because /var/run/tap/ doesn't exist?

Either some startup script needs to 'mkdir -p', or blktapctrl needs to make the directory on demand.

-- Keir

#2 lore raw
Quoted 8 lines · Keir Fraser
Quoted 6 lines · Brendan Cully

I don't know why I'm the only one to see this, but blktap hasn't been working for me since 14895:800aa9f5cec9. Opening /var/run/tap/blktap0 fails. I think this is because the kernel defines BLKTAP_DEV_DIR as /dev/xen in drivers/xen/blktap/blktap.c, but in that changeset the tools define it as /var/run/tap in tools/blktap/lib/blktaplib.h.

Quoted 8 lines
Quoted 3 lines

Reverting the change to blktaplib.h gives me blktap devices again. Reads and writes don't seem to make any progress. I'll keep investigating, but any clues would be welcome.

More likely it's simply because /var/run/tap/ doesn't exist?

Either some startup script needs to 'mkdir -p', or blktapctrl needs to make the directory on demand.

the blktap tools do create that directory on demand, and in fact /var/run/tap/blktap0 is properly created. What fails is the 'open', somewhere in the kernel I believe. Maybe this only affects block-attaching a device in domain 0?

#3 lore raw
Quoted 9 lines · Brendan Cully
Quoted 4 lines

More likely it's simply because /var/run/tap/ doesn't exist?

Either some startup script needs to 'mkdir -p', or blktapctrl needs to make the directory on demand.

the blktap tools do create that directory on demand, and in fact /var/run/tap/blktap0 is properly created. What fails is the 'open', somewhere in the kernel I believe. Maybe this only affects block-attaching a device in domain 0?

The open() that's part of mkfifo()? Those FIFO files have nothing to do with the blktap kernel module, I believe, in which case this can't have anything to do with a mismatch of something between blktap user and blktap kernel.

-- Keir

#4 lore raw
Quoted 10 lines · Keir Fraser
Quoted 5 lines · Brendan Cully
Quoted 4 lines

More likely it's simply because /var/run/tap/ doesn't exist?

Either some startup script needs to 'mkdir -p', or blktapctrl needs to make the directory on demand.

Quoted 8 lines
Quoted 4 lines

the blktap tools do create that directory on demand, and in fact /var/run/tap/blktap0 is properly created. What fails is the 'open', somewhere in the kernel I believe. Maybe this only affects block-attaching a device in domain 0?

The open() that's part of mkfifo()? Those FIFO files have nothing to do with the blktap kernel module, I believe, in which case this can't have anything to do with a mismatch of something between blktap user and blktap kernel.

The open of blktap0 (the character device).

#5 lore raw

The attached patch fixes the problem for me (well, my qcow tapdisk is still hanging, but that's a separate issue).

# HG changeset patch
# User Brendan Cully <[email protected]>
# Date 1178124163 25200
# Node ID f8d58ba6ba169a958539b85c771d47a2a2b1a322
# Parent c1fafdcdb19a781a603988346e49deae07054a54
Put blktap character device back into /dev/xen.
Changeset 14895:800aa9f5cec9 accidentally moved it into /var/run/tap along with the control FIFOs.

tools/blktap/drivers/blktapctrl.c +4 -2
diff -r c1fafdcdb19a -r f8d58ba6ba16 tools/blktap/drivers/blktapctrl.c
@@ -496,12 +496,12 @@ int blktapctrl_new_blkif(blkif_t *blkif)
 		if (!exist) {
 			DPRINTF("Process does not exist:\n");
 			asprintf(&rdctldev, 
-				 "%s/tapctrlread%d", BLKTAP_DEV_DIR, minor);
+				 "%s/tapctrlread%d", BLKTAP_CTRL_DIR, minor);
 			blkif->fds[READ] = open_ctrl_socket(rdctldev);
 
 
 			asprintf(&wrctldev, 
-				 "%s/tapctrlwrite%d", BLKTAP_DEV_DIR, minor);
+				 "%s/tapctrlwrite%d", BLKTAP_CTRL_DIR, minor);
 			blkif->fds[WRITE] = open_ctrl_socket(wrctldev);
 			
 			if (blkif->fds[READ] == -1 || blkif->fds[WRITE] == -1) 
@@ -601,6 +601,8 @@ int open_ctrl_socket(char *devname)
 	fd_set socks;
 	struct timeval timeout;
 
+	if (mkdir(BLKTAP_CTRL_DIR, 0755) == 0)
+		DPRINTF("Created %s directory\n", BLKTAP_CTRL_DIR);
 	ret = mkfifo(devname,S_IRWXU|S_IRWXG|S_IRWXO);
 	if ( (ret != 0) && (errno != EEXIST) ) {
 		DPRINTF("ERROR: pipe failed (%d)\n", errno);
tools/blktap/lib/blktaplib.h +2 -1
diff -r c1fafdcdb19a -r f8d58ba6ba16 tools/blktap/lib/blktaplib.h
@@ -78,9 +78,10 @@ static inline int BLKTAP_MODE_VALID(unsi
 
 #define BLKTAP_IOCTL_KICK 1
 #define MAX_PENDING_REQS	BLK_RING_SIZE
-#define BLKTAP_DEV_DIR   "/var/run/tap"
+#define BLKTAP_DEV_DIR   "/dev/xen"
 #define BLKTAP_DEV_NAME  "blktap"
 #define BLKTAP_DEV_MINOR 0
+#define BLKTAP_CTRL_DIR   "/var/run/tap"
 
 extern int blktap_major;
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel