Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iSCSI support for ZoL #1099

Closed
wants to merge 2 commits into from
Closed

iSCSI support for ZoL #1099

wants to merge 2 commits into from

Conversation

FransUrbo
Copy link
Contributor

Add support for the shareiscsi property.

It currently (as of Sept 2, 2014) supports four different iSCSI target implementations (in this order of discovery):

It supports the following (official) options to the property:

  • name (or iqn)
  • lun
  • type
  • iomode - ignored for LIO
  • blocksize - ignored for STGT
  • initiator (or acl) - only for LIO, STGT and SCST
  • authname
  • authpass

@thespooler
Copy link

I'm curious to know why this was not merged and no comment was added. Does nobody care about iSCSI?

@DeHackEd
Copy link
Contributor

It's scheduled for milestone 0.7.0 so it's not considered high priority right now.

It does do a couple of things that are objectionable, such as modifying the META file with what I assume are author's versioning information. The date in the "iqn.2013-09.*" field is supposed to be a constant yet it appears to be calculated from today's date, meaning once a month initiators need to be updated. Only two kernel targets are supported (eg: no userspace like tgtd support)

So yeah, there's some rather serious problems with it. I wouldn't merge it as-is. Someone should look at it in even more detail though.

@FransUrbo
Copy link
Contributor Author

When I started investigate iSCSI, I found a number of specifications about the IQN. All said it's supposed to be 'iqn.[date (YYYY-MM) of creating share].[host sharing the device]'.

That's why I'm auto-generating it. But the latest version can have this set using either options to 'shareiscsi' or config file...

@FransUrbo
Copy link
Contributor Author

