[5128] in linux-scsi channel archive

home help back first fref pref prev next nref lref last post

SCSI and proc filesystem [PATCH]

daemon@ATHENA.MIT.EDU (Andrzej Krzysztofowicz)
Fri Nov 13 12:06:28 1998

From: Andrzej Krzysztofowicz <ankry@green.mif.pg.gda.pl>
To: linux-scsi@vger.rutgers.edu, torvalds@transmeta.com
Date: 	Fri, 13 Nov 1998 17:19:58 +0100 (CET)

Hi,
   Some time ago somebody noticed a problem if /proc/scsi/<driver> directory
is busy while unloading the host module (an Oops during eg. ls).
   The following patch fixes this problem by increasing module usage count 
in such situation. 
[ the first section is out-of-topic and blacklists my cdrom only ]
Delayed inode releasing is not possible with current scsi code, when inode
data is stored directly in a host driver.

Regards
    Andrzej

*********************************************************************************
diff -u --recursive --new-file linux/drivers/scsi/scsi.c.old linux/drivers/scsi/scsi.c
--- linux/drivers/scsi/scsi.c.old	Wed Nov 11 12:09:37 1998
+++ linux/drivers/scsi/scsi.c	Wed Oct 14 20:43:13 1998
@@ -226,6 +226,7 @@
 {"MEDIAVIS","RENO CD-ROMX2A","2.03",BLIST_NOLUN},/*Responds to all lun */
 {"MICROP", "4110", "*", BLIST_NOTQ},		/* Buggy Tagged Queuing */
 {"NEC","CD-ROM DRIVE:841","1.0", BLIST_NOLUN},  /* Locks-up when LUN>0 polled. */
+{"PHILIPS", "PCA80SC", "V4-2", BLIST_NOLUN},    /* Responds to all lun */
 {"RODIME","RO3000S","2.33", BLIST_NOLUN},       /* Locks up if polled for lun != 0 */
 {"SANYO", "CRD-250S", "1.20", BLIST_NOLUN},     /* causes failed REQUEST SENSE on lun 1
 						 * for aha152x controller, which causes
diff -u --recursive --new-file linux/drivers/scsi/scsi_proc.c.old linux/drivers/scsi/scsi_proc.c
--- linux/drivers/scsi/scsi_proc.c.old	Wed Nov 11 11:47:56 1998
+++ linux/drivers/scsi/scsi_proc.c	Sat Jun 13 21:10:31 1998
@@ -110,14 +110,29 @@
     return(-EBADF);
 }
 
+static void scsi_proc_fill_inode(struct inode *inode, int fill)
+{
+Scsi_Host_Template *shpnt;
+
+shpnt = scsi_hosts;
+while (shpnt && shpnt->proc_dir->low_ino != inode->i_ino)
+    shpnt = shpnt->next;
+if (!shpnt || !shpnt->module)
+    return;
+if (fill)
+    __MOD_INC_USE_COUNT(shpnt->module);
+else
+    __MOD_DEC_USE_COUNT(shpnt->module);
+}
+
 void build_proc_dir_entries(Scsi_Host_Template *tpnt)
 {
     struct Scsi_Host *hpnt;
-
     struct scsi_dir *scsi_hba_dir;
 
     proc_scsi_register(0, tpnt->proc_dir);
+    tpnt->proc_dir->fill_inode = &scsi_proc_fill_inode;
+
-    
     hpnt = scsi_hostlist;
     while (hpnt) {
         if (tpnt == hpnt->hostt) {
diff -u --recursive --new-file linux/include/linux/proc_fs.h.old linux/include/linux/proc_fs.h
--- linux/include/linux/proc_fs.h.old	Wed Nov 11 12:07:32 1998
+++ linux/include/linux/proc_fs.h	Fri Oct 23 19:15:36 1998
@@ -332,7 +332,7 @@
 {
     extern void scsi_init_free(char *ptr, unsigned int size);
 
+    if(x < PROC_SCSI_FILE)
-    if(x <= PROC_SCSI_FILE)
 	return(proc_unregister(proc_scsi, x));
     else {
 	struct proc_dir_entry **p = &driver->subdir, *dp;

*********************************************************************************
-- 
=======================================================================
  Andrzej M. Krzysztofowicz               ankry@mif.pg.gda.pl
  tel.  (0-58) 347 14 61
Wydz.Fizyki Technicznej i Matematyki Stosowanej Politechniki Gdanskiej

-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.rutgers.edu

home help back first fref pref prev next nref lref last post