[lkml]   [2006]   [Aug]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: [PATCH] NFS: Replace null dentries that appear in readdir's list [try #2]
On Fri, 18 Aug 2006 10:38:44 +0100
David Howells <> wrote:

> NFS: Replace null dentries that appear in readdir's list [try #2]
> From: David Howells <>
> Have nfs_readdir_lookup() drop and replace any null dentry when it
> that gets listed by a READDIR RPC call.
> This can be caused by an optimisation in nfs_lookup() that causes a dentry to
> be incorrectly left as negative when mkdir() or similar is aborted by SELinux
> mid-procedure.
> This can be triggered by mounting through autofs4 a server:/ NFS share for
> which there are other exports available on that server. SELinux also has to
> be turned on in enforcing mode to abort mid-flow the mkdir operation performed
> by autofs4.
> The problematic sequence of events is this:
> (1) nfs_lookup() is called by sys_mkdirat() -> lookup_create() ->
> __lookup_hash() with intent to create exclusively set in the nameidata:
> nd->flags == LOOKUP_CREATE
> nd-> == O_EXCL
> (2) nfs_lookup() has an optimisation to avoid going to the server in this
> case, presumably since the nfs_mkdir() op or whatever will deal with the
> conflict.
> (3) nfs_lookup() returns successfully, leaving the dentry in a negative state,
> but attached to the parent directory.
> (4) sys_mkdirat() calls vfs_mkdir() which calls may_create(). may_create()
> checks that the directory has MAY_WRITE and MAY_EXEC permissions.
> (5) may_create() calls nfs_permission(), which grants permission.
> (6) may_create() calls security_inode_permission(), which calls SELinux, which
> then _DENIES_ permission.
> (7) may_create() fails, and vfs_mkdir() then fails and sys_mkdirat() then
> fails (as does sys_mkdir).
> _However_, the new dentry is left in the negative state, with no
> consultation of the server.
> (8) The parent directory is listed, and the name of the new dentry is
> returned.
> (9) stat on the new dentry fails (because it's negative), and "ls -l" returns
> "?---------" as the file type and mode.
> This fix makes step (8) replace the dentry looked up in steps (1) - (3).

The funny-looking dentries in /net/bix have gone away.

But `ls -l /net/bix/usr/src' doesn't mount bix:/usr/src.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2006-08-19 18:51    [W:0.276 / U:6.332 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site