Updated for latest master. I think I got rid of the META modification (wasn't supposed to be there). Also merged it as ONE commit.

@FransUrbo
Copy link
Contributor Author

I'm working on updating it to latest HEAD, but in the mean time edit lib/libshare/libshare.c so that the libshare_init(void) function looks like this:

__attribute__((constructor)) static void
libshare_init(void)
{
        libshare_nfs_init();
        libshare_smb_init();
        libshare_iscsi_init();
}

That should do it...

@FransUrbo
Copy link
Contributor Author

Ok, updated (again) to HEAD.

@FransUrbo
Copy link
Contributor Author

Are you sure you're running the new module and binaries?

@FransUrbo
Copy link
Contributor Author

Did you run ./autogen.sh and the configure line again before you built?

@FransUrbo
Copy link
Contributor Author

Well, I just tried it myself, and it wouldn't compile because there was an erraneous space in a function call. So you'll have to make absolutly sure that there is no rpm in your directory before continuing.

I'm quite sure you installed a previous, non-iscsi enabled package...

@pyavdr
Copy link
Contributor

pyavdr commented Jan 28, 2014

Is there support for scst too?

@FransUrbo
Copy link
Contributor Author

@pyavdr Yes there is.

With the latest push, it compiles and installs just fine:

celia(USB_SAMSUNG_HD401LJ):~# zfs get 2>&1 | grep -i iscsi
        shareiscsi      YES       NO   on | off | ietadm(8M) options

@pyavdr
Copy link
Contributor

pyavdr commented Jan 28, 2014

Yes i got it now. Will do some tests with it. Thank you!

@FransUrbo
Copy link
Contributor Author

By the way, in your command line above, use && instead of ;. That way the next command won't continue if the previous failed...

@pyavdr
Copy link
Contributor

pyavdr commented Jan 29, 2014

@FransUrbo
Yes, your are right, that was the problem. I will change it. Thank you.

@FransUrbo
Copy link
Contributor Author

@DeHackEd Could you take another look at the patch, I got rid of most (all?) of you issues.

Regarding the IQN thing. According to http://en.wikipedia.org/wiki/ISCSI#Addressing, the naming scheme is:

  • literal iqn (iSCSI Qualified Name)
  • date (yyyy-mm) that the naming authority took ownership of the domain
  • reversed domain name of the authority (e.g. org.alpinelinux, com.example, to.yp.cr)
  • Optional ":" prefixing a storage target name specified by the naming authority.

So the 'reversed domain name' can be read in two ways - either MY domain name (i.e., the domain name I'm using myself at home/at the site) and the second interpretation is ZoL... Technically, so is the date - when was I started using my domain (I choose to interpret it as when I initially stared sharing the volume).

But the possibility to hardcode it in /etc/iscsi_target_id have been added.

DebianZFS-Wheezy-SCST2:/usr/src/zfs# cat /etc/iscsi_target_id
iqn.2012-11.com.bayour

I'm not very happy with forcing/hardcoding it to iqn.2010-09.org.zfsonlinux on every single machine (which is ONE way of interpreting the naming scheme). I also support the iqn option to the shareiscsi property in an additional attempt to allow the admin to choose for him/her self.

@FransUrbo
Copy link
Contributor Author

@DeHackEd I'm looking into adding support for tgtd, but it doesn't seem to be possible to create a target with istgtcontrol, only by editing a file and restart/reload the tgt daemon. This is not acceptable (there's no way I, or anyone else for that matter - I would fight it vigorously :) can authorize modifying files not belonging to ZoL/zfs.

@DeHackEd
Copy link
Contributor

I'm running CentOS 6. Their version of tgtd doesn't read a config file, the startup script launches tgtd and then invokes tgt-admin to read the config file and push it to the daemon. tgt-admin is just a config converter where tgtadm does the heavy lifting.

I don't know what you're running, but that's something you might want to look into. CentOS's current package name/version is scsi-target-utils-1.0.24-10.el6

@FransUrbo
Copy link
Contributor Author

I'm starting to thing we're talking about two different softwares...

The one I've been playing with is called (in Debian GNU/Linux) istgt:

Description-en: iSCSI userspace target daemon for Unix-like operating systems
 istgt is a iSCSI target for Unix-like operating systems (including those with
 Linux and kFreeBSD kernels) running as daemon process in user space.
 .
 It supports:
 .
  * Multipath I/O
  * 64bit LBA for volumes over 2 TiB size
  * Header/Data digest by CRC32C
  * Mutual authentication with CHAP
  * Multiple LUNs and ACLs for portals
  * IPv6/IPv4 support
Homepage: http://www.peach.ne.jp/archives/istgt/

But I also found tgt:

Description-en: Linux SCSI target user-space tools
 The Linux target framework (tgt) allows a Linux system to provide SCSI
 devices (targets) over networked SCSI transports.
 .
 Tgt consists of kernel modules, user-space daemon, and user-space
 This package contains the user-space daemon and tools; a recent Linux
 kernel is required for the modules.
 .
 This package includes drivers for:
 .
  - FCoE (Fibre Channel over Ethernet)
  - iSCSI (SCSI over IP)
  - iSER (iSCSI over RDMA, using Infiniband)
Homepage: http://stgt.berlios.de/

The first one clearly states to be (all!) user space, the other needs a kernel module. That one does however have tgt-admin though... Could you check where your target system comes from?

@FransUrbo
Copy link
Contributor Author

I've started adding support for the latter (STGT) now in any case. Should only take a day or two hopefully...

@FransUrbo
Copy link
Contributor Author

Ok, STGT (from http://stgt.berlios.de) support added. Not complete - works in simple tests but better/more testing is needed.

@FransUrbo
Copy link
Contributor Author

@DeHackEd If STGT is the one you're talking about (it sure looks like it though), is it true it's not possible to add a backing store to LUN0?!?

No matter what I try, I fail:

DebianZFS-Wheezy-SCST2:/usr/src/zfs# tgtadm --lld iscsi --op update --mode logicalunit --tid 2 --lun 0 --backing-store /dev/zvol/mypool/tests/iscsi/tst003 --device-type disk --bstype rdwr
tgtadm: option '-b' not supported in logicalunit mode
DebianZFS-Wheezy-SCST2:/usr/src/zfs# tgtadm --lld iscsi --op update --mode target --tid 2 --lun 0 --backing-store /dev/zvol/mypool/tests/iscsi/tst003 --device-type disk --bstype rdwr
tgtadm: target mode: option '-l' is not allowed/supported
DebianZFS-Wheezy-SCST2:/usr/src/zfs# tgtadm --lld iscsi --op delete --mode logicalunit --tid 2 --lun 0
tgtadm: invalid request

Instead I resorted to add it as LUN1 which works, but what's the point of having an 'empty' LUN?

@DeHackEd
Copy link
Contributor

stgt appears to be what CentOS 6 ships. As for LUN0, it's not an empty LUN, it's the controller. It's SCSI, after all.

@FransUrbo
Copy link
Contributor Author

Ok. Doesn't really matter. None of the other implementations I've tried had anything like that. There the device is on LUN0 'directly'... Ah, well.

Now all I/we need is more eyes on this :)

@FransUrbo
Copy link
Contributor Author

There's something very weird with this patch. Something is missing, but I can't for the life of me figure out what!

http://bayour.com/misc/screenlog_share+destry.txt

That is a log of creating three volumes, set shareiscsi=on on all of them (individually), then destroying the container recursively...

Sometimes it works, sometimes it doesn't. And when it fails, it's completely random WHERE it will fail (i.e., on which volume). It will always work if I issue the destroy multiple times though.

Since zfs_unshare_proto() succeeds, I have no idea why the destroy fails.

destroy_callback()
  zfs_unmount: is_shared(/dev/zvol/mypool/tests/iscsi3)
  zfs_unmount: zfs_unshare_proto(/dev/zvol/mypool/tests/iscsi3) == 0
  zfs_destroy() failed!

@FransUrbo
Copy link
Contributor Author

Ok, with a lot of trial-and-error, I managed to figure out that STGT actually takes 'a while' from issuing the delete, until it's actually deleted.

So adding a sleep(1) between the unshare and the destroy worked. Question, is: Is it to much (or to little!!)? What if the system is extremely busy, then one second might not be enough!

UPDATE: Using usleep(50000) is quicker, and works on my (almost idle) VM. Need to triple check that it still works on a busy system though.

@FransUrbo
Copy link
Contributor Author

Have to settle for half a second. That worked when the machine was loaded at 3.something... Don't like it, but it works... If anyone have a better idea, I'm listening!

@FransUrbo
Copy link
Contributor Author

I have considered to just spawn tgtadm (or whatever admin command is in use) and wait for it to fail when looking for a TID. But that's going to take longer... Might be better though (no matter how loaded, it won't claim unshared until it really is)...

UPDATE: Well, that didn't work anyway :(. The tgtadm command, when asked for a TID that don't exist will return > 0, but zfs destroy still reports dataset busy. So I guess it's half a second sleep then... :(

@FransUrbo
Copy link
Contributor Author

Ok, even worse problem: A 'zfs rename' doesn't work most of the times. So I've separated what I was planning/hoping on being a fix for that, but that just made things worse.

So if someone have an idea of the correct fix, I'd appreciate it.

@FransUrbo
Copy link
Contributor Author

The problem is that in a 'zfs rename', the old share isn't unshared before the new dataset name is shared, leaving TWO shares (one broken, because the ZVOL have been renamed).

Strangely enough, this seems to work just fine for both NFS and SMB. I've been looking at this for two days now, but I just can't find it...

@FransUrbo
Copy link
Contributor Author

So basically, if I put the unshare anywhere BEFORE the IOCTL, zfs hangs on the IOCTL.

The few times I got it to work, it was eventually unshared in sa_fini(). But I don't know how that can be, it is called after changelist_rename(), which basically removes the old entry and overwrites it with the new name, which can't be unshared, since it technically isn't shared (because it doesn't exist).

  libzfs_dataset.c:zfs_rename()
    libzfs_changelist.c:changelist_gather()
    libzfs_changelist.c:changelist_prefix()
      libzfs_changelist.c:changelist_postfix()
        libzfs_mount.c:zfs_uninit_libshare()
        libzfs_mount.c:zfs_share()
        libzfs_mount.c:zfs_unshare()
    libzfs_util.c:zfs_ioctl(zhp->zfs_hdl, ZFS_IOC_RENAME, &zc)
    libzfs_changelist.c:changelist_rename()
    libzfs_changelist.c:changelist_postfix()
      libzfs_mount.c:zfs_uninit_libshare()
        libshare.c:sa_fini()
      libzfs_mount.c:zfs_share()
      libzfs_mount.c:zfs_unshare()

However, the sharetab is correctly updated in sa_fini() (the old entry is removed correctly).

@FransUrbo FransUrbo closed this Feb 24, 2015
@FransUrbo FransUrbo deleted the iscsi branch February 24, 2015 20:17
@pdf
Copy link

pdf commented Feb 24, 2015

Wait, what hapened here? @FransUrbo why is this closed? Now both issues are closed, and your branch is deleted?

@FransUrbo
Copy link
Contributor Author

Wait, what hapened here? @FransUrbo why is this closed? Now both issues are closed, and your branch is deleted?

It's quite clear that this isn't going in… It's been waiting for two and a half years (granted, I've rewritten it twice since then, but still) and now it's been pushed to the next tag AGAIN. I simply don't have any interested in pursuing this any more.

Brian wants ZED to do this, so anyone that want/need iSCSI support in ZoL will just have to wait for it to be done 'correctly' (in zed).

@behlendorf
Copy link
Contributor

@FransUrbo Yes, I did and I'm sorry about that. But the absolute last thing I want to do is accidentally break something subtle before a tag. A tag which is already overdue. I should have gotten this pushed over the finish line and merged right after 0.6.3 as planned then it would have had sufficient time to soak in master. But I didn't.

My concern is that this patch touches a considerable bit of zfs_main.c and I'm not 100% comfortable that it doesn't introduce a regression. If we could get a someone other than myself to step up review the code and sign off on this patch I'm open to merging it. I know many people have reported success with this patch but I think it needs another set of eyes on it. I should said that more clearly earlier.

It's true I would like to explore the idea of having the ZED take care of this but I'm not hell bent on that solution.

@prologic
Copy link

@FransUrbo @behlendorf Can we get some momentum on this and get this patch going again and properly reviewed as suggested in the comments? I think I'm not the only one that wants native iSCSI support in ZOL :)

@sempervictus
Copy link
Contributor

@behlendorf: IMHO, ZED is going to be its own can of sandworms, and pushing something which has had this much testing among the community into a shallow grave because it doesnt meet the aspirations of how everything in ZFS should work is a mistake. First off, persistent iSCSI settings in ZFS allow for fast failover to snapshot recipient hosts. Secondly, given how much work @FransUrbo has put into this, it would probably not help in the overall effort of attracting more developers to the project if viable code is canned like this.

Can we open this back up and at least leave it for people to use from github? Better yet, push out 0.6.4 and make this the first commit in 0.6.5's roadmap.

@prologic
Copy link

here here!

@behlendorf
Copy link
Contributor

Can we open this back up and at least leave it for people to use from github? Better yet, push out 0.6.4 and make this the first commit in 0.6.5's roadmap.

@sempervictus I'd like nothing better, it wasn't my intention to kill this off and I definitely should have handled this better. When I commented that I wasn't comfortable merging this before the 0.6.4 tag I didn't expect it to be closed. I just hoped to delay the merge until right after the tag. But since I did this exact same thing before the 0.6.3 tag and then didn't merge it I can understand why @FransUrbo is justifiably upset. I should have been clearer about my reservations.

I still feel this patch is too risky to merge before the 0.6.4 tag since it does make some non-trivial changes to common code in the utilities. However, I think we can definitely merge it right after the tag. That will give us a few months to shake it out in master and discover if I'm just being overly cautious (hopefully I am).

For those who need this patch it's still available in #3116. I opened this pull request a few days ago to run it through a fresh round of testing and so I could start carefully looking over the code. Again, if we could get another set of eyes on this I'd feel much better about it. I'm not an iSCSI expert, and once it's in the tree I feel obligated to support it. Hopefully with @FransUrbo's help!

