Re: [PATCH 0/15] sysfs lazification final

From: Eric W. Biederman
Date: Mon Nov 30 2009 - 19:12:58 EST


Greg KH <greg@xxxxxxxxx> writes:

> On Mon, Nov 30, 2009 at 01:33:37PM -0800, Greg KH wrote:
>> On Sat, Nov 07, 2009 at 11:25:03PM -0800, Eric W. Biederman wrote:
>> >
>> > The sysfs code updates the vfs caches immediately when the sysfs data
>> > structures change causing a lot of unnecessary complications. The
>> > following patchset untangles that beast. Allowing for simpler
>> > more straight forward code, the removal of a hack from the vfs
>> > to support sysfs, and human comprehensible locking on sysfs.
>> >
>> > Most of these patches have already been reviewed and acked from the
>> > last time I had time to work on sysfs.
>> >
>> > This acks have been folded in and the two small bugs found in the
>> > previous review have been fixed in the trailing patches (they are
>> > minor enough nits that even a bisect that happens to land in the
>> > middle should not see sysfs problems).
>>
>> I've applied all of these to my tree now, and sorry, but something is
>> broken pretty badly.
>>
>> When doing a simple 'ls /sys/class/input/' the process locks up. This
>> means that X can't find any input devices, which makes for a bit of a
>> problem when wanting to use your mouse or keyboard :(
>>
>> Attached is the state of my processes when this happens, if that helps
>> out any.
>>
>> So I'm going to drop all of these from my tree again, as they are not
>> ready for merging at this point :(
>
> In looking at the stuck processes, it seems your last patch was the
> problem. Removing that caused things to work again, so I've only
> dropped that one.
>
> Next time, please test your patches before submitting them :(

Weird I thought I had tested this.

That last patch to add locking that is only needed for vfs coherency
has certainly seen less testing than the others.

I also remember verify that nfs does the same thing, when in fact
nfs takes inode->i_lock not inode->i_mutex in the same situation.

generic_permission takes no locks so this is really about serializing
writes to the inode. The vfs only takes inode->i_mutex, when calling
notify_change.

So it appears I have stepped into a murky corner of the vfs.

I will take a look and do a bit more testing. At the moment it looks
like a solution to serializing writes to the stat attributes on the inode is
going to be simply holding sysfs_mutex over inode_setattr in
sysfs_setattr. Assuming a solution is needed at all.

Eric
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/