While this is certainly a theoretical limitation of the one-item-per-file approach, I'm not convinced that it is a practical limitation. That is, I'm not aware of any actual situations where the inability to read two attribute files at the same moment causes a real problem.
I don't think the 'inflight' numbers really need to be read concurrently, though I guess the total number in flight might be interesting...
Do you (or anyone) know of a clear example where lack of atomic consistency is a real issue?
Posted Mar 22, 2010 22:01 UTC (Mon) by adamgundy (subscriber, #5418)
[Link]
I suspect all the cases of 'required consistency' have been shoved elsewhere (ie /proc or /debug) because of the 'one value per file' requirement of sysfs.
for example, /proc/interrupts, /proc/slabinfo etc etc.
without a sensible way of handling consistency, there will always be a demand for putting stuff in /proc or inventing new syscalls/ioctls etc to get the information...
inter-value consistency
Posted Mar 22, 2010 22:39 UTC (Mon) by neilbrown (subscriber, #359)
[Link]
You may well be right. That is unfortunate as it is hard to solve problems when they are invisible.
As for your examples, I think both of those files (interrupts and slabinfo) pre-date /sys so they cannot have been put in /proc to avoid /sys rules.
Also I cannot see any atomic-consistency issues that might arise when accessing any of this information. In fact the contents of /proc/slabinfo appear to also exist in /sys/kernel/slab/*/* which does seem to suggest independent access to the values is OK.
If there are genuine cases where consistency is needed it would be really helpful to have them documented so we can work towards making sysfs receptive to such need.