As for doing this in the ZED I agree that is absolutely going to be a ton of work. We still need to build some needed infrastructure even to make it possible. And then to get it working and tested will take a considerable amount of effort. That's not something which is going to happen soon.

@maci0
Copy link
Contributor

maci0 commented Apr 25, 2015

+1

@GregorKopka
Copy link
Contributor

@behlendorf now that 0.6.4 is out: maybe reopen this one so it will not get lost?

@pdf
Copy link

pdf commented Apr 28, 2015

@kpande sharenfs/sharesmb/shareiscsi are standard features on other ZFS implementations. Also, you might consider toning down the hyperbole a little.

@pdf
Copy link

pdf commented Apr 28, 2015

@kpande fine, FreeBSD doesn't support it, but that's probably only because they didn't have a target until the 10.0 release, clearly it's not considered out of scope though. To answer some of your other questions, go look at the PR. Bringing systemd into the conversation is straight-up flame-bait. Should we also drop sharenfs and sharesmb because you don't want ZFS to 'control every aspect of file services'? ZFS has been accused of layering violations before, but IMO those 'violations' are some of the reasons it's nice to administer.

@pdf
Copy link

pdf commented Apr 28, 2015

@kpande you're entitled to your opinion, however there are real advantages to having shares defined on the filesystem, like being able to zfs send|zfs receive and have your shares configured on the receiver automatically.

@behlendorf
Copy link
Contributor

I had my choice, sharesmb would be removed too.

@kpande @pdf this is a bit of a digression but this isn't too far from where I've suggested things should go. The sharenfs and sharesmb properties won't be removed but they will be less tightly coupled to ZFS. Specifically, the existing C implementation would be removed and replaced by ZED scripts which are triggered by ZFS events are responsible for performing the sharing. The thought is that this would be far more portable, flexible, and maintainable. It's something @dun and I have talked about and are laying the groundwork for.

@pdf
Copy link

pdf commented Apr 28, 2015

@behlendorf this sounds like a good long-term plan. Do you have a link to the discussion/design notes?

@behlendorf
Copy link
Contributor

@pdf I'm sure I've had this discussion before in the tracker but at the moment I can't seem to find it. @dun and I have fleshed out a nice design for this but we haven't posted it anywhere, we should so it can be commented on. But the gist of it is we need to extend the existing event infrastructure to minimally allow:

  1. User space utilities can inject events such as mount/unmount, share/unshare, etc.
  2. Optionally block on those events and received a return status code.

@chjohnst
Copy link

+1 for an awesomeness
On Apr 28, 2015 12:59 PM, "Brian Behlendorf" notifications@github.com
wrote:

@pdf https://github.com/pdf I'm sure I've had this discussion before in
the tracker but at the moment I can't seem to find it. @dun
https://github.com/dun and I have fleshed out a nice design for this
but we haven't posted it anywhere, we should so it can be commented on. But
the gist of it is we need to extend the existing event infrastructure to
minimally allow:

  1. User space utilities can inject events such as mount/unmount,
    share/unshare, etc.
  2. Optionally block on those events and received a return status code.


Reply to this email directly or view it on GitHub
#1099 (comment).

