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-next>] [day] [month] [year] [list]
Message-ID: <A6FDE6B975803043804A49F12F49028E0F59C8@hawk.exanet-il.co.il>
Date:	Thu, 10 May 2007 13:01:55 +0300
From:	"Menny Hamburger" <menny@...net.com>
To:	<linux-kernel@...r.kernel.org>
Subject: [PATCH] interface for doing a full host scsi rescan

Hi,

When we do want to rescan the SCSI host, a userland script needs to be
provided that does add/remove.
This patch adds an interface for doing this inside the kernel - seems
more appropriate:

--- linux-2.6.20/drivers/scsi/scsi_proc.c	2007-02-04
20:44:54.000000000 +0200
+++ linux-2.6.20_patched/drivers/scsi/scsi_proc.c	2007-05-10
12:52:13.353652000 +0300
@@ -227,6 +227,20 @@
 	return error;
 }
 
+static int scsi_scan_selected_host(uint host, uint rescan)
+{
+	struct Scsi_Host *shost;
+	int error = -ENXIO;
+
+	shost = scsi_host_lookup(host);
+	if (IS_ERR(shost))
+		return PTR_ERR(shost);
+
+	error = scsi_scan_host_selected(shost, SCAN_WILD_CARD,
SCAN_WILD_CARD, SCAN_WILD_CARD, rescan);
+	scsi_host_put(shost);
+	return error;
+}
+
 static ssize_t proc_scsi_write(struct file *file, const char __user
*buf,
 			       size_t length, loff_t *ppos)
 {
@@ -278,7 +292,24 @@
 		lun = simple_strtoul(p + 1, &p, 0);
 
 		err = scsi_remove_single_device(host, channel, id, lun);
-	}
+	/*
+	 * Usage: echo "scsi scan-devices 0 1" >/proc/scsi/scsi
+	 * where 0 is Host and 1 is whether to rescan (1) or do a full
scan (0).
+	 */
+	} else if(!strncmp("scsi scan-devices", buffer, 17)) {
+		p = buffer + 18;
+
+		host = simple_strtoul(p, &p, 0);
+		rescan = simple_strtoul(p + 1, &p, 0);
+
+		if (rescan)
+			printk(KERN_DEBUG "Rescanning SCSI host %d\n",
host);
+		else
+			printk(KERN_DEBUG "Scanning SCSI host %d\n",
host);
+
+		err = scsi_scan_selected_host(host, rescan);
+    }
+
 
 	/*
 	 * convert success returns so that we return the 


Menny
-
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