1 Index: linus-2.6.7/fs/namei.c
2 ===================================================================
3 --- linus-2.6.7.orig/fs/namei.c 2005-03-05 20:24:52.000000000 +0200
4 +++ linus-2.6.7/fs/namei.c 2005-03-23 13:37:48.563339840 +0200
8 nd->last_type = LAST_NORM;
9 - if (this.name[0] != '.')
12 - nd->last_type = LAST_DOT;
13 - else if (this.len == 2 && this.name[1] == '.')
14 - nd->last_type = LAST_DOTDOT;
17 + if (this.name[0] == '.') {
19 + nd->last_type = LAST_DOT;
20 + else if (this.len == 2 && this.name[1] == '.')
21 + nd->last_type = LAST_DOTDOT;
24 + if ((nd->last_type == LAST_NORM) && inode->i_op &&
25 + inode->i_op->endparentlookup) {
26 + err = inode->i_op->endparentlookup(nd);
33 * We bypassed the ordinary revalidation routines.
34 @@ -1535,9 +1541,16 @@
38 - error = path_lookup(tmp, LOOKUP_PARENT, &nd);
39 + intent_init(&nd.intent.open, IT_MKNOD);
40 + nd.intent.open.create_mode = mode;
41 + nd.intent.open.create.dev = dev;
43 + error = path_lookup_it(tmp, LOOKUP_PARENT, &nd);
46 + if (nd.intent.open.flags & IT_STATUS_RAW)
49 dentry = lookup_create(&nd, 0);
50 error = PTR_ERR(dentry);
55 up(&nd.dentry->d_inode->i_sem);
60 @@ -1606,9 +1620,13 @@
61 struct dentry *dentry;
64 - error = path_lookup(tmp, LOOKUP_PARENT, &nd);
65 + intent_init(&nd.intent.open, IT_MKDIR);
66 + nd.intent.open.create_mode = mode;
67 + error = path_lookup_it(tmp, LOOKUP_PARENT, &nd);
70 + if (nd.intent.open.flags & IT_STATUS_RAW)
72 dentry = lookup_create(&nd, 1);
73 error = PTR_ERR(dentry);
74 if (!IS_ERR(dentry)) {
78 up(&nd.dentry->d_inode->i_sem);
83 @@ -1703,9 +1722,12 @@
87 - error = path_lookup(name, LOOKUP_PARENT, &nd);
88 + intent_init(&nd.intent.open, IT_RMDIR);
89 + error = path_lookup_it(name, LOOKUP_PARENT, &nd);
92 + if (nd.intent.open.flags & IT_STATUS_RAW)
95 switch(nd.last_type) {
97 @@ -1781,9 +1803,13 @@
101 - error = path_lookup(name, LOOKUP_PARENT, &nd);
102 + intent_init(&nd.intent.open, IT_UNLINK);
103 + error = path_lookup_it(name, LOOKUP_PARENT, &nd);
106 + if (nd.intent.open.flags & IT_STATUS_RAW)
110 if (nd.last_type != LAST_NORM)
112 @@ -1855,9 +1881,13 @@
113 struct dentry *dentry;
116 - error = path_lookup(to, LOOKUP_PARENT, &nd);
117 + intent_init(&nd.intent.open, IT_SYMLINK);
118 + nd.intent.open.create.link = from;
119 + error = path_lookup_it(to, LOOKUP_PARENT, &nd);
122 + if (nd.intent.open.flags & IT_STATUS_RAW)
124 dentry = lookup_create(&nd, 0);
125 error = PTR_ERR(dentry);
126 if (!IS_ERR(dentry)) {
127 @@ -1865,6 +1895,7 @@
130 up(&nd.dentry->d_inode->i_sem);
135 @@ -1936,9 +1967,13 @@
136 error = __user_walk(oldname, 0, &old_nd);
139 - error = path_lookup(to, LOOKUP_PARENT, &nd);
140 + intent_init(&nd.intent.open, IT_LINK);
141 + nd.intent.open.create.source_nd = &old_nd;
142 + error = path_lookup_it(to, LOOKUP_PARENT, &nd);
145 + if (nd.intent.open.flags & IT_STATUS_RAW)
148 if (old_nd.mnt != nd.mnt)
150 @@ -2119,9 +2154,18 @@
154 - error = path_lookup(newname, LOOKUP_PARENT, &newnd);
156 + if (oldnd.last_type != LAST_NORM)
159 + intent_init(&newnd.intent.open, IT_RENAME);
160 + newnd.intent.open.create.source_nd = &oldnd;
161 + error = path_lookup_it(newname, LOOKUP_PARENT, &newnd);
164 + if (newnd.intent.open.flags & IT_STATUS_RAW) {
169 if (oldnd.mnt != newnd.mnt)
170 @@ -2129,8 +2173,6 @@
172 old_dir = oldnd.dentry;
174 - if (oldnd.last_type != LAST_NORM)
177 new_dir = newnd.dentry;
178 if (newnd.last_type != LAST_NORM)
179 @@ -2238,6 +2280,7 @@
180 intent_init(&nd->intent.open, it.op);
181 nd->intent.open.flags = it.flags;
182 nd->intent.open.create_mode = it.create_mode;
183 + nd->intent.open.create = it.create;
184 res = link_path_walk(link, nd);
186 if (current->link_count || res || nd->last_type!=LAST_NORM)
187 Index: linus-2.6.7/include/linux/namei.h
188 ===================================================================
189 --- linus-2.6.7.orig/include/linux/namei.h 2005-03-05 20:24:52.000000000 +0200
190 +++ linus-2.6.7/include/linux/namei.h 2005-03-23 13:34:56.632477304 +0200
192 #define IT_UNLINK (1<<5)
193 #define IT_TRUNC (1<<6)
194 #define IT_GETXATTR (1<<7)
195 +#define IT_RMDIR (1<<8)
196 +#define IT_LINK (1<<9)
197 +#define IT_RENAME (1<<10)
198 +#define IT_MKDIR (1<<11)
199 +#define IT_MKNOD (1<<12)
200 +#define IT_SYMLINK (1<<13)
201 +#define IT_CHDIR (1<<14)
203 #define INTENT_MAGIC 0x19620323
205 +#define IT_STATUS_RAW (1<<10) /* Setting this in it_flags on exit from lookup
206 + means everything was done already and return
207 + value from lookup is in fact status of
208 + already performed operation */
216 + unsigned dev; /* For mknod */
217 + char *link; /* For symlink */
218 + struct nameidata *source_nd; /* For link/rename */
221 void *fs_data; /* FS-specific intent data */
224 Index: linus-2.6.7/include/linux/fs.h
225 ===================================================================
226 --- linus-2.6.7.orig/include/linux/fs.h 2005-03-05 20:24:52.000000000 +0200
227 +++ linus-2.6.7/include/linux/fs.h 2005-03-23 13:35:08.796628072 +0200
229 ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
230 ssize_t (*listxattr) (struct dentry *, char *, size_t);
231 int (*removexattr) (struct dentry *, const char *);
232 + int (*endparentlookup) (struct nameidata *);