Tony Battersby wrote: > Stefan Richter wrote: >> I wrote that there is a bug if you have a reference while the reference >> count is zero. >> > Being pragmatic, I call that a _philosophical_ objection rather than a > bug because the code does actually work in practice as far as I can > tell. But you can call it a bug if you like. If you want me to give in > and call it a bug, then you will have to come up with an actual case > where the code fails to do the right thing - memory use after free, > double free, memory leak, oops, etc. I understood that you want to fix bugs which are caused by lack of reference counting. You fix it by /reference count estimation/. (Yet you could also fix it by /reference counting/.) Actual reference counting would have the benefit that it works not only right after your fix, but it will continue to work when people proceed to modify sg, provided they follow the sound, proven, straight-forward, familiar rules of reference counting: - r++ when a copy of a reference is made. - r-- when a reference is given up. Sure, it will also continue to work if those who modify sg follow the ad-hoc rules of your special reference count estimation, which are: - ... - ... - ... I recommend to stick to the semantics of "refcount == 0 means there is no reference anymore" because it's simple and robust. This is pragmatism. I recommend it over "refcount == 0 means that there are, hmm, still some references somewhere, but believe me, you can ignore those" because that's not very pragmatic in code which is supposed to be maintainable and to not crash people's machines. In the subsystems which I maintain, I made the experience that reference counting is easier to get right and keep right than some locking tricks around reference stores or whatever other lifetime assumptions. Anyway. Fix sg in whatever way you prefer; you are doing the work, your opinion counts. Mine doesn't, as I don't contribute the code. (I spoke up nevertheless because the idea came up in this thread to change lib/kref in a way which is only useful to buggy refcounting. This worried me..) -- 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