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

rescan-scsi-bus.sh: when there is a logical lun-0, testonline will spend 30s to retry-check it #24

Closed
LiuXing108 opened this issue Sep 21, 2022 · 6 comments

Comments

@LiuXing108
Copy link

In function testonline, this shell uses sg_turs to check sgdevice, but lun-0 is not always a real device, sometimes a logical one. it depends on Vendor's implementation. So could we ensure there is a real sd-device before we check it by sg_turs?

@doug-gilbert
Copy link
Owner

Would something like 'if sg_inq $DEVICE | grep -q -i "PQual=0" ' work in this situation?

@LiuXing108
Copy link
Author

it works:

testoneline() {
  ……
  sg_turs /dev/$SGDEV >/dev/null 2>&1
  RC=$?

  # Handle in progress of becoming ready and unit attention
  while [ $RC = 2 -o $RC = 6 ] && [ $ctr -le 30 ] ; do
    if [ $RC = 2 ] && [ "$RMB" != "1" ] && [ sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ]; then
      echo -n "."
      let LN+=1
      sleep 1
    else
      sleep 0.02
    fi
    let ctr+=1
    sg_turs /dev/$SGDEV >/dev/null 2>&1
    RC=$?
……
}

doug-gilbert added a commit that referenced this issue Sep 26, 2022
speed testonline() function when
peripheral_qualifier != 0 in the standard INQUIRY
response. See:
#24


git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@972 6180dd3e-e324-4e3e-922d-17de1ae2f315
@doug-gilbert
Copy link
Owner

sg3_utils revision 972 (subversion, as show in ChangeLog file) uploaded with the above change in it. Could you test it?

@LiuXing108
Copy link
Author

I'm so sorry and embarrassed for #24 (comment). it has a code error - we should not add "[ ]".

@LiuXing108
Copy link
Author

I'm so sorry and embarrassed for #24 (comment). it has a code error - we should not add "[ ]", I wrote it wrong.
it should be like this:
if [ $RC = 2 ] && [ "$RMB" != "1" ] && sg_inq /dev/$SGDEV | grep -q -i "PQual=0" ; then

and I tested this shell with "scsi-rescan -a -r ",there are two iscsi links on my server, as we expected, one link reduced 30 seconds。
after modificated:
real 0m12.165s
user 0m2.853s
sys 0m2.450s
before modificated:
real 1m12.874s
user 0m2.732s
sys 0m2.353s

doug-gilbert added a commit that referenced this issue Sep 30, 2022
Speed multipath scans with many LUNs by caching multipath 
LUN info in temporary file, see:
   #22
Fix small bug in last commit, see:
   #24



git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@973 6180dd3e-e324-4e3e-922d-17de1ae2f315
@doug-gilbert
Copy link
Owner

Subversion revision 973, now mirrored here, has the above fix. Perhaps you might recheck it has been done properly. Also that revision contains the patch discussed in the issue #22 .

mwilck pushed a commit to openSUSE/sg3_utils-until-2023 that referenced this issue Jan 27, 2023
speed testonline() function when
peripheral_qualifier != 0 in the standard INQUIRY
response. See:
doug-gilbert/sg3_utils#24

Cherry-pick of 4215af6 ("rescan-scsi-bus.sh speed testonline()")
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@972 6180dd3e-e324-4e3e-922d-17de1ae2f315
mwilck pushed a commit to openSUSE/sg3_utils-until-2023 that referenced this issue Jan 27, 2023
Speed multipath scans with many LUNs by caching multipath
LUN info in temporary file, see:
   doug-gilbert/sg3_utils#22
Fix small bug in last commit, see:
   doug-gilbert/sg3_utils#24

git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@973 6180dd3e-e324-4e3e-922d-17de1ae2f315
hreinecke pushed a commit to hreinecke/sg3_utils that referenced this issue Aug 17, 2023
speed testonline() function when
peripheral_qualifier != 0 in the standard INQUIRY
response. See:
doug-gilbert/sg3_utils#24


git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@972 6180dd3e-e324-4e3e-922d-17de1ae2f315
hreinecke pushed a commit to hreinecke/sg3_utils that referenced this issue Aug 17, 2023
Speed multipath scans with many LUNs by caching multipath 
LUN info in temporary file, see:
   doug-gilbert/sg3_utils#22
Fix small bug in last commit, see:
   doug-gilbert/sg3_utils#24



git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@973 6180dd3e-e324-4e3e-922d-17de1ae2f315
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants