• Prasanna Kumar Kalever's avatar
    nbd: provide a way for userspace processes to identify device backends · 6497ef8d
    Prasanna Kumar Kalever authored
    Problem:
    On reconfigure of device, there is no way to defend if the backend
    storage is matching with the initial backend storage.
    
    Say, if an initial connect request for backend "pool1/image1" got
    mapped to /dev/nbd0 and the userspace process is terminated. A next
    reconfigure request within NBD_ATTR_DEAD_CONN_TIMEOUT is allowed to
    use /dev/nbd0 for a different backend "pool1/image2"
    
    For example, an operation like below could be dangerous:
    
    $ sudo rbd-nbd map --try-netlink rbd-pool/ext4-image
    /dev/nbd0
    $ sudo blkid /dev/nbd0
    /dev/nbd0: UUID="bfc444b4-64b1-418f-8b36-6e0d170cfc04" TYPE="ext4"
    $ sudo pkill -9 rbd-nbd
    $ sudo rbd-nbd attach --try-netlink --device /dev/nbd0 rbd-pool/xfs-image
    /dev/nbd0
    $ sudo blkid /dev/nbd0
    /dev/nbd0: UUID="d29bf343-6570-4069-a9ea-2fa156ced908" TYPE="xfs"
    
    Solution:
    Provide a way for userspace processes to keep some metadata to identify
    between the device and the backend, so that when a reconfigure request ...
    6497ef8d
nbd.c 61.8 KB