Messages in this thread | | | From | Linus Torvalds <> | Date | Wed, 1 Feb 2012 15:15:14 -0800 | Subject | Re: [PATCH] sysfs: Optionally count subdirectories to support buggy applications |
| |
On Wed, Feb 1, 2012 at 2:21 PM, Eric W. Biederman <ebiederm@xmission.com> wrote: > > lm_sensors and possibly other applications get confused if all sysfs > directories return nlink == 1. The lm_sensors code that got confused > was just wrong and a fixed version of lm_sensors should be released > shortly.
I think this patch is horrible, and broken.
And making the feature a config option is just stupid.
The simple approach is to
- implement a inode->i_op->getattr function for sysfs
- make it call generic_fillattr()
- after filling in the generic fields, count the number of sysfs children it has and update stat->nlink appropriately.
No extra "keep track of inode counts by hand" crap, and no idiotic config options that just make it easy to (conditionally) get things wrong. Just do it right, and do it *unconditionally* right.
The Linux VFS layer is smart, and allows filesystems to do these kinds of fixups.
Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |