Comment 5 for bug 605721

Revision history for this message
Chris Cheney (ccheney) wrote :

Hmm looking at the code I think its buggy. I'm not sure what it is actually trying to do but it doesn't seem to be doing it right in any case. It appears to be 8 bit shifting left, and then checking for 0. If the device is in use lsof returns 0 if it is not then it returns 1, at least as best as I can tell, in which case doing the bit shift causes the problem. I am not sure why it was added, but it probably was needed for something.

        # Check if userspace uses this device
        my $lsof_check = check_exe("lsof");
        if ($lsof_check ne 1) {
                system("lsof $backing_store &>/dev/null");
                my $exit_value = $? >> 8;
                if ($exit_value eq 0) {
                        execute("# Device $backing_store is used (already tgtd target?).");
                        execute("# Run 'lsof $backing_store' to see the details.");
                        return 0;
                }
        }
        return 1;
}