Re: [PATCH] autofs4 - use simple_empty() for empty directory check
From: Ian Kent <hidden>
Date: 2012-11-17 02:29:01
Also in:
linux-fsdevel, lkml
On Fri, 2012-11-16 at 17:34 +0000, Al Viro wrote:
On Fri, Nov 16, 2012 at 08:43:28AM -0800, Linus Torvalds wrote:quoted
On Fri, Nov 16, 2012 at 8:36 AM, Ian Kent [off-list ref] wrote:quoted
Sure, are you recommending I alter the fs/libfs.c functions to add a function that doesn't have the outer lock, and have simple_empty() call that, then use it in autofs?Yup. That's the standard pattern, although usually we *strive* to make the unlocked versions be static to the internal code, and then use them there for the various helpers. In your case that seems impossible, since you do depend on holding the d_lock in the caller after the tests. But at least we don't have to duplicate the code and have it in two unrelated places. Al? Comments?The thing is, I'm not convinced we really need ->d_lock held downstream. E.g. __autofs4_add_expiring() ought to be OK with just sbi->lookup_lock. Not sure about the situation in autofs4_d_automount() - the thing is messy as hell ;-/ Ian, do we really need that __simple_empty() variant in either caller? What is getting protected by ->d_lock after it and do we really need ->d_lock continuously held for that?
Yeah, I've thought about that a few times now but haven't gone so far as to change it. I'll have another look. Ian