Re: [RFC] readdir mess

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Linus Torvalds <torvalds@...>
Cc: OGAWA Hirofumi <hirofumi@...>, <linux-fsdevel@...>, <linux-kernel@...>
Date: Tuesday, August 12, 2008 - 9:19 pm

On Tue, Aug 12, 2008 at 05:28:28PM -0700, Linus Torvalds wrote:

*cringe*

I agree, but... there's another shitpile in the same area and there we are
_really_ buggered - take a look at what ncpfs/smbfs/cifs/<parts of> procfs
are pulling off with very odd attempts to dump stuff into dcache.

That means manual equivalent of lookup and you _do_ want some exclusion for
that.  If nothing else, you want to prevent multiple dentries for the same
subdirectory...

And rwsem for reading wouldn't help at all - readdir/readdir contention
might be annoying, but it's readdir/lookup that really hurts.


I know.  And things like exportfs use of vfs_readdir() are also rather
painful.
 

I remember ;-)  However, f_version/i_version mess at that place simply an
ancient crap - we *are* holding i_mutex and we are using generic_file_lseek().
IOW, it simply hadn't been reviewed since then - or reviewers had been
stunned into glazed-eyes mode by the entire thing.
 

Don't.  Get.  Me.  Started.   Hell, at least by now somebody had cleaned
htree code into nearly readable form; maybe it might be doable...


What _can_ a common helper do, anyway, when we are busy parsing an arseload of
possibly corrupt data in whatever weird format fs insists upon?

As for the locking...  I toyed with one idea for a while: instead of passing
a callback and one of many completely different structs, how about a common
*beginning* of a struct, with callback stored in it along with several
common fields?  Namely,
	* count of filldir calls already made
	* pointer to file in question
	* "are we done" flag
And instead of calling filldir(buf, ...) ->readdir() would call one of several
helpers:
	* readdir_emit(buf, ...) - obvious
	* readdir_relax(buf) - called in a spot convenient for dropping
and retaking lock; returns whether we need to do revalidation.
	* readdir_eof(buf) - end of directory
	* maybe readdir_dot() and readdir_dotdot() - those are certainly
common enough

That's the obvious flagday stuff, but since we need to give serious beating
to most of the instances anyway...  Might as well consider something in
that direction.
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC] readdir mess, Al Viro, (Tue Aug 12, 2:22 am)
Re: [RFC] readdir mess, OGAWA Hirofumi, (Tue Aug 12, 1:02 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 1:18 pm)
Re: [RFC] readdir mess, OGAWA Hirofumi, (Tue Aug 12, 3:45 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 4:05 pm)
Re: [RFC] readdir mess, Alan Cox, (Tue Aug 12, 5:47 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 6:20 pm)
Re: [RFC] readdir mess, Alan Cox, (Tue Aug 12, 6:10 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 4:59 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 5:24 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 5:54 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 6:04 pm)
Re: [RFC] readdir mess, J. Bruce Fields, (Wed Aug 13, 12:20 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 2:10 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 4:21 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 4:38 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 5:04 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 8:04 pm)
Re: [RFC] readdir mess, Jan Harkes, (Fri Aug 15, 1:06 am)
Re: [RFC] readdir mess, Linus Torvalds, (Fri Aug 15, 12:58 pm)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 6:10 am)
Re: [RFC] readdir mess, Linus Torvalds, (Sun Aug 24, 1:20 pm)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 3:59 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Sun Aug 24, 7:51 pm)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 9:33 pm)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 9:44 pm)
Re: [RFC] readdir mess, Al Viro, (Sun Aug 24, 7:03 am)
Re: [RFC] readdir mess, J. Bruce Fields, (Mon Aug 25, 12:16 pm)
Re: [RFC] readdir mess, Al Viro, (Fri Aug 15, 1:34 am)
Re: [RFC] readdir mess, Brad Boyer, (Wed Aug 13, 4:36 am)
Re: [RFC] readdir mess, Al Viro, (Wed Aug 13, 12:19 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 8:28 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 9:19 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 9:51 pm)
Re: [RFC] readdir mess, Linus Torvalds, (Tue Aug 12, 4:02 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 2:22 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 2:37 pm)
Re: [RFC] readdir mess, Al Viro, (Tue Aug 12, 3:24 pm)