On Wednesday, December 7, 2022 at 1:01:23 AM UTC+8 Wenchao Hao wrote:

> On Tue, Dec 6, 2022 at 1:13 AM Lee Duncan <[email protected]> wrote: 
> > 
> > On 12/4/22 05:02, Wenchao Hao wrote: 
> > > On Thu, Dec 1, 2022 at 3:53 AM Lee Duncan <[email protected]> wrote: 
> > >> 
> > ... 
> > >> 
> > >> Let me start by saying I agree with you now, that there *is* an 
> issue. 
> > >> But your test was flawed. 
> > >> 
> > >> After you log into a target, changing the Node database does nothing. 
> > >> The node database is only referenced with you login using it, e.g. 
> > >> "iscsiadm -m node ... -l". 
> > >> 
> > >> But even if you logged out and then back into the target, thereby 
> using 
> > >> the updated Node DB entries, it would not have worked. 
> > >> 
> > >> For one thing, "iscsiadm -m session -u" just logs out of all 
> sessions, 
> > >> as far as I can see, based on testing and code inspection. So that is 
> a 
> > >> problem. 
> > >> 
> > >> Note that the iscsi.service systemd service file on SLES does "not" 
> do 
> > >> that. It instead logs of of "manual" and "automatic" session, but 
> only 
> > >> ones that are listed in the Node database. 
> > >> 
> > >> And as you pointed out, any knowledge iscsid has of existing sessions 
> is 
> > >> lost if the daemmon dies or is stopped, then restarted. At that 
> point, 
> > >> the only knowledge is has about each session is what it finds in 
> sysfs. 
> > >> 
> > >> I have done some testing with your new kernel change that adds a 
> > >> "node_startup" sysfs string attribute to session data. I modified 
> > >> open-iscsi to pass in the node startup value, and that's a good 
> start. 
> > >> The next step is adding a "startup" value in the session structure, 
> > >> filling it in from sysfs (or current state), and refusing to logout 
> out 
> > >> of sesions that have this set to "onboot", which all sounds fairly 
> > >> simple. I also want to test with "iscsiadm -m fw -l", which is what I 
> > >> believe is used when booting from software iscsi (i.e. iBFT). 
> > >> 
> > >> Have you already worked on the open-iscsi side of this? No reason for 
> > >> duplicate development. 
> > >> 
> > >> -- 
> > >> Lee Duncan 
> > >> 
> > > 
> > > Sorry I missed this message, I have modified open-iscsi to work 
> > > with this sysfs interface. But I think we do not need this any more 
> > > because the safe logout can avoid disks being removed. 
> > > 
> > > Checking holders and if disk is mounted before logout seems enough, 
> > > so ignore this discussion. 
> > > 
> > > Thank you very much for your reply. 
> > 
> > I have some philosophical issues with using safe_logout. 
> > 
> > It is off by default, which implies to me that it has overhead. If I'm 
> > doing a lot of iscsi session start/stops, I don't want the overhead. 
> > Otherwise, why not just use it all the time. 
> > 
> > Also, it only checks for mounts. What about if some process has the 
> > device open but isn't using it for a filesystem? 
> > 
> > And since it has overhead, I'd rather just use it on root iscsi volumes. 
> > I have not had a single problem report from folks that have ended a 
> > session by accident that is mounted on. Since ending your root volume 
> > iscsi session is fatal, I _would_ like to proactively avoid that 
> > possibility. So I want to only set this attribute on iscsi root volumes, 
> > which means it'd have to be a per-node (or per-session) attribute, not a 
> > global one. 
> > 
> > Lastly, I can imagine a time when I want to override safe_logout, say if 
> > some process is stuck. So it'd be nice to have a "--force" option to end 
> > a session even if safe_logout is set. 
> > 
> > But as I said, these objections are philosophical/theoretical. 
> > 
> > And for the record, I like the idea of tracking the "start mode" of 
> > sessions. Right now, if I list the iscsi sessions, I can't tell which 
> > ones where started from firmware, which were started in the initrd, and 
> > which were just manually started. So tracking (and being able to 
> > display) the startup mode would only be a good thing IMHO. 
> > -- 
> > Lee D 
> > 
> >


My previous reply was in a mess format, here is the formatted one: 

The original purpose of my patch is to record session's startup_mode
in the kernel, so iscsiadm/iscsid can refer to it before logout session,
this can fix both the two issues.

While the safe_logout mode can solve the first issue in another way by
checking if iscsi disk is in used. But we did not enable safe_logout as
default and it can not cover the sense when iscsi disks in not mounted
nor used by multipath or lvm.

The safe_logout mode can not address the issue which iscsiadm/iscsid
can overwrite session's startup_mode.

Firstly, we need to come to one same conclusion that if it is a bug to
be fixed, then discuss how to fix it.

If we treat this issue as a bug, we have two ways to fix it:

1. Recording session's startup_mode in kernel is a way to fix it
2. Checking if session has been created for this node before updating
the node's configure file is another way. But we must be strict our
users would not edit the configure files by hand.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/open-iscsi/d0588551-af9f-4795-b697-33917f80d12cn%40googlegroups.com.

Reply via email to