On 04/25/2014 11:54 PM, Cheng Cheng wrote:
> Hi Mike,
>
> Thanks for replying.
>
>> You should not have to logout the session. For Red Hat and I think
>> SLES, when the system is shutting down the root FS gets mounted as
>> read-only. iSCSI is left running. Eventually /sbin/shutdown is run and
>> from there the kernel is shutdown and if needed the scsi layer might
>> have the iscsi layer send some commands like a sync cache. So for this
>> you just need to leave the network up.
>
> I did some research today around this. For Debian, yes, the root FS will
> be remounted as read-only before shutting down/rebooting. However, the
> system will then stuck at sync cache, even I have left network running.
> I have not looked into the Linux kernel to check whether iscsi layer
> will send logout command to the target, but I highly suspect it won’t.
It will not logout of the target at this time. It cannot because
userspace is shutdown and iscsid is what sends the logout request.
A logout is *not* needed though. It is not what is causing your problem.
For RHEL/OEL and SUSE we do not send a logout and it works fine.
>
> Here is what I am going to propose:
>
> 1. I am now trying to extend iscsistart to be capable send logout
> command.
> 2. In runlevel 0 and runlevel 6, after remounting the root FS as
> read-only, use pivot_root and chroot to change the root to a ramfs,
> similar to initramfs, which is loaded with iscsistart. Then we can
> logout gracefully by invoking iscsistart.
>
> Please let me know what do you think of this.
>
It is nice to logout but it is not going to fix your problem.
If you are getting stuck at the sync cache stage then your network
probably went down. /sbin/shutdown probably shutdown the network on you.