Revision 15dc2697

b/block.c
451 451
        bs->enable_write_cache = 1;
452 452

  
453 453
    bs->read_only = (flags & BDRV_O_RDWR) == 0;
454
    if (!(flags & BDRV_O_FILE)) {
455
        open_flags = (flags & (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO));
456
        if (bs->is_temporary) { /* snapshot should be writeable */
457
            open_flags |= BDRV_O_RDWR;
458
        }
459
    } else {
460
        open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT);
454

  
455
    /*
456
     * Clear flags that are internal to the block layer before opening the
457
     * image.
458
     */
459
    open_flags = flags & ~(BDRV_O_FILE | BDRV_O_SNAPSHOT | BDRV_O_NO_BACKING);
460

  
461
    /*
462
     * Snapshots should be writeable.
463
     *
464
     * XXX(hch): and what is the point of a snapshot during a read-only open?
465
     */
466
    if (!(flags & BDRV_O_FILE) && bs->is_temporary) {
467
        open_flags |= BDRV_O_RDWR;
461 468
    }
462 469

  
463 470
    ret = drv->bdrv_open(bs, filename, open_flags);

Also available in: Unified diff