Skip to content

Commit 8520d4c

Browse files
committed
This is iSCSI sharing for ZoL (shareiscsi).
* Supports the following iSCSI implementations (in this order of discovery): + IET http://iscsitarget.sourceforge.net + STGT http://stgt.berlios.de + SCST http://scst.sourceforge.net + Requires that SCST was compiled with /sys support (the default). + LIO http://linux-iscsi.org * Will refuse to unshares an active target (one with sessions). * Supports the following options to the 'shareiscsi' property: + name/iqn Full iSCSI Qualified Name (IQN), including identifier. This is generated by iscsi_generate_target(): + Uses the content of an optional /etc/iscsi_target_id file: Example: iqn.YYYY-MM.tld.domain + If this file doesn't exist, it uses the current year, month and domain name to generate the iqn. + The dataset name is appended at the end of the iqn, with slashes replaced with dots. => <iqn>:<dataset> + lun LUN (0-16384) Default: 0 (1 for STGT) + type Share mode (fileio, blockio, nullio, disk, tape) STGT: ssc, pt Default: blockio (disk for STGT) + iomode IO mode (wb, wt, ro) STGT: rdwr, aio, mmap, sg, ssc Default: wt (rdwr for STGT) + blocksize Logical block size (512, 1024, 2048, 4096) Default: Volume blocksize, 4096 if not usable. NOTE: Currently not supported for STGT (doesn't seem to be an option for it in tgtadm). + initiator Allow only this initiator to bind to target. Currently only availible for LIO, STGT and SCST. + authname Global user to use in binds on targets. + authpass Password for global user. * If not called with a 'name/iqn' value, then force setting it. This so that the IQN doesn't change every month (when it is regenerated again). It will be generated by iscsi_generate_target() (see above). NOTE: + Moved nfs.c:foreach_nfs_shareopt() to libshare.c:foreach_shareopt() so that it can be (re)used in smb.c and iscsi.c. + Split iSCSI implementation into their own separate source files + Use the list_{create,insert}() etc for keeping tabs of the linked lists instead of using a home-made version. + A half second delay had to be added in lib/libzfs/libzfs_mount.c:zfs_unmount() after the successful unshare. This to avoid 'dataset busy' when destroying recursivly. = The 'initiator', 'authname' and 'authpass' option might have some issues: It will make the compatibility between the different iSCSI implementations questionable - can't switch between them easily (it will ONLY be availible in ZoL). I COULD make the option be silently ignored (instead of forcibly rejected if not availible). But that still doesn't solve the (possible) problem between ZoL and OpenZFS/Illumos (setting the option, will possibly introduce problems when importing the pool on something else than ZoL). So some more discussion might be needed..
1 parent ebd0643 commit 8520d4c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/libzfs/libzfs_changelist.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,9 +252,9 @@ changelist_postfix(prop_changelist_t *clp)
252252

253253
mounted = zfs_is_mounted(cn->cn_handle, NULL);
254254

255-
if (!mounted && !needs_key && (cn->cn_mounted ||
256-
((sharenfs || sharesmb || clp->cl_waslegacy) &&
257-
(zfs_prop_get_int(cn->cn_handle,
255+
if (!mounted && (cn->cn_mounted ||
256+
((sharenfs || sharesmb || shareiscsi ||
257+
clp->cl_waslegacy) && (zfs_prop_get_int(cn->cn_handle,
258258
ZFS_PROP_CANMOUNT) == ZFS_CANMOUNT_ON)))) {
259259
if (zfs_mount(cn->cn_handle, NULL, 0) != 0)
260260
errors++;
@@ -568,7 +568,7 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int gather_flags,
568568
*/
569569
if (prop == ZFS_PROP_NAME || prop == ZFS_PROP_ZONED ||
570570
prop == ZFS_PROP_MOUNTPOINT || prop == ZFS_PROP_SHARENFS ||
571-
prop == ZFS_PROP_SHARESMB) {
571+
prop == ZFS_PROP_SHARESMB || prop == ZFS_PROP_SHAREISCSI) {
572572

573573
if (zfs_prop_get(zhp, ZFS_PROP_MOUNTPOINT,
574574
property, sizeof (property),
@@ -637,7 +637,7 @@ changelist_gather(zfs_handle_t *zhp, zfs_prop_t prop, int gather_flags,
637637
return (clp);
638638

639639
/*
640-
* If watching SHARENFS or SHARESMB then
640+
* If watching SHARENFS, SHARESMB then
641641
* also watch its companion property.
642642
*/
643643
/* TODO: add SHAREISCSI ? */

0 commit comments

Comments
 (0)