655ea8d storage: don't read storage volumes in nonblock mode

Authored and Committed by ericb 10 years ago
    storage: don't read storage volumes in nonblock mode
    
    Commit 348b4e2 introduced a potential problem (thankfully not
    in any release): we are attempting to use virFileReadHeaderFD()
    on a file that was opened with O_NONBLOCK.  While this
    shouldn't be a problem in practice (because O_NONBLOCK
    typically doesn't affect regular or block files, and fifos and
    sockets cannot be storage volumes), it's better to play it safe
    to avoid races from opening an unexpected file type while also
    avoiding problems with having to handle EAGAIN while read()ing.
    
    Based on a report by Dan Berrange.
    
    * src/storage/storage_backend.c
    (virStorageBackendVolOpenCheckMode): Fix up fd after avoiding race.
    
    Signed-off-by: Eric Blake <eblake@redhat.com>
    
        
file modified
+21 -4