This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
Home Products Support Community News


[Xen-devel] a problem from blktap?

To: "xen-devel" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] a problem from blktap?
From: "房海峰" <fhf25@xxxxxxx>
Date: Tue, 7 Jul 2009 17:19:01 +0800
Cc: fanghaifeng <fanghaifeng@xxxxxxxxxx>
Delivery-date: Tue, 07 Jul 2009 02:19:56 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
hi all,
currently, i am debuging the code derived from block-sync.c, the detail as follow:
        struct socket_message_header *msg_hdr;                                                                                                               
        struct socketmsg_sync_read * msg_body;                                                                                                               
        int msglen, size;                                                                                                                                    
        char * msgbuf = msg;                                                                                                                                 
        int ret = 0;                                                                                                                                         
        uint64_t offset;                                                                                                                                     
        char * iobuf = NULL;                                                                                                                                 
        msg_hdr = (struct socket_message_header *)msgbuf;                                                                                                    
        msg_body = (struct socketmsg_sync_read *)(msgbuf + sizeof(struct socket_message_header));                                                            
        msglen = msg_hdr->len;                                                                                                                               
        size    = msg_body->nb_sectors * msg_body-sector_size;
        offset  = msg_body->sector * (uint64_t)msg_body->sector_size;                         
        MY_DPRINTF("READ: nb_sectors = %d, sector_size = %d, start_sector = %llu",                                                                           
        //iobuf = calloc(size, sizeof(char));                                                                                                                
        iobuf = malloc(size);                                                                                                                                
        if (!iobuf)                                                                                                                                          
                goto failure;                                                                                                                                
        MY_DPRINTF("IO Buffer memory calloc is ok!");                                                                                                        
        ret = lseek(image_fd, offset, SEEK_SET);                                                                                                             
        if (ret != (off_t)-1) {                                                                                                                              
                MY_DPRINTF("after lseek, the position is at %lu", (unsigned long) ret);                                                                      
                MY_DPRINTF("image_fd = %d, iobuf = %p, size = %d", image_fd, iobuf, size);                                                                   
                ret = readn(image_fd, (void*)iobuf, (size_t)size);                                                                                           
                if (ret < 0) {                                                                                                                               
                        MY_DPRINTF("readn(%s) is error!", strerror(errno));                                                                                  
                        goto failure;                                                                                                                        
                                MY_DPRINTF("readn() is end, and has read [%d] data!", ret);                                                                  
        } else                                                                                                                                               
                MY_DPRINTF("lseek is error(%s)", strerror(errno));                                                                                           
                goto failure;                                                                                                                                
        MY_DPRINTF("Seek and Read image is ok!");                                      
the debuging output, which cut from /var/log/message, are as follow:
Jul  7 16:45:07 domain0 remote-blktapctrl[3963]: [hook_new_tapdisk(712)] loop for select(4)............                                                      
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_new_tapdisk(715)] select() is end, and ret = 1                                                        
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_new_tapdisk(720)] enter hook_read_message().                                                          
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_read_message(632)] read() is end, and msglen=32                                                       
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_read_message(651)] receive SOCK_MSG_READ message.                                                     
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_do_read(502)] READ: nb_sectors = 2, sector_size = 512, start_sector = 2                               
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_do_read(508)] IO Buffer memory calloc is ok!                                                          
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_do_read(513)] after lseek, the position is at 1024                                                    
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_do_read(514)] image_fd = 6, iobuf = 0x804f388, size = 1024                                            
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [readn(66)] call readn(fd[6], ptr[0x804f388], n[1024])                                                      
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [readn(70)] call read(fd[6], ptr[0x804f388], nleft[1024])                                                   
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [readn(73)] read is error (Invalid argument)                                                                
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [readn(74)] nread = -1, nleft = 1024, n = 1024                                                              
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_do_read(518)] readn(Invalid argument) is error!                                                       
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_read_message(653)] hook_do_read() is end, and ret = -1                                                
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_read_message(670)] do with message is error!                                                          
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_new_tapdisk(722)] out of hook_read_message().                                                         
Jul  7 16:45:11 domain0 remote-blktapctrl[3963]: [hook_new_tapdisk(712)] loop for select(5)............                                                      
Jul  7 16:45:21 domain0 remote-blktapctrl[3963]: [hook_new_tapdisk(715)] select() is end, and ret = 0     
among the list above, you can find the error message about the "readn" function. to resovle this problem, i have try some methods, BUT all is failure.
varify the mode of opening the file, that is O_RDWR | O_DIRECT | O_LARGEFILE
So, who can help me to do with this problem?
read is error (Invalid argument) ?
thanks a lot!

Xen-devel mailing list
<Prev in Thread] Current Thread [Next in Thread>