Messages in this thread | | | Date | Thu, 16 Apr 2009 17:45:45 -0400 | Subject | Re: Q: NFSD readdir in linux-2.6.28 | From | "J. Bruce Fields" <> |
| |
On Thu, Mar 19, 2009 at 03:17:17PM +0000, David Woodhouse wrote: > On Thu, 2009-03-19 at 14:54 +0000, hooanon05@yahoo.co.jp wrote: > > > > Hello David and Al, > > I have a question about NFSD readdir. > > > > By the commit 14f7dd632011bb89c035722edd6ea0d90ca6b078 > > "[PATCH] Copy XFS readdir hack into nfsd code", nfsd_buffered_filldir() > > was introduced and nfs3svc_encode_entry_plus() (the 'func' parameter) is > > not called from vfs_readdir(). > > > > In 2.6.27, when nfs3svc_encode_entry_plus() calls lookup_one_len(), the > > i_mutex lock was acquired by vfs_readdir() and it was not a problem. > > > > After the commit (above), nfsd_readdir/nfsd_buffered_readdir/vfs_readdir > > calls nfsd_buffered_filldir(), and nfs3svc_encode_entry_plus() is called > > later. > > In this sequence, lookup_one_len() is called without i_mutex held. > > > > Isn't it a problem? > > Yes, well spotted. It didn't matter when the buffered readdir() was > purely internal to XFS, because it didn't matter there that we called > ->lookup() without i_mutex set. But now we're exposing arbitrary file > systems to it, we need to make sure we follow the locking rules. > > I _think_ it's sufficient to make the affected callers of > lookup_one_len() lock the parent's i_mutex for themselves before calling > it. I'll take a closer look...
Yipes--is this problem still here?
--b.
| |