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:	Tue, 30 Oct 2007 17:36:45 +0000
From:	Christoph Hellwig <hch@...radead.org>
To:	bo yang <bo.yang@....com>
Cc:	linux-scsi@...r.kernel.org, James.Bottomley@...elEye.com,
	akpm@...l.org, linux-kernel@...r.kernel.org, Sumant.patro@....com
Subject: Re: PATCH [2/8] scsi: megaraid_sas - add module param fast_load

On Mon, Oct 01, 2007 at 11:46:51AM -0400, bo yang wrote:
> +/*
> + * Fast driver load option, skip scanning for physical devices during
> + * load.  This would result in physical devices being skipped during
> + * driver load time. These can be later added though,
> + * using /proc/scsi/scsi
> + */

/proc/scsi/scsi is deprecated, so please don't recommend it here.
The proper way is the scan attribute of the scsi host.

> +static unsigned int fast_load;
> +module_param_named(fast_load, fast_load, int, 0);
> +MODULE_PARM_DESC(fast_load,
> +	"megasas: Faster loading of the driver, skips physical devices! "\
> +	"(default = 0)");

This should show up in sysfs.

> +static struct megasas_instance *megasas_lookup_instance(u16 host_no)
> +{
> +	int i;
> +
> +	for (i = 0; i < megasas_mgmt_info.max_index; i++) {
> +		if ((megasas_mgmt_info.instance[i]) &&
> +			(megasas_mgmt_info.instance[i]->host->host_no
> +			== host_no))

no need for the braces here.  This should be:

		if (megasas_mgmt_info.instance[i] &&
		    megasas_mgmt_info.instance[i]->host->host_no == host_no)

> +static int megasas_slave_alloc(struct scsi_device *sdev)
> +{
> +	struct megasas_instance *instance;
> +	int tmp_fastload = fast_load;
> +
> +	instance = megasas_lookup_instance(sdev->host->host_no);
> +
> +	if (tmp_fastload && sdev->channel < MEGASAS_MAX_PD_CHANNELS) {
> +		if ((sdev->id == MEGASAS_MAX_DEV_PER_CHANNEL -1) &&
> +			(sdev->channel == MEGASAS_MAX_PD_CHANNELS - 1)) {
> +
> +		/*
> +		 * If fast load option was set and scan for last device is
> +		 * over, reset the fast_load flag so that during a possible
> +		 * next scan, devices can be made available
> +		 */
> +			fast_load = 0;
> +		}
> +		return -ENXIO;
> +	}
> +
> +	return 0;
> +}

This is a rather complicated and fragile way to implement this feature.

I'd recomment to change the call to scsi_scan_host in megasas_io_attach
to something like:

	if (fast_load) {
		int channel;

		for (channel = 0; channel < MEGASAS_MAX_PD_CHANNELS;
		     channel++) {
			scsi_scan_host_selected(host, channel, SCAN_WILD_CARD,
						SCAN_WILD_CARD, 0);
		}
	} else {
		scsi_scan_host(host);
	}

-
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