[Bug 281000] camsim: creating and destroying CTL LUNs does not notify the camsim frontend

From: <bugzilla-noreply_at_freebsd.org>
Date: Thu, 22 Aug 2024 22:17:32 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=281000

            Bug ID: 281000
           Summary: camsim: creating and destroying CTL LUNs does not
                    notify the camsim frontend
           Product: Base System
           Version: CURRENT
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: asomers@FreeBSD.org

Creating and destroying CTL LUNs does not notify the camsim frontend.  Whether
I create a LUN or destroy it, the camsim frontend does not report any change
until a reprobe (for Mediasize changes) or rescan (for device creation or
destruction).  Shouldn't this be automatic?

Steps to Reproduce
==================

$ sudo kldload ctl
$ sudo ctladm port -o on -p 0
Front End Ports enabled
$ sudo ctladm create -b ramdisk -s 1048576
LUN created successfully
backend:       ramdisk
device type:   0
LUN size:      1048576 bytes
blocksize      512 bytes
LUN ID:        0
Serial Number: MYSERIAL0000
Device ID:     MYDEVID0000
$ sudo camcontrol devlist

Notice that there are no da devices

$ sudo camcontrol rescan all
Re-scan of bus 0 was successful
$ sudo camcontrol devlist
<FREEBSD CTLDISK 0001>             at scbus0 target 0 lun 0 (da0,pass0)

Now there is a da device

$ sudo ctladm remove -b ramdisk -l 0
LUN 0 removed successfully
$ sudo camcontrol devlist
<FREEBSD CTLDISK 0001>             at scbus0 target 0 lun 0 (da0,pass0)

Notice that there is still a da device, even though it should be gone.

$ sudo ctladm create -b ramdisk -s 2097152
LUN created successfully
backend:       ramdisk
device type:   0
LUN size:      2097152 bytes
blocksize      512 bytes
LUN ID:        0
Serial Number: MYSERIAL0000
Device ID:     MYDEVID0000
$ geom disk list da0 | grep Mediasize
   Mediasize: 1048576 (1.0M)

Now we recreated the device, but notice that its Mediasize is wrong.

-- 
You are receiving this mail because:
You are the assignee for the bug.