Re: question on NBD idempotency

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Nov 15, 2024 at 09:43:24AM -0600, Eric Blake wrote:
> Is there an existing set of ioctls where the creation of an NBD device
> could associate a user-space tag with the device, and I can then later
> query the device to get the tag back?  A finite-length string would be
> awesome (I could store "nbd://$ip:$port/$export" as the tag on
> creation, to know precisely which server the device is talking to),
> but even an integer tag (32- or 64-bit) might be enough (it's easier
> to choose an integer tag in the full 2^64 namespace that is unlikely
> to cause collisions with other processes on the system, than it is to
> avoid collisions in the limited first few $N of the /dev/nbd$N device
> names chosen to pick the lowest unused integer first).  If not, would
> it be worth adding such ioctls for the NBD driver?

Aha - Stefan pointed me to NBD_ATTR_BACKEND_IDENTIFIER, in use in
places such as

https://github.com/vitalif/vitastor/blob/156d0054129c43cc26262663ff2c1cbb5b206513/src/client/nbd_proxy.cpp#L164
https://github.com/xdavidwu/ceph/blob/2f1768caeb96425877d3f5cbfa779c590a23e938/src/tools/rbd_nbd/rbd-nbd.cc#L1394

which looks like I can associate a given string directly with the
netlink creation, then later modification via netlink insists that the
same backend string be present, and where sysfs can be used to grab
the contents of nbd->backend as stored in the kernel.  The only
problem: nbd-client does not (yet) set this netlink parameter.  Looks
like I get to patch nbd-client, as that netlink field sounds exactly
like what I want.

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.
Virtualization:  qemu.org | libguestfs.org





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux