lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 27 Oct 2010 16:26:09 +0200
From:	Bart Van Assche <bvanassche@....org>
To:	"Nicholas A. Bellinger" <nab@...ux-iscsi.org>
Cc:	linux-scsi <linux-scsi@...r.kernel.org>,
	linux-kernel <linux-kernel@...r.kernel.org>,
	Vasu Dev <vasu.dev@...ux.intel.com>
Subject: Re: [PATCH] scsi: Add SHT->unlocked_qcmd for host_lock less
 SHT->queuecommand() dispatch

On Wed, Oct 27, 2010 at 2:32 AM, Nicholas A. Bellinger
<nab@...ux-iscsi.org> wrote:
>
> [ ... ]
>
> Finally, this patch also converts the remaining struct Scsi_Host->cmd_serial_number
> to atomic_t following a recommedation by Joe Eykholt to start struct Scsi_Host->
> cmd_serial_number at 1, and increment each serial_number by 2 so that the
> serial is odd, and wraps to 1 instead of 0.  struct Scsi_Host->cmd_serial_number
> is initialized to '1' in drivers/scsi/hosts.c:scsi_host_alloc().
>
> [ ... ]
> diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c
> index 4f7a582..0c87c4f 100644
> --- a/drivers/scsi/hosts.c
> +++ b/drivers/scsi/hosts.c
> @@ -381,6 +381,11 @@ struct Scsi_Host *scsi_host_alloc(struct scsi_host_template *sht, int privsize)
>        shost->unchecked_isa_dma = sht->unchecked_isa_dma;
>        shost->use_clustering = sht->use_clustering;
>        shost->ordered_tag = sht->ordered_tag;
> +       shost->unlocked_qcmd = sht->unlocked_qcmd;
> +       /*
> +        * Set the default shost->cmd_serial_number to 1.
> +        */
> +       atomic_set(&shost->cmd_serial_number, 1);
>
>        if (sht->supported_mode == MODE_UNKNOWN)
>                /* means we didn't set it ... default to INITIATOR */
> [ ... ]
> diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
> index 348fba0..7c93384 100644
> --- a/drivers/scsi/scsi.c
> +++ b/drivers/scsi/scsi.c
> @@ -628,17 +628,69 @@ void scsi_log_completion(struct scsi_cmnd *cmd, int disposition)
>
>  /**
>  * scsi_cmd_get_serial - Assign a serial number to a command
> - * @host: the scsi host
>  * @cmd: command to assign serial number to
>  *
>  * Description: a serial number identifies a request for error recovery
> - * and debugging purposes.  Protected by the Host_Lock of host.
> + * and debugging purposes.  Called directly by SCSI LLDs that have a
> + * legacy requirement for struct scsi_cmnd->serial_number.
>  */
> -static inline void scsi_cmd_get_serial(struct Scsi_Host *host, struct scsi_cmnd *cmd)
> +void scsi_cmd_get_serial(struct scsi_cmnd *cmd)
>  {
> -       cmd->serial_number = host->cmd_serial_number++;
> -       if (cmd->serial_number == 0)
> -               cmd->serial_number = host->cmd_serial_number++;
> +       struct Scsi_Host *host = cmd->device->host;
> +       /*
> +        * Increment the host->cmd_serial_number by 2 so cmd->serial_number
> +        * is always odd and wraps to 1 instead of 0.
> +        */
> +       cmd->serial_number = atomic_add_return(2, &host->cmd_serial_number);
> +}
> +EXPORT_SYMBOL(scsi_cmd_get_serial);
> +
> [ ... ]

There is a mismatch between the patch description and the patch
itself. The patch description says that the serial number starts at
one while the patch itself makes the serial number start at three.

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