Announcement

Collapse
No announcement yet.

Systemd/Microsoft Effort For A Global Counter On Block/Disk Changes Coming To Linux 5.15

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • #31
    Originally posted by teknoraver View Post
    Imagine to have an usb disk named /dev/sdd. You unplug and replug it, how can an application know that /dev/sdd is the same as 10 minutes ago?
    The number now increases for every disk registration, and it's unique since boot:
    So it's more of a counter of "how many different disks have been sda since boot?"

    It a counter strictly necessary for that? Wouldn't it be easier for both userspace and kernelspace to have a filehandle that expires on disk removal, as is the case for process filehandles when dealing with PID reuse?

    Comment


    • #32
      Originally posted by Developer12 View Post

      So it's more of a counter of "how many different disks have been sda since boot?"

      It a counter strictly necessary for that? Wouldn't it be easier for both userspace and kernelspace to have a filehandle that expires on disk removal, as is the case for process filehandles when dealing with PID reuse?
      Yes, it's also a counter of how many disks have been seen.

      The filehandle was not feasable, because only root can open a handle to most disks, and creating fds is more expensive anyway.
      What we did, is just an incremental number to every disk registration, exposed to /sys

      Comment


      • #33
        Originally posted by teknoraver View Post
        Yes, it's also a counter of how many disks have been seen.
        What would be a use case for this?

        Originally posted by teknoraver View Post
        The filehandle was not feasable, because only root can open a handle to most disks, and creating fds is more expensive anyway.
        What we did, is just an incremental number to every disk registration, exposed to /sys
        Wouldn't have /dev/disk/by-uuid/... achieved the same and even more like:
        - detecting if a disk has been removed from the system if the uuid has gone missing
        - re-attaching the same disk on a different port (sdc -> sde) and still be able to use it transparently without a redetection and migration logic
        - no explicit support for another field and additional logic for that counter to do stuff
        - already etablished, nothing to add; to the kernel no less

        Comment


        • #34
          If you want to have a look at (least one) bug solved by this counter, here is it:

          https://github.com/systemd/systemd/issues/17469

          Comment

          Working...
          X