Bug 226295

Summary: [iscsi] LUN modification error: LUN X is not managed by the block backend
Product: Base System Reporter: emz
Component: kernAssignee: freebsd-scsi (Nobody) <scsi>
Status: New ---    
Severity: Affects Only Me CC: asomers, pacanrulit
Priority: ---    
Version: 11.1-RELEASE   
Hardware: Any   
OS: Any   

Description emz 2018-03-02 12:25:05 UTC
Sometimes out of the vlue a "shadow LUN" appears, producing messages in logs similar to "LUN modification error: LUN X is not managed by the block backend".The lun mentioned is visible in the ctladm output abnd is stated to be of a type "block". ctladm remove on it is successful but usully doesn't resolve the problem. This usually happens  on aproduction system with properly configured targets.

The workaround is to issue ctladm remove -b block -l X statements, then comment out all the targets that kernel complains about, issue killall -HUP ctld reload until there will be no messages like that. Then uncomment all the targets back, resume operations.

last time 4 targets were affected.

===Cut===
Mar  2 16:40:49 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:gamestop-reference,lun,0", CTL lun 11
Mar  2 16:40:49 san01 ctld[560]: LUN modification warning: error opening /dev/zvol/gamestop/worker02-ver11_662: 2
Mar  2 16:40:49 san01 ctld[560]: failed to reload configuration
Mar  2 16:41:41 san01 ctld[560]: LUN modification warning: error opening /dev/zvol/gamestop/worker02-ver11_662: 2
Mar  2 16:49:24 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 16:49:24 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:gamestop-reference,lun,0", CTL lun 11
Mar  2 16:49:24 san01 ctld[560]: failed to reload configuration
Mar  2 16:55:33 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 16:55:33 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:gamestop-reference,lun,0", CTL lun 11
Mar  2 16:55:33 san01 ctld[560]: failed to reload configuration
Mar  2 16:57:34 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 16:57:34 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:gamestop-reference,lun,0", CTL lun 11
Mar  2 16:57:34 san01 ctld[560]: failed to reload configuration
Mar  2 17:07:36 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 17:07:36 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:gamestop-reference,lun,0", CTL lun 11
Mar  2 17:07:36 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 17:07:36 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:games-worker01,lun,1", CTL lun 11
Mar  2 17:07:36 san01 ctld[560]: failed to reload configuration
Mar  2 17:09:03 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 17:09:03 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:gamestop-reference,lun,0", CTL lun 11
Mar  2 17:09:03 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 17:09:03 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:games-worker01,lun,1", CTL lun 11
Mar  2 17:09:03 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 17:09:03 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:games-worker16,lun,1", CTL lun 11
Mar  2 17:09:04 san01 ctld[560]: failed to reload configuration
Mar  2 17:09:41 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
Mar  2 17:09:41 san01 ctld[560]: failed to modify lun "iqn.2016-04.net.playkey.iscsi:gamestop-reference,lun,0", CTL lun 11
Mar  2 17:09:41 san01 ctld[560]: LUN modification error: LUN 11 is not managed by the block backend
===Cut===
Comment 1 Alan Somers freebsd_committer freebsd_triage 2022-04-18 18:32:51 UTC
*** Bug 252425 has been marked as a duplicate of this bug. ***
Comment 2 Alan Somers freebsd_committer freebsd_triage 2022-04-18 19:14:54 UTC
I encountered the same problem in a build based on stable/13 from last September.  But in my case "ctladm remove" did not work; it failed with the same error.  And since there are only two backends to choose from, I tried "-b ramdisk" as well, which failed with the same error again.  There was also one remaining iSCSI session, connected to the faulty LUN, but "ctladm isterminate -a" had no effect.  I could only resolve the problem by rebooting.

$ sudo ctladm remove -b block -l 133 
ctladm: LUN removal error: LUN 133 is not managed by the block backend