Skip to content

RFC New path lookup function

Josef 'Jeff' Sipek linux-fsdevel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4fs: Introduce path_component_lookupfs/namei.c include/linux/namei.h+28 -01 reply
2/4sunrpc: Use path_component_lookupnet/sunrpc/rpc_pipe.c+7 -93 replies
3/4nfsctl: Use path_component_lookupfs/nfsctl.c+5 -100 replies
4/4fs: Remove path_walk exportfs/namei.c+0 -11 reply

Reviews trailers per patch

1 of 4 patches has a Reviewed-by or Acked-by.

PatchTrond Myklebust
1/4
2/4A-b
3/4
4/4

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/4] [RFC] New path lookup function

Stackable file systems, among others, frequently need to lookup paths or path components starting from an arbitrary point in the namespace (identified by a dentry and a vfsmount). Currently, such file systems use lookup_one_len, which is frowned upon [1] as it does not pass the lookup intent along; not passing a lookup intent, for example, can trigger BUG_ON's when stacking on top of NFSv4.

The first patch introduces a new lookup function to allow lookup starting from an arbitrary point in the namespace. This approach has been suggested by Christoph Hellwig [2].

The second patch changes sunrpc to use path_component_lookup.

The third patch changes nfsctl.c to use path_component_lookup.

The fourth, and last patch, unexports path_walk because it is no longer unnecessary to call it directly, and using the new path_component_lookup is cleaner.

For example, the following snippet of code, looks up "some/path/component" in a directory pointed to by parent_{dentry,vfsmnt}:

err = path_component_lookup(parent_dentry, parent_vfsmnt,

			    "some/path/component", 0, &nd);
if (!err) {
	/* exits */

	...

	/* once done, release the references */
	path_release(&nd);
} else if (err == -ENOENT) {
	/* doesn't exist */
} else {
	/* other error */
}

VFS functions such as lookup_create can be used on the nameidata structure to pass the create intent to the file system.

Currently, there is no easy way to pass the LOOKUP_OPEN intent. The proper way would be to call open_namei.

We'd like to get comments about what's necessary to make stackable file systems do lookups right: this includes potential changes to open_namei.

Josef 'Jeff' Sipek.

[1] http://lkml.org/lkml/2007/3/9/95
[2] http://lkml.org/lkml/2007/5/4/51