linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] [RFC] New path lookup function (V3)
@ 2007-05-06 17:41 Josef 'Jeff' Sipek
  2007-05-06 17:41 ` [PATCH 1/5] fs: Introduce vfs_path_lookup Josef 'Jeff' Sipek
                   ` (4 more replies)
  0 siblings, 5 replies; 15+ messages in thread
From: Josef 'Jeff' Sipek @ 2007-05-06 17:41 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-fsdevel, hch, akpm, viro, Trond.Myklebust, neilb, mhalcrow

(For list of changes since V2, see end of this email.)

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 vfs_path_lookup.

The third patch changes nfsctl.c to use vfs_path_lookup.

The fourth patch marks link_path_walk static.

The fifth, and last patch, unexports path_walk because it is no longer
unnecessary to call it directly, and using the new vfs_path_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 = vfs_path_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


Changes since V2:

- renamed path_component_lookup to vfs_path_lookup as it allows lookup of
  any path relative to a dentry/vfsmnt (hch)
- kernel doc comment for vfs_path_lookup (hch)
- cleaned up the audit_inode condition (hch)
- rpc_mount should not be dereferenced directly (trond)
- make path_walk static (hch)
- make link_path_walk static (hch)


^ permalink raw reply	[flat|nested] 15+ messages in thread
* [PATCH 0/5] New path lookup function (V4)
@ 2007-05-24  1:54 Josef 'Jeff' Sipek
  2007-05-24  1:54 ` [PATCH 4/5] fs: Mark link_path_walk static Josef 'Jeff' Sipek
  0 siblings, 1 reply; 15+ messages in thread
From: Josef 'Jeff' Sipek @ 2007-05-24  1:54 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-fsdevel, hch, akpm, viro, Trond.Myklebust, neilb, mhalcrow

The only change since V3, is the fix for a vfsmount reference leak in the
nfsctl patch (pointed out by hch).

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 vfs_path_lookup.

The third patch changes nfsctl.c to use vfs_path_lookup.

The fourth patch marks link_path_walk static.

The fifth, and last patch, unexports path_walk because it is no longer
unnecessary to call it directly, and using the new vfs_path_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 = vfs_path_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.

Josef 'Jeff' Sipek.

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


^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2007-05-24  1:59 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-06 17:41 [PATCH 0/5] [RFC] New path lookup function (V3) Josef 'Jeff' Sipek
2007-05-06 17:41 ` [PATCH 1/5] fs: Introduce vfs_path_lookup Josef 'Jeff' Sipek
2007-05-06 21:18   ` Christoph Hellwig
2007-05-06 17:41 ` [PATCH 2/5] sunrpc: Use vfs_path_lookup Josef 'Jeff' Sipek
2007-05-06 21:18   ` Christoph Hellwig
2007-05-06 17:41 ` [PATCH 3/5] nfsctl: " Josef 'Jeff' Sipek
2007-05-06 21:19   ` Christoph Hellwig
2007-05-06 22:13     ` [PATCH 1/1] " Josef 'Jeff' Sipek
2007-05-07  1:59       ` Neil Brown
2007-05-06 17:41 ` [PATCH 4/5] fs: Mark link_path_walk static Josef 'Jeff' Sipek
2007-05-06 21:20   ` Christoph Hellwig
2007-05-06 21:46     ` Josef 'Jeff' Sipek
2007-05-06 17:41 ` [PATCH 5/5] fs: Remove path_walk export Josef 'Jeff' Sipek
2007-05-06 21:20   ` Christoph Hellwig
  -- strict thread matches above, loose matches on Subject: below --
2007-05-24  1:54 [PATCH 0/5] New path lookup function (V4) Josef 'Jeff' Sipek
2007-05-24  1:54 ` [PATCH 4/5] fs: Mark link_path_walk static Josef 'Jeff' Sipek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).