Re: [RFC] SCSI EH document

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Tejun Heo wrote:

 Hi, Jeff.

Jeff Garzik wrote:

Tejun Heo wrote:

Both all the list-heads need to be cleared, otherwise there may be list corruption next time the element is added to the list_head.


scmd->eh_entry is never used as list head. It's always used as list entry. So, technically, it needs not be cleared, I think. No? The problem we had was w/ shost->eh_cmd_q not being cleared.



Every node is a list_head. You want all pointers for all nodes pointing to something useful, even if they are not actively present on a list, so that they may be easily and corrected added to a list at a later time. Read list_del_init() for example.

    Jeff


 Okay... to make things clearer.  A struct list_head can have two roles.

 list head  : other list_head gets added to it
 list entry : gets added to other list_head

When a struct list_head acts as list head, it always needs to be in clean (pointing to valid things) state before being used. When a struct list_head acts as list entry, its current content doesn't matter.

AFAICS, scmd->eh_entry is currently not used as list head in any place, neither do we use list_empty() test on it to determine whether or not it's on a list. The original code does clear scmd->eh_entry all the time and I am very okay with that. I just wanted to make sure that I didn't miss something regarding scmd->eh_entry's usage.

 If I'm missing such a usage, can you please point out?


I'm mainly talking at a higher level. While it strictly doesn't matter in this instance, in general its a bad idea to clear a list using a

	list = (null)

operation.  Its a good way to leak references, leak memory, etc.

In this specific case it seems to be OK.

	Jeff


-
: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux