small SCSI use count fix

small SCSI use count fix

Post by Tim Hocki » Wed, 15 Aug 2001 13:50:04

Attached is a small fix to increment the use count in scsi_register_host()
before we start working with it - prevent false decrementing.  (from one of
the crew here ;)

Please let me know if there is any reason this shouldn't go mainline in the
next 2.4.x.

Tim Hockin
Systems Software Engineer
Sun Microsystems, Cobalt Server Appliances

[ scsi_use_count.diff < 1K ]
diff -ruN dist+patches-2.4.8/drivers/scsi/scsi.c cobalt-2.4.8/drivers/scsi/scsi.c
--- dist+patches-2.4.8/drivers/scsi/scsi.c      Thu Jul 19 21:07:04 2001

        pcount = next_scsi_host;

        /* The detect routine must carefully spinunlock/spinlock if
           it enables interrupts, since all interrupt handlers do

               (scsi_init_memory_start - scsi_memory_lower_value) / 1024,
               (scsi_memory_upper_value - scsi_init_memory_start) / 1024);

        if (out_of_space) {
                scsi_unregister_host(tpnt);     /* easiest way to clean up?? */


1. small bug plus fix for /proc/net/snmp (Imcp: field count)


i received a bug report plus fix from Gonzalo A. Arana Tagle

``Icmp:'' values in /proc/net/snmp:

       # awk '/Icmp/ { print NF; }' /proc/net/snmp

the code in snmp_get_info() from net/ipv4/proc.c prints a dummy value
present at the end of struct icmp_mib, which should not be included.

from include/net/snmp.h:

instead of printing all values before the __pad field, printing the
values before the dummy field gives the right number of values:

--- linux-2.4.19/net/ipv4/proc.c-dist   Wed May 16 19:21:45 2001

        len += sprintf (buffer + len,
                "\nIcmp: InMsgs InErrors InDestUnreachs InTimeExcds InParmProbs InSrcQuenchs InRedirects InEchos InEchoReps InTimestamps InTimestampReps InAddrMasks InAddrMaskReps OutMsgs OutErrors OutDestUnreachs OutTimeExcds OutParmProbs OutSrcQuenchs OutRedirects OutEchos OutEchoReps OutTimestamps OutTimestampReps OutAddrMasks OutAddrMaskReps\n"
-       for (i=0; i<offsetof(struct icmp_mib, __pad)/sizeof(unsigned long); i++)
+       for (i=0; i<offsetof(struct icmp_mib, dummy)/sizeof(unsigned long); i++)
                len += sprintf(buffer+len, " %lu", fold_field((unsigned long*)icmp_statistics, sizeof(struct icmp_mib), i));

        len += sprintf (buffer + len,

please fix this.  thank's in advance,
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in

More majordomo info at
Please read the FAQ at

2. Installation Problem with RedHat 5

3. Fix oprofile on UP, small additional fix

4. How to install DOS for PCSIM 1.2

5. PATCH: 2.5.40 Fix stupid scsi setup bug in 53c406, fix addressing

6. Problem with insmod and rmmod

7. Patch: Fix serial module use count (2.4.16 _and_ 2.5)

8. symbolic link not a real link

9. Fix: Init page count for all pages during higher order allocs

10. Fix module ref counting in block/loop.c

11. HELP PLEASE: can't fix FS (inode count too big)

12. Script that counts counts the characters per line.

13. count = 0, while [ jobnotdone ] do stuff; count++