[stgt] Why LUN0?

Arne Redlich arne.redlich at googlemail.com
Mon Dec 10 19:23:31 CET 2012

2012/12/10 Braun, David <David.Braun at drs.com>:
> By "like today the dummy-LUN0 will automatically be replaced" you mean with your patch - right?
> My --force code was very simple - basically a 2 line change. The other changes are just prints. Here's what I did.


It's not as simple as that, as the dummy device mapped to LUN 0 is
also abused to handle SCSI requests sent to LUNs that are not backed
by a device:

int target_cmd_queue(int tid, struct scsi_cmd *cmd)
        /* ... snip ... */
	cmd->dev = device_lookup(target, dev_id);
	/* use LUN0 */
	if (!cmd->dev)
		cmd->dev = list_first_entry(&target->device_list,
					    struct scsi_lu,

        /* ... snip ... */

	 * Call struct scsi_lu->cmd_perform() that will either be setup for
	 * internal or passthrough CDB processing using 2 functions below.
	return cmd->dev->cmd_perform(tid, cmd);

This is addressed by the patch Boaz is carrying in his tree.

To unsubscribe from this list: send the line "unsubscribe stgt" in
the body of a message to majordomo at vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

More information about the stgt mailing list