FransUrbo added a commit to FransUrbo/Openstack-ZFS that referenced this pull request Jul 14, 2016
NOTE: 'Unfortunately' (mostly because I'm lazy :), it require my
      iSCSI patch to ZoL.
      openzfs/zfs#1099

      If anyone actually MUST have manual iSCSI add/remove, feel free
      to supply me with patches. It's not going to happen othervise..
@prometheanfire
Copy link
Contributor

@behlendorf is this shelved due to the branch being closed, the preference of using ZED or some other reason?

@FransUrbo
Copy link
Contributor Author

Anyone who's still interested in this, give a thumbs up on the top/initial comment so we can judge how many's interested.

@sempervictus
Copy link
Contributor

Seeing this via email, so can't thumbs up far as I know, but I am very
interested. BTW, LIO is the defacto Linux iscsi impl (god knows why when
scst has been around forever), so this work does make sense in master.
While most use cases we have now are automated procedures - create zvol,
configure lio, inform the broker of both, it would be quite useful to have
this for one-off systems, or for telling Cinder-volume to create+export in
one op.

On Jul 15, 2016 08:13, "Turbo Fredriksson" notifications@github.com wrote:

Anyone who's still interested in this, give a thumbs up on the top/initial
comment so we can judge how many's interested.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1099 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABRPjDmDcEgKRUA-9BOESWrdROWJalVkks5qV3logaJpZM4AQhfZ
.

@FransUrbo
Copy link
Contributor Author

@sempervictus This works with LIO as well. It haven't had as much testing as SCST (which I've used in production together with this patch for 3+ years).

If you're interested in Cinder, you might want to have a look at "my" Openstack-ZFS driver: https://github.com/FransUrbo/Openstack-ZFS

@sempervictus
Copy link
Contributor

We generally use scst too, but turns out it doesn't work in lxc whereas lio
does.
Will look over that code, any reason its not in openstack? You seem a much
better candidate for writing something like this than some infosec nerd.
On Jul 16, 2016 6:00 AM, "Turbo Fredriksson" notifications@github.com
wrote:

@sempervictus https://github.com/sempervictus This works with LIO as
well. It haven't had as much testing as SCST (which I've used in production
together with this patch for 3+ years).

If you're interested in Cinder, you might want to have a look at "my"
Openstack-ZFS driver: https://github.com/FransUrbo/Openstack-ZFS


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#1099 (comment), or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABRPjJxzT6C67cg-9nv7jpjuEidj_5Oeks5qWNXPgaJpZM4AQhfZ
.

@FransUrbo
Copy link
Contributor Author

On Jul 20, 2016, at 6:33 AM, RageLtMan wrote:

Will look over that code, any reason its not in openstack? You seem a much
better candidate for writing something like this than some infosec nerd.

Thanx :). But I'm taking to many short cuts (chief among them is to use "shareiscsi", which isn't officially available yet). I can't justify getting this in Cinder proper with that 'limitation'.

But I'm not discounting the possibility for the future. I just want much more eyes on it before I even consider it - "with enough eyeballs, all bugs are shallow" I think HE said.. :)

@bjquinn
Copy link

bjquinn commented Sep 16, 2016

On my phone, so not seeing the thumbs up either, but add me to the count. Would love to see this integrated.

@dhojnik
Copy link

dhojnik commented Mar 3, 2017

Hi there

I would like to try @FransUrbo his OpenStack-Cinder-ZFS-Mothership-Godlike-Driver :) ... using on Ubuntu 16.04 with Root ( / ) on ZFS. Do I have to apply this patch and recompile zfsonlinux on Ubuntu? Or it is now inside master?

root@sackgesicht:# apt-cache show zfsutils-linux
Package: zfsutils-linux
Priority: extra
Section: admin
Installed-Size: 779
Maintainer: Ubuntu Developers ubuntu-devel-discuss@lists.ubuntu.com
Original-Maintainer: Darik Horn dajhorn@vanadac.com
Architecture: amd64
Source: zfs-linux
Version: 0.6.5.6-0ubuntu15
Replaces: zfs
Provides: zfs
Depends: init-system-helpers (>= 1.18
), zfs-doc (= 0.6.5.6-0ubuntu15), libblkid1 (>= 2.16), libc6 (>= 2.14), libnvpair1linux, libuuid1 (>= 2.16), libuutil1linux, libzfs2linux, libzpool2linux, python3:any (>= 3.3.2-2~), python3
Recommends: zfs-dkms, zfs-zed
Suggests: samba-common-bin (>= 3.0.23), nfs-kernel-server, zfs-initramfs
Conflicts: zfs, zfs-fuse
Filename: pool/main/z/zfs-linux/zfsutils-linux_0.6.5.6-0ubuntu15_amd64.deb
Size: 275568
MD5sum: 0d10700f55ce11d21f068eb0e607d258
SHA1: e1b254eae05011cd05c9d6d145e45f175a2bf518
SHA256: 79b15f9f839691280626edd0419937885e9008f3b0aba06b80c91d1f3dc9b05f
Description-en: Native OpenZFS management utilities for Linux
This package provides the zpool and zfs commands that are used to
manage OpenZFS filesystems.
Description-md5: 7b0f98269f6c33505790717cd478736c
Homepage: https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.6.5.6
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Origin: Ubuntu
Phased-Update-Percentage: 0
Supported: 5y

Copy link
Contributor

@GregorKopka GregorKopka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also (as some commented above) want to have the logic in iscsi_[LIO|SCST|...].c move to an external (script) helper that gets called from ZFS with the full dataset path and the contents of its shareiscsi (or 'off' for the unshare case) property. Hard-baking the implementation into ZFS dosn't seem like a good idea.

I personally don't care if this would be called from ZFS directly or delegated through ZED (which might have the upside of blocking helpers that wait for a timeout wouldn't hang the system completely), please just in a way that /path/to/zfs_iscsi_helper is allowed to be (symlinked or not):

  • a wrapper that does auto-detection of the iSCSI subsystem and delegates to the actual iscsi_helper_[LIO|SCST|...] implementation
  • the actual implementation used on the system (no autodetection)
  • /bin/true to completely neuter shareiscsi on the system (without any need to adjust dataset properties, should be useful for servers without an iSCSI subsystem or possible consumers)
  • a user supplied wrapper/implementation to add more features or modify/restrict the share

Putting all the options as a string into the property might be the initial design for share[smb|nfs] and most likely is a case of we have always done it like this so it won't change but IMHO it is a bad design decision.

A helper would allow to replace set shareiscsi="<long list of all needed options>" with multiple shareiscsi:<option>="value" properties (that can be inherited from the parent dataset(s) to avoid having to retype them) and have my_iscsi_helper work from these (collect into a single string and feed the actual iscsi_helper_[LIO|SCST|...] implementation, whatever) and use the shareiscsi property just as a basic on/off toggle.

With the implementation in a replaceable script the user could decide how it should be handled on his system, the ones who like it as-is could simply stick with the default configuration. Since this would not impact the way of others, hopefully no one will be against allowing me to do something like this on my systems.

TL;DR: Sharing through 3rd party deamons shouldn't be baked in but managed with helper scripts.
This also applies to sharenfs and sharesmb (where it is worse as the current implementation also auto-shares child datasets).

@@ -0,0 +1,118 @@
#!/bin/bash

# !! This script is for ISCSI-SCST !!
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be 'ISCSI-LIO'.

@mailinglists35
Copy link

does this PR apply to master or 0.7.x?

pcd1193182 pushed a commit to pcd1193182/zfs that referenced this pull request Sep 26, 2023
…s#1099)

Bumps [openssl](https://github.com/sfackler/rust-openssl) from 0.10.55 to 0.10.56.
- [Release notes](https://github.com/sfackler/rust-openssl/releases)
- [Commits](sfackler/rust-openssl@openssl-v0.10.55...openssl-v0.10.56)

---
updated-dependencies:
- dependency-name: openssl
  dependency-type: indirect
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Share "zfs share" feature Type: Feature Feature request or new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.