aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_dentry.c
diff options
context:
space:
mode:
authorEric Van Hensbergen <ericvh@gmail.com>2006-03-02 05:54:33 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2006-03-02 11:33:07 -0500
commit46f6dac259717551916405ee3388de89fb152bca (patch)
tree0e6c8b4505339e90c05ec8326220286fd19fe1f4 /fs/9p/vfs_dentry.c
parent74b8054c730785cd9db093e48f53337e521b6270 (diff)
[PATCH] v9fs: simplify fid mapping
v9fs has been plagued by an over-complicated approach trying to map Linux dentry semantics to Plan 9 fid semantics. Our previous approach called for aggressive flushing of the dcache resulting in several problems (including wierd cwd behavior when running /bin/pwd). This patch dramatically simplifies our handling of this fid management. Fids will not be clunked as promptly, but the new approach is more functionally correct. We now clunk un-open fids only when their dentry ref_count reaches 0 (and d_delete is called). Another simplification is we no longer seek to match fids to the process-id or uid of the action initiator. The uid-matching will need to be revisited when we fix the security model. Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/9p/vfs_dentry.c')
-rw-r--r--fs/9p/vfs_dentry.c45
1 files changed, 8 insertions, 37 deletions
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c
index 2dd806dac9f1..12c9cc926b71 100644
--- a/fs/9p/vfs_dentry.c
+++ b/fs/9p/vfs_dentry.c
@@ -43,47 +43,18 @@
43#include "fid.h" 43#include "fid.h"
44 44
45/** 45/**
46 * v9fs_dentry_validate - VFS dcache hook to validate cache 46 * v9fs_dentry_delete - called when dentry refcount equals 0
47 * @dentry: dentry that is being validated 47 * @dentry: dentry in question
48 * @nd: path data
49 * 48 *
50 * dcache really shouldn't be used for 9P2000 as at all due to 49 * By returning 1 here we should remove cacheing of unused
51 * potential attached semantics to directory traversal (walk). 50 * dentry components.
52 *
53 * FUTURE: look into how to use dcache to allow multi-stage
54 * walks in Plan 9 & potential for better dcache operation which
55 * would remain valid for Plan 9 semantics. Older versions
56 * had validation via stat for those interested. However, since
57 * stat has the same approximate overhead as walk there really
58 * is no difference. The only improvement would be from a
59 * time-decay cache like NFS has and that undermines the
60 * synchronous nature of 9P2000.
61 * 51 *
62 */ 52 */
63 53
64static int v9fs_dentry_validate(struct dentry *dentry, struct nameidata *nd) 54int v9fs_dentry_delete(struct dentry *dentry)
65{ 55{
66 struct dentry *dc = current->fs->pwd; 56 dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry);
67 57 return 1;
68 dprintk(DEBUG_VFS, "dentry: %s (%p)\n", dentry->d_iname, dentry);
69 if (v9fs_fid_lookup(dentry)) {
70 dprintk(DEBUG_VFS, "VALID\n");
71 return 1;
72 }
73
74 while (dc != NULL) {
75 if (dc == dentry) {
76 dprintk(DEBUG_VFS, "VALID\n");
77 return 1;
78 }
79 if (dc == dc->d_parent)
80 break;
81
82 dc = dc->d_parent;
83 }
84
85 dprintk(DEBUG_VFS, "INVALID\n");
86 return 0;
87} 58}
88 59
89/** 60/**
@@ -118,6 +89,6 @@ void v9fs_dentry_release(struct dentry *dentry)
118} 89}
119 90
120struct dentry_operations v9fs_dentry_operations = { 91struct dentry_operations v9fs_dentry_operations = {
121 .d_revalidate = v9fs_dentry_validate, 92 .d_delete = v9fs_dentry_delete,
122 .d_release = v9fs_dentry_release, 93 .d_release = v9fs_dentry_release,
123}; 94};