SCST-project / scst

SCST is a SCSI target software stack that allows to export any block device or file via iSCSI, FC or RDMA (SRP).
http://scst.sourceforge.net
93 stars 34 forks source link

iscsi-scst: Add mechanism to restore target parameter to default #232

Closed bmeagherix closed 6 months ago

bmeagherix commented 6 months ago

Writing the string :default: to the /sys entry will restore local_def

root@cluster1:~# cat /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/DataDigest
None
root@cluster1:~# echo CRC32C > /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/DataDigest
root@cluster1:~# cat /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/DataDigest
CRC32C
[key]

root@cluster1:~# echo ':default:' > /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/DataDigest
root@cluster1:~# cat /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/DataDigest
None
root@cluster1:~#
root@cluster1:~# cat /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/MaxRecvDataSegmentLength
1048576
root@cluster1:~# echo 8192 > /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/MaxRecvDataSegmentLength
root@cluster1:~# cat /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/MaxRecvDataSegmentLength
8192
[key]

root@cluster1:~# echo ':default:' > /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/MaxRecvDataSegmentLength
root@cluster1:~# cat /sys/kernel/scst_tgt/targets/iscsi/iqn.2005-10.org.freenas.ctl:test1/MaxRecvDataSegmentLength
1048576

Not attractive, but IMO the functionality is worthwhile. If the user no longer wants to override a parameter, it seems preferrable to have a mechanism to reset it, rather than e.g. restart SCST.

lnocturno commented 6 months ago

Hi Brian,

Thank you for the patch!

Thanks, Gleb

bmeagherix commented 6 months ago

Thanks Gleb!