containerd / nydus-snapshotter

A containerd snapshotter with data deduplication and lazy loading in P2P fashion
https://nydus.dev/
Apache License 2.0
168 stars 96 forks source link

Failed to export image as tarfs block device #526

Closed ChengyuZhu6 closed 1 year ago

ChengyuZhu6 commented 1 year ago

When preparing the Container writable layer to export image as tarfs block device with dm-verity, the behavior will trigger snapshotter to crash.

error:

panic: assignment to entry in nil map

The reason is that there is an assignment to blockinfo within the labels map, which is currently uninitialized (a nil map).

blockInfo := strconv.FormatUint(dataBlobks, 10) + "," + strconv.FormatUint(hashOffset, 10) + "," + "sha256:" + rootHash
        if wholeImage {
            labels[label.NydusImageBlockInfo] = blockInfo
            updateFields = append(updateFields, "labels."+label.NydusImageBlockInfo)
        } else {
            labels[label.NydusLayerBlockInfo] = blockInfo
            updateFields = append(updateFields, "labels."+label.NydusLayerBlockInfo)
        }
jiangliu commented 1 year ago

Fixed