Whamcloud - gitweb
file xnu_types.h was initially added on branch b_port_step.
[fs/lustre-release.git] / lustre / kernel_patches / patches / nfs_export_kernel-2.4.21-chaos.patch
1  fs/Makefile        |    3 
2  fs/file_table.c    |   11 ++
3  fs/inode.c         |   23 ++++-
4  fs/namei.c         |   12 ++
5  fs/nfsd/export.c   |    5 +
6  fs/nfsd/nfsfh.c    |   65 +++++++++++++-
7  fs/nfsd/vfs.c      |  235 ++++++++++++++++++++++++++++++++++++++++++++++++-----
8  include/linux/fs.h |   11 ++
9  kernel/ksyms.c     |    2 
10  9 files changed, 333 insertions(+), 34 deletions(-)
11
12 Index: linux-2.4.21-chaos/fs/file_table.c
13 ===================================================================
14 --- linux-2.4.21-chaos.orig/fs/file_table.c     2003-07-15 04:41:00.000000000 +0400
15 +++ linux-2.4.21-chaos/fs/file_table.c  2003-12-12 16:19:25.000000000 +0300
16 @@ -82,7 +82,8 @@
17   * and call the open function (if any).  The caller must verify that
18   * inode->i_fop is not NULL.
19   */
20 -int init_private_file(struct file *filp, struct dentry *dentry, int mode)
21 +int init_private_file_it(struct file *filp, struct dentry *dentry, int mode,
22 +                         struct lookup_intent *it)
23  {
24         memset(filp, 0, sizeof(*filp));
25         filp->f_mode   = mode;
26 @@ -90,12 +91,20 @@
27         filp->f_dentry = dentry;
28         filp->f_uid    = current->fsuid;
29         filp->f_gid    = current->fsgid;
30 +       if (it)
31 +               filp->f_it = it;
32         filp->f_op     = dentry->d_inode->i_fop;
33         if (filp->f_op->open)
34                 return filp->f_op->open(dentry->d_inode, filp);
35         else
36                 return 0;
37  }
38 +EXPORT_SYMBOL(init_private_file_it);
39 +
40 +int init_private_file(struct file *filp, struct dentry *dentry, int mode)
41 +{
42 +       return init_private_file_it(filp, dentry, mode, NULL);
43 +}
44  
45  void fput(struct file * file)
46  {
47 Index: linux-2.4.21-chaos/fs/inode.c
48 ===================================================================
49 --- linux-2.4.21-chaos.orig/fs/inode.c  2003-12-12 16:18:15.000000000 +0300
50 +++ linux-2.4.21-chaos/fs/inode.c       2003-12-12 16:19:25.000000000 +0300
51 @@ -1054,9 +1054,10 @@
52         return inode;
53  }
54  
55 -struct inode *iget4_locked(struct super_block *sb, unsigned long ino, find_inode_t find_actor, void *opaque)
56 +struct inode *ifind(struct super_block *sb, unsigned long ino,
57 +                       struct list_head *head,
58 +                       find_inode_t find_actor, void *opaque)
59  {
60 -       struct list_head * head = inode_hashtable + hash(sb,ino);
61         struct inode * inode;
62  
63         spin_lock(&inode_lock);
64 @@ -1069,6 +1070,24 @@
65         }
66         spin_unlock(&inode_lock);
67  
68 +       return NULL;
69 +}
70 +
71 +struct inode *ilookup4(struct super_block *sb, unsigned long ino,
72 +                       find_inode_t find_actor, void *opaque)
73 +{
74 +       struct list_head * head = inode_hashtable + hash(sb,ino);
75 +       return ifind(sb, ino, head, find_actor, opaque);
76 +}
77 +
78 +struct inode *iget4_locked(struct super_block *sb, unsigned long ino,
79 +                    find_inode_t find_actor, void *opaque)
80 +{
81 +       struct list_head * head = inode_hashtable + hash(sb,ino);
82 +       struct inode *inode = ifind(sb, ino, head, find_actor, opaque);
83 +       if (inode)
84 +               return inode;
85 +
86         /*
87          * get_new_inode() will do the right thing, re-trying the search
88          * in case it had to block at any point.
89 Index: linux-2.4.21-chaos/fs/Makefile
90 ===================================================================
91 --- linux-2.4.21-chaos.orig/fs/Makefile 2003-12-12 16:18:36.000000000 +0300
92 +++ linux-2.4.21-chaos/fs/Makefile      2003-12-12 16:19:25.000000000 +0300
93 @@ -9,7 +9,8 @@
94  
95  O_TARGET := fs.o
96  
97 -export-objs := filesystems.o open.o dcache.o buffer.o dquot.o dcookies.o inode.o
98 +export-objs := filesystems.o open.o dcache.o buffer.o dquot.o dcookies.o inode.o \
99 +               namei.o file_table.o
100  mod-subdirs := nls
101  
102  obj-y :=       open.o read_write.o devices.o file_table.o buffer.o \
103 Index: linux-2.4.21-chaos/fs/namei.c
104 ===================================================================
105 --- linux-2.4.21-chaos.orig/fs/namei.c  2003-12-12 16:18:06.000000000 +0300
106 +++ linux-2.4.21-chaos/fs/namei.c       2003-12-12 16:19:25.000000000 +0300
107 @@ -22,6 +22,7 @@
108  #include <linux/dnotify.h>
109  #include <linux/smp_lock.h>
110  #include <linux/personality.h>
111 +#include <linux/module.h>
112  
113  #include <asm/namei.h>
114  #include <asm/uaccess.h>
115 @@ -100,6 +101,7 @@
116                 it->it_op_release(it);
117  
118  }
119 +EXPORT_SYMBOL(intent_release);
120  
121  /* In order to reduce some races, while at the same time doing additional
122   * checking and hopefully speeding things up, we copy filenames to the
123 @@ -910,7 +912,8 @@
124  
125  
126  /* SMP-safe */
127 -struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
128 +struct dentry * lookup_one_len_it(const char * name, struct dentry * base,
129 +                                  int len, struct lookup_intent *it)
130  {
131         unsigned long hash;
132         struct qstr this;
133 @@ -930,11 +933,16 @@
134         }
135         this.hash = end_name_hash(hash);
136  
137 -       return lookup_hash_it(&this, base, NULL);
138 +       return lookup_hash_it(&this, base, it);
139  access:
140         return ERR_PTR(-EACCES);
141  }
142  
143 +struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
144 +{
145 +       return lookup_one_len_it(name, base, len, NULL);
146 +}
147 +
148  /*
149   *     namei()
150   *
151 Index: linux-2.4.21-chaos/fs/nfsd/export.c
152 ===================================================================
153 --- linux-2.4.21-chaos.orig/fs/nfsd/export.c    2003-09-19 03:49:54.000000000 +0400
154 +++ linux-2.4.21-chaos/fs/nfsd/export.c 2003-12-12 16:19:25.000000000 +0300
155 @@ -223,6 +223,11 @@
156         inode = nd.dentry->d_inode;
157         dev = inode->i_dev;
158         ino = inode->i_ino;
159 +       if ((inode->i_sb->s_type->fs_flags & FS_NFSEXP_FSID) &&
160 +           !(nxp->ex_flags & NFSEXP_FSID)) {
161 +           nxp->ex_dev = inode->i_sb->s_dev;
162 +           nxp->ex_flags |= NFSEXP_FSID;
163 +       }
164         err = -EINVAL;
165  
166         exp = exp_get(clp, dev, ino);
167 Index: linux-2.4.21-chaos/fs/nfsd/nfsfh.c
168 ===================================================================
169 --- linux-2.4.21-chaos.orig/fs/nfsd/nfsfh.c     2003-09-19 03:49:54.000000000 +0400
170 +++ linux-2.4.21-chaos/fs/nfsd/nfsfh.c  2003-12-12 16:19:25.000000000 +0300
171 @@ -36,6 +36,15 @@
172         int sequence;           /* sequence counter */
173  };
174  
175 +static struct dentry *lookup_it(struct inode *inode, struct dentry * dentry)
176 +{
177 +       if (inode->i_op->lookup_it)
178 +           return inode->i_op->lookup_it(inode, dentry, NULL, NULL, 0);
179 +       else
180 +           return inode->i_op->lookup(inode, dentry);
181 +               
182 +}
183 +
184  /*
185   * A rather strange filldir function to capture
186   * the name matching the specified inode number.
187 @@ -75,6 +84,8 @@
188         int error;
189         struct file file;
190         struct nfsd_getdents_callback buffer;
191 +       struct lookup_intent it;
192 +       struct file *filp = NULL;
193  
194         error = -ENOTDIR;
195         if (!dir || !S_ISDIR(dir->i_mode))
196 @@ -85,9 +96,37 @@
197         /*
198          * Open the directory ...
199          */
200 -       error = init_private_file(&file, dentry, FMODE_READ);
201 -       if (error)
202 +       if (dentry->d_op && dentry->d_op->d_revalidate_it) {
203 +               if ((dentry->d_flags & DCACHE_NFSD_DISCONNECTED) &&
204 +                   (dentry->d_parent == dentry) ) {
205 +                       it.it_op_release = NULL;
206 +                       /* 
207 +                        * XXX Temporary Hack: Simulating init_private_file without
208 +                        * f_op->open for disconnected dentry Since we don't have actual
209 +                        * dentry->d_name to revalidate in revalidate_it()
210 +                        */
211 +                       filp = &file;
212 +                       memset(filp, 0, sizeof(*filp));
213 +                       filp->f_mode   = FMODE_READ;
214 +                       atomic_set(&filp->f_count, 1);
215 +                       filp->f_dentry = dentry;
216 +                       filp->f_uid = current->fsuid;
217 +                       filp->f_gid = current->fsgid;
218 +                       filp->f_op = dentry->d_inode->i_fop;
219 +                       error = 0;
220 +               } else {
221 +                       intent_init(&it, IT_OPEN, 0);
222 +                       error = revalidate_it(dentry, &it);
223 +                       if (error)
224 +                               goto out;
225 +                       error = init_private_file_it(&file, dentry, FMODE_READ, &it);
226 +               }
227 +       } else {
228 +               error = init_private_file_it(&file, dentry, FMODE_READ, NULL);
229 +       }
230 +       if (error) 
231                 goto out;
232 +
233         error = -EINVAL;
234         if (!file.f_op->readdir)
235                 goto out_close;
236 @@ -113,9 +152,13 @@
237         }
238  
239  out_close:
240 -       if (file.f_op->release)
241 +       if (file.f_op->release && !filp)
242                 file.f_op->release(dir, &file);
243  out:
244 +       if (dentry->d_op &&
245 +           dentry->d_op->d_revalidate_it &&
246 +           it.it_op_release && !filp)
247 +               intent_release(&it);
248         return error;
249  }
250  
251 @@ -274,7 +317,7 @@
252          * it is well connected.  But nobody returns different dentrys do they?
253          */
254         down(&child->d_inode->i_sem);
255 -       pdentry = child->d_inode->i_op->lookup(child->d_inode, tdentry);
256 +       pdentry = lookup_it(child->d_inode, tdentry);
257         up(&child->d_inode->i_sem);
258         d_drop(tdentry); /* we never want ".." hashed */
259         if (!pdentry && tdentry->d_inode == NULL) {
260 @@ -307,6 +350,8 @@
261                                 pdentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
262                                 pdentry->d_op = child->d_op;
263                         }
264 +                       if (child->d_op && child->d_op->d_revalidate_it)
265 +                               pdentry->d_op = child->d_op;
266                 }
267                 if (pdentry == NULL)
268                         pdentry = ERR_PTR(-ENOMEM);
269 @@ -464,6 +509,8 @@
270                 struct dentry *pdentry;
271                 struct inode *parent;
272  
273 +               if (result->d_op && result->d_op->d_revalidate_it)
274 +                       dentry->d_op = result->d_op;
275                 pdentry = nfsd_findparent(dentry);
276                 err = PTR_ERR(pdentry);
277                 if (IS_ERR(pdentry))
278 @@ -672,6 +719,11 @@
279  
280         inode = dentry->d_inode;
281  
282 +       /* cache coherency for non-device filesystems */
283 +       if (inode->i_op && inode->i_op->revalidate_it) {
284 +           inode->i_op->revalidate_it(dentry, NULL);
285 +       }
286 +
287         /* Type check. The correct error return for type mismatches
288          * does not seem to be generally agreed upon. SunOS seems to
289          * use EISDIR if file isn't S_IFREG; a comment in the NFSv3
290 @@ -905,8 +957,9 @@
291                 dentry->d_parent->d_name.name, dentry->d_name.name);
292         goto out;
293  out_uptodate:
294 -       printk(KERN_ERR "fh_update: %s/%s already up-to-date!\n",
295 -               dentry->d_parent->d_name.name, dentry->d_name.name);
296 +       if(!dentry->d_parent->d_inode->i_op->mkdir_raw)
297 +               printk(KERN_ERR "fh_update: %s/%s already up-to-date!\n",
298 +                       dentry->d_parent->d_name.name, dentry->d_name.name);
299         goto out;
300  }
301  
302 Index: linux-2.4.21-chaos/fs/nfsd/vfs.c
303 ===================================================================
304 --- linux-2.4.21-chaos.orig/fs/nfsd/vfs.c       2003-09-19 03:49:54.000000000 +0400
305 +++ linux-2.4.21-chaos/fs/nfsd/vfs.c    2003-12-12 16:19:25.000000000 +0300
306 @@ -78,6 +78,128 @@
307  static struct raparms *                raparml;
308  static struct raparms *                raparm_cache;
309  
310 +static int link_raw(struct dentry *dold, struct dentry *ddir,
311 +                    struct dentry *dnew)
312 +{
313 +       int err;
314 +
315 +       struct nameidata old_nd = { .dentry = dold };
316 +       struct nameidata nd = { .dentry = ddir, .last = dnew->d_name };
317 +       struct inode_operations *op = nd.dentry->d_inode->i_op;
318 +       err = op->link_raw(&old_nd, &nd);
319 +       d_instantiate(dnew, dold->d_inode);
320 +       if(dold->d_inode->i_op && dold->d_inode->i_op->revalidate_it)
321 +               dold->d_inode->i_op->revalidate_it(dnew, NULL);
322 +
323 +       return err;
324 +}
325 +
326 +static int unlink_raw(struct dentry *dentry, char *fname, int flen,
327 +                      struct dentry *rdentry)
328 +{
329 +       int err;
330 +        struct qstr last = { .name = fname, .len = flen };
331 +       struct nameidata nd = { .dentry = dentry, .last = last };
332 +       struct inode_operations *op = nd.dentry->d_inode->i_op;
333 +       err = op->unlink_raw(&nd);
334 +       if (!err)
335 +               d_delete(rdentry);
336 +
337 +       return err;
338 +}
339 +
340 +static int rmdir_raw(struct dentry *dentry, char *fname, int flen,
341 +                     struct dentry *rdentry)
342 +{
343 +       int err;
344 +        struct qstr last = { .name = fname, .len = flen };
345 +       struct nameidata nd = { .dentry = dentry, .last = last };
346 +       struct inode_operations *op = nd.dentry->d_inode->i_op;
347 +       err = op->rmdir_raw(&nd);
348 +       if(!err) {
349 +               rdentry->d_inode->i_flags |= S_DEAD;
350 +               d_delete(rdentry);
351 +       }
352 +
353 +       return err;
354 +}
355 +
356 +static int symlink_raw(struct dentry *dentry,  char *fname, int flen,
357 +                       char *path)
358 +{
359 +       int err;
360 +        struct qstr last = { .name = fname, .len = flen };
361 +       struct nameidata nd = { .dentry = dentry, .last = last };
362 +       struct inode_operations *op = nd.dentry->d_inode->i_op;
363 +       err = op->symlink_raw(&nd, path);
364 +
365 +       return err;
366 +}
367 +
368 +static int mkdir_raw(struct dentry *dentry, char *fname, int flen, int mode)
369 +{
370 +       int err;
371 +        struct qstr last = { .name = fname, .len = flen };
372 +       struct nameidata nd = { .dentry = dentry, .last = last };
373 +       struct inode_operations *op = nd.dentry->d_inode->i_op;
374 +       err = op->mkdir_raw(&nd, mode);
375 +
376 +       return err;
377 +}
378 +
379 +static int mknod_raw(struct dentry *dentry, char *fname, int flen, int mode,
380 +                     dev_t dev)
381 +{
382 +       int err;
383 +        struct qstr last = { .name = fname, .len = flen };
384 +       struct nameidata nd = { .dentry = dentry, .last = last };
385 +       struct inode_operations *op = nd.dentry->d_inode->i_op;
386 +       err = op->mknod_raw(&nd, mode, dev);
387 +
388 +       return err;
389 +}      
390 +
391 +static int rename_raw(struct dentry *fdentry, struct dentry *tdentry,
392 +                      struct dentry *odentry, struct dentry *ndentry)
393 +{
394 +       int err;
395 +
396 +       struct nameidata old_nd = { .dentry = fdentry, .last = odentry->d_name};
397 +       struct nameidata new_nd = { .dentry = tdentry, .last = ndentry->d_name};
398 +       struct inode_operations *op = old_nd.dentry->d_inode->i_op;
399 +       err = op->rename_raw(&old_nd, &new_nd);
400 +       d_move(odentry, ndentry);
401 +
402 +       return err;
403 +}
404 +
405 +static int setattr_raw(struct inode *inode, struct iattr *iap)
406 +{
407 +       int err;
408 +
409 +       iap->ia_valid |= ATTR_RAW;
410 +       err = inode->i_op->setattr_raw(inode, iap);
411 +
412 +       return err;
413 +}
414 +
415 +int revalidate_it(struct dentry *dentry, struct lookup_intent *it)
416 +{
417 +       int err = 0;
418 +
419 +       if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
420 +               if (!dentry->d_op->d_revalidate_it(dentry, 0, NULL, it) &&
421 +                       !d_invalidate(dentry)) {
422 +                       dput(dentry);
423 +                       err = -EINVAL;
424 +                       dentry = NULL;
425 +                       return err;
426 +               }
427 +       }
428 +
429 +       return err;
430 +}
431 +
432  /*
433   * Look up one component of a pathname.
434   * N.B. After this call _both_ fhp and resfh need an fh_put
435 @@ -303,7 +425,10 @@
436         }
437         err = nfserr_notsync;
438         if (!check_guard || guardtime == inode->i_ctime) {
439 -               err = notify_change(dentry, iap);
440 +               if ( dentry->d_inode->i_op && dentry->d_inode->i_op->setattr_raw)
441 +                       err = setattr_raw(dentry->d_inode, iap);
442 +               else
443 +                       err = notify_change(dentry, iap);
444                 err = nfserrno(err);
445         }
446         if (size_change) {
447 @@ -430,6 +555,7 @@
448  {
449         struct dentry   *dentry;
450         struct inode    *inode;
451 +       struct lookup_intent it;
452         int             err;
453  
454         /* If we get here, then the client has already done an "open", and (hopefully)
455 @@ -476,6 +602,14 @@
456                 filp->f_mode  = FMODE_READ;
457         }
458  
459 +       intent_init(&it, IT_OPEN, (filp->f_flags & ~O_ACCMODE) | filp->f_mode);
460 +
461 +       err = revalidate_it(dentry, &it);
462 +       if (err)
463 +               goto out_nfserr;
464 +       
465 +       filp->f_it = &it;
466 +       
467         err = 0;
468         if (filp->f_op && filp->f_op->open) {
469                 err = filp->f_op->open(inode, filp);
470 @@ -490,7 +624,11 @@
471                         atomic_dec(&filp->f_count);
472                 }
473         }
474 +
475  out_nfserr:
476 +       if (it.it_op_release)
477 +               intent_release(&it);
478 +
479         if (err)
480                 err = nfserrno(err);
481  out:
482 @@ -821,7 +959,7 @@
483  {
484         struct dentry   *dentry, *dchild;
485         struct inode    *dirp;
486 -       int             err;
487 +       int             err, error = -EOPNOTSUPP;
488  
489         err = nfserr_perm;
490         if (!flen)
491 @@ -837,20 +975,44 @@
492         dentry = fhp->fh_dentry;
493         dirp = dentry->d_inode;
494  
495 +       switch (type) {
496 +                       case S_IFDIR:
497 +                               if (dirp->i_op->mkdir_raw)
498 +                           error = mkdir_raw(dentry, fname, flen, iap->ia_mode);
499 +                               break;
500 +                       case S_IFCHR:
501 +                       case S_IFBLK:
502 +                       case S_IFIFO:
503 +                       case S_IFSOCK:
504 +                       case S_IFREG:
505 +                           if (dirp->i_op->mknod_raw) {
506 +                                       if (type == S_IFREG)
507 +                                               rdev = 0;
508 +                                       error = mknod_raw(dentry, fname, flen, iap->ia_mode, rdev);
509 +                               }
510 +                               break;
511 +                               default:
512 +                       printk("nfsd: bad file type %o in nfsd_create\n", type);
513 +       }
514 +
515         err = nfserr_notdir;
516 -       if(!dirp->i_op || !dirp->i_op->lookup)
517 +       if(!dirp->i_op || !(dirp->i_op->lookup || dirp->i_op->lookup_it))
518                 goto out;
519         /*
520          * Check whether the response file handle has been verified yet.
521          * If it has, the parent directory should already be locked.
522          */
523 -       if (!resfhp->fh_dentry) {
524 -               /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */
525 -               fh_lock(fhp);
526 +       if (!resfhp->fh_dentry || dirp->i_op->lookup_it) {
527 +               /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create
528 +                  and nfsd_proc_create in case of lustre
529 +               */
530 +               if (!resfhp->fh_dentry)
531 +                       fh_lock(fhp);
532                 dchild = lookup_one_len(fname, dentry, flen);
533                 err = PTR_ERR(dchild);
534                 if (IS_ERR(dchild))
535                         goto out_nfserr;
536 +               resfhp->fh_dentry = NULL;
537                 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
538                 if (err)
539                         goto out;
540 @@ -871,10 +1033,12 @@
541          * Make sure the child dentry is still negative ...
542          */
543         err = nfserr_exist;
544 -       if (dchild->d_inode) {
545 -               dprintk("nfsd_create: dentry %s/%s not negative!\n",
546 -                       dentry->d_name.name, dchild->d_name.name);
547 -               goto out; 
548 +       if ( error == -EOPNOTSUPP) {
549 +               if (dchild->d_inode) {
550 +                       dprintk("nfsd_create: dentry %s/%s not negative!\n",
551 +                               dentry->d_name.name, dchild->d_name.name);
552 +                       goto out; 
553 +               }
554         }
555  
556         if (!(iap->ia_valid & ATTR_MODE))
557 @@ -887,16 +1051,19 @@
558         err = nfserr_perm;
559         switch (type) {
560         case S_IFREG:
561 -               err = vfs_create(dirp, dchild, iap->ia_mode);
562 +               if (error == -EOPNOTSUPP)
563 +                       err = vfs_create(dirp, dchild, iap->ia_mode);
564                 break;
565         case S_IFDIR:
566 -               err = vfs_mkdir(dirp, dchild, iap->ia_mode);
567 +               if (error == -EOPNOTSUPP)
568 +                       err = vfs_mkdir(dirp, dchild, iap->ia_mode);
569                 break;
570         case S_IFCHR:
571         case S_IFBLK:
572         case S_IFIFO:
573         case S_IFSOCK:
574 -               err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
575 +               if (error == -EOPNOTSUPP)       
576 +                       err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
577                 break;
578         default:
579                 printk("nfsd: bad file type %o in nfsd_create\n", type);
580 @@ -965,7 +1132,13 @@
581         /* Get all the sanity checks out of the way before
582          * we lock the parent. */
583         err = nfserr_notdir;
584 -       if(!dirp->i_op || !dirp->i_op->lookup)
585 +       if (dirp->i_op->mknod_raw) {
586 +               err = mknod_raw(dentry, fname, flen, iap->ia_mode, 0);
587 +               if (err && err != -EOPNOTSUPP)
588 +                       goto out;
589 +       }
590 +
591 +       if(!dirp->i_op ||  !(dirp->i_op->lookup || dirp->i_op->lookup_it))
592                 goto out;
593         fh_lock(fhp);
594  
595 @@ -1016,6 +1189,8 @@
596                 case NFS3_CREATE_GUARDED:
597                         err = nfserr_exist;
598                 }
599 +               if(dirp->i_op->mknod_raw)
600 +                       err = 0;
601                 goto out;
602         }
603  
604 @@ -1122,7 +1297,7 @@
605                                 struct iattr *iap)
606  {
607         struct dentry   *dentry, *dnew;
608 -       int             err, cerr;
609 +       int             err, cerr, error = -EOPNOTSUPP;
610  
611         err = nfserr_noent;
612         if (!flen || !plen)
613 @@ -1136,12 +1311,18 @@
614                 goto out;
615         fh_lock(fhp);
616         dentry = fhp->fh_dentry;
617 +       
618 +       if (dentry->d_inode->i_op->symlink_raw)
619 +               error = symlink_raw(dentry, fname, flen, path);
620 +
621         dnew = lookup_one_len(fname, dentry, flen);
622         err = PTR_ERR(dnew);
623         if (IS_ERR(dnew))
624                 goto out_nfserr;
625  
626 -       err = vfs_symlink(dentry->d_inode, dnew, path);
627 +       err = error;
628 +       if (err == -EOPNOTSUPP || !dentry->d_inode->i_op->symlink_raw)
629 +               err = vfs_symlink(dentry->d_inode, dnew, path);
630         if (!err) {
631                 if (EX_ISSYNC(fhp->fh_export))
632                         nfsd_sync_dir(dentry);
633 @@ -1211,7 +1392,10 @@
634         dold = tfhp->fh_dentry;
635         dest = dold->d_inode;
636  
637 -       err = vfs_link(dold, dirp, dnew);
638 +       if (dirp->i_op->link_raw)
639 +               err = link_raw(dold, ddir, dnew);
640 +       else
641 +               err = vfs_link(dold, dirp, dnew);
642         if (!err) {
643                 if (EX_ISSYNC(ffhp->fh_export)) {
644                         nfsd_sync_dir(ddir);
645 @@ -1296,7 +1480,10 @@
646                         err = nfserr_perm;
647         } else
648  #endif
649 -       err = vfs_rename(fdir, odentry, tdir, ndentry);
650 +       if(fdir->i_op->rename_raw)
651 +               err = rename_raw(fdentry, tdentry, odentry, ndentry);
652 +       else
653 +               err = vfs_rename(fdir, odentry, tdir, ndentry);
654         if (!err && EX_ISSYNC(tfhp->fh_export)) {
655                 nfsd_sync_dir(tdentry);
656                 nfsd_sync_dir(fdentry);
657 @@ -1317,7 +1504,7 @@
658         fill_post_wcc(tfhp);
659         double_up(&tdir->i_sem, &fdir->i_sem);
660         ffhp->fh_locked = tfhp->fh_locked = 0;
661 -       
662 +
663  out:
664         return err;
665  }
666 @@ -1363,9 +1550,15 @@
667                         err = nfserr_perm;
668                 } else
669  #endif
670 -               err = vfs_unlink(dirp, rdentry);
671 +               if (dirp->i_op->unlink_raw)
672 +                       err = unlink_raw(dentry, fname, flen, rdentry);
673 +               else
674 +                       err = vfs_unlink(dirp, rdentry);
675         } else { /* It's RMDIR */
676 -               err = vfs_rmdir(dirp, rdentry);
677 +               if (dirp->i_op->rmdir_raw)
678 +                       err = rmdir_raw(dentry, fname, flen, rdentry);
679 +               else
680 +                       err = vfs_rmdir(dirp, rdentry);
681         }
682  
683         dput(rdentry);
684 Index: linux-2.4.21-chaos/include/linux/fs.h
685 ===================================================================
686 --- linux-2.4.21-chaos.orig/include/linux/fs.h  2003-12-12 16:19:23.000000000 +0300
687 +++ linux-2.4.21-chaos/include/linux/fs.h       2003-12-12 16:19:25.000000000 +0300
688 @@ -93,6 +93,9 @@
689  #define FS_SINGLE      8 /* Filesystem that can have only one superblock */
690  #define FS_NOMOUNT     16 /* Never mount from userland */
691  #define FS_LITTER      32 /* Keeps the tree in dcache */
692 +#define FS_NFSEXP_FSID  64 /* Use file system specific fsid for
693 +                           * exporting non device filesystems.
694 +                           */
695  #define FS_ODD_RENAME  32768   /* Temporary stuff; will go away as soon
696                                   * as nfs_rename() will be cleaned up
697                                   */
698 @@ -1159,6 +1162,9 @@
699                          struct nameidata *nd, struct lookup_intent *it);
700  extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
701                             int flags, struct lookup_intent *it);
702 +extern int revalidate_it(struct dentry *dentry, struct lookup_intent *it);
703 +extern int init_private_file_it(struct file *, struct dentry *dentry, int mode,
704 +                                struct lookup_intent *it);
705  extern int filp_close(struct file *, fl_owner_t id);
706  extern char * getname(const char *);
707  
708 @@ -1458,6 +1464,8 @@
709  extern int follow_down(struct vfsmount **, struct dentry **);
710  extern int follow_up(struct vfsmount **, struct dentry **);
711  extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
712 +extern struct dentry * lookup_one_len_it(const char *, struct dentry *, int,
713 +                                         struct lookup_intent *);
714  extern struct dentry * lookup_hash(struct qstr *, struct dentry *);
715  #define user_path_walk(name,nd)         __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
716  #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
717 @@ -1477,7 +1485,8 @@
718  
719  extern struct inode * iget4_locked(struct super_block *, unsigned long,
720                                    find_inode_t, void *);
721 -
722 +extern struct inode * ilookup4(struct super_block *, unsigned long,
723 +                               find_inode_t, void *);
724  static inline struct inode *iget4(struct super_block *sb, unsigned long ino,
725                                   find_inode_t find_actor, void *opaque)
726  {
727 Index: linux-2.4.21-chaos/kernel/ksyms.c
728 ===================================================================
729 --- linux-2.4.21-chaos.orig/kernel/ksyms.c      2003-12-12 16:18:36.000000000 +0300
730 +++ linux-2.4.21-chaos/kernel/ksyms.c   2003-12-12 16:19:25.000000000 +0300
731 @@ -178,6 +178,7 @@
732  EXPORT_SYMBOL(igrab);
733  EXPORT_SYMBOL(iunique);
734  EXPORT_SYMBOL(iget4_locked);
735 +EXPORT_SYMBOL(ilookup4);
736  EXPORT_SYMBOL(unlock_new_inode);
737  EXPORT_SYMBOL(iput);
738  EXPORT_SYMBOL(inode_init_once);
739 @@ -191,6 +192,7 @@
740  EXPORT_SYMBOL(path_release);
741  EXPORT_SYMBOL(__user_walk);
742  EXPORT_SYMBOL(lookup_one_len);
743 +EXPORT_SYMBOL(lookup_one_len_it);
744  EXPORT_SYMBOL(lookup_hash);
745  
746  EXPORT_SYMBOL(sys_close);