Re: [RFC] readdir mess

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Wed, 13 Aug 2008, Al Viro wrote:
> 
> 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?

Well, the parsing has to be done by the low-level filesystem code, yes.

However, the whole thing with races with "f_pos" and all the locking - 
that's only because we see the filesystem "readdir" code as being the 
primary source of data.

Quite frankly, if we had a "readdir page cache", the low-level filesystem 
would still have to parse the insane low-level data with corruption 
issues, but we could make it totally independent of f_pos (because we 
would never use in the _real_ file->f_pos - we would just populate the 
cache), and the locking issues would be only a cold-cache issue, with the 
hot-cache hopefully needing little locking at all.

For an exmple of that: you did a good job with all the "seq_file" helpers, 
which meant that the low-level "filesystem" ops didn't need to know 
_anything_ about partial results etc, and it automatically did the right 
thing wrt f_pos updates and lseek etc.

I'm not saying that readdir() would use the _same_ model, but I do suspect 
that a common format in between the disk format and the eventual readdir() 
output, that also could be cached, might mitigate a lot of the problems.

As to the issues with lookup() - yes, a lookup would need to get the lock 
for writing, but only for the last entry, and only if O_CREAT is set. 
There's nothing wrogn with concurrent read-only lookups, I think (apart 
from having to protect the dentries from being duplicated, of course, but 
that would be a per-dentry lock flag, not a directory lock, methinks).

I dunno.

That said, I think you are right that we could also just improve on the 
current non-caching version with soem higher-level semantics. Including 
flags like "yes, we've seen the end", so that we don't need to always call 
into the low-level filesystem one extra time to see that final zero 
return.

So yes, instead of separate "filldir_t" and "void *data" things, having a 
"struct filldir_t" with several fields in common might be worth it.

			Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux