Bug 281000 - camsim: creating and destroying CTL LUNs does not notify the camsim frontend
Summary: camsim: creating and destroying CTL LUNs does not notify the camsim frontend
Status: New
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords: cam
Depends on:
Blocks:
 
Reported: 2024-08-22 22:17 UTC by Alan Somers
Modified: 2024-09-02 15:56 UTC (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alan Somers freebsd_committer freebsd_triage 2024-08-22 22:17:32 UTC
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.