Re: [PATCH 0/2] sg: fix races during device removal (v2)

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

 



I wrote:
> If you only count pending transactions, you know when to deregister the
> device from the idr.  But you don't know when it's OK to free the
> device's memory.
> 
> If you cont only references to the memory, you know when it is OK to
> free it but you don't know when to deregister from the idr.

PS:
However, if you never copy the idr's reference, then you don't need that
other ref-counter.  To avoid such copies, every site which looks up the
device in the idr would have to perform all its accesses to the device
while inside an sg_index_lock protected section.

Then only the transactions have copies of the pointer to the device
representation in memory.  This of course means that the transaction
counter is equal to the reference counter (plus the one reference of the
idr which you don't need to count because you remove that reference when
there is also no transaction anymore).
-- 
Stefan Richter
-=====-==--= ---= -====
http://arcgraph.de/sr/
--
To unsubscribe from this list: 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