Refuse to revive an NBD device with another image #155

Open
koolkhel wants to merge 1 commits from koolkhel/vitastor:nbd-backend-identifier into master

1 Commits

Author SHA1 Message Date
0ee5df904d Refuse to revive an NBD device with another image
netlink-revive /dev/nbdN --image other silently attached the device to
another image, so a filesystem mounted from it read and wrote that
image. The kernel refuses a RECONFIGURE whose backend identifier differs
from the one given on CONNECT, but vitastor-nbd never sent one: the code
sat under #ifdef NBD_ATTR_BACKEND_IDENTIFIER, which is an enum value and
never defined, and the caller passed NULL anyway.

Detect the attribute with CMake and send "<pool>:<inode>" on map and
revive. It survives an image rename and is the same for --image and
--pool/--inode. A device mapped without an identifier can still be
revived, unprotected. A device mapped with one can't be revived by an
older vitastor-nbd, which sends none.
2026-11-22 22:29:09 +03:00