2 ===================================================================
3 --- lum.orig/fs/Makefile 2004-06-07 17:25:22.000000000 -0400
4 +++ lum/fs/Makefile 2004-06-07 17:25:22.000000000 -0400
9 -export-objs := filesystems.o open.o dcache.o buffer.o dquot.o inode.o
10 +export-objs := filesystems.o open.o dcache.o buffer.o dquot.o inode.o \
11 + namei.o file_table.o
14 obj-y := open.o read_write.o devices.o file_table.o buffer.o \
15 Index: lum/fs/file_table.c
16 ===================================================================
17 --- lum.orig/fs/file_table.c 2002-11-28 18:53:15.000000000 -0500
18 +++ lum/fs/file_table.c 2004-06-07 17:25:22.000000000 -0400
20 * and call the open function (if any). The caller must verify that
21 * inode->i_fop is not NULL.
23 -int init_private_file(struct file *filp, struct dentry *dentry, int mode)
24 +int init_private_file_it(struct file *filp, struct dentry *dentry, int mode,
25 + struct lookup_intent *it)
27 memset(filp, 0, sizeof(*filp));
30 filp->f_dentry = dentry;
31 filp->f_uid = current->fsuid;
32 filp->f_gid = current->fsgid;
35 filp->f_op = dentry->d_inode->i_fop;
37 return filp->f_op->open(dentry->d_inode, filp);
41 +EXPORT_SYMBOL(init_private_file_it);
43 +int init_private_file(struct file *filp, struct dentry *dentry, int mode)
45 + return init_private_file_it(filp, dentry, mode, NULL);
48 void fput(struct file * file)
51 ===================================================================
52 --- lum.orig/fs/inode.c 2004-06-07 17:25:22.000000000 -0400
53 +++ lum/fs/inode.c 2004-06-07 17:25:22.000000000 -0400
54 @@ -1045,9 +1045,10 @@
58 -struct inode *iget4(struct super_block *sb, unsigned long ino, find_inode_t find_actor, void *opaque)
59 +static inline struct inode *ifind(struct super_block *sb, unsigned long ino,
60 + struct list_head *head,
61 + find_inode_t find_actor, void *opaque)
63 - struct list_head * head = inode_hashtable + hash(sb,ino);
66 spin_lock(&inode_lock);
67 @@ -1060,6 +1061,24 @@
69 spin_unlock(&inode_lock);
74 +struct inode *ilookup4(struct super_block *sb, unsigned long ino,
75 + find_inode_t find_actor, void *opaque)
77 + struct list_head * head = inode_hashtable + hash(sb,ino);
78 + return ifind(sb, ino, head, find_actor, opaque);
81 +struct inode *iget4(struct super_block *sb, unsigned long ino,
82 + find_inode_t find_actor, void *opaque)
84 + struct list_head * head = inode_hashtable + hash(sb,ino);
85 + struct inode *inode = ifind(sb, ino, head, find_actor, opaque);
90 * get_new_inode() will do the right thing, re-trying the search
91 * in case it had to block at any point.
93 ===================================================================
94 --- lum.orig/fs/namei.c 2004-06-07 17:24:47.000000000 -0400
95 +++ lum/fs/namei.c 2004-06-07 18:08:28.000000000 -0400
97 #include <linux/dnotify.h>
98 #include <linux/smp_lock.h>
99 #include <linux/personality.h>
100 +#include <linux/module.h>
102 #include <asm/namei.h>
103 #include <asm/uaccess.h>
105 it->it_op_release(it);
108 +EXPORT_SYMBOL(intent_release);
110 /* In order to reduce some races, while at the same time doing additional
111 * checking and hopefully speeding things up, we copy filenames to the
116 -struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
117 +struct dentry * lookup_one_len_it(const char * name, struct dentry * base,
118 + int len, struct lookup_intent *it)
122 @@ -927,11 +930,16 @@
124 this.hash = end_name_hash(hash);
126 - return lookup_hash_it(&this, base, NULL, NULL);
127 + return lookup_hash_it(&this, base, NULL, it);
129 return ERR_PTR(-EACCES);
132 +struct dentry * lookup_one_len(const char * name, struct dentry * base, int len)
134 + return lookup_one_len_it(name, base, len, NULL);
140 Index: lum/fs/nfsd/export.c
141 ===================================================================
142 --- lum.orig/fs/nfsd/export.c 2003-11-28 13:26:21.000000000 -0500
143 +++ lum/fs/nfsd/export.c 2004-06-07 17:25:22.000000000 -0400
145 inode = nd.dentry->d_inode;
148 + if ((inode->i_sb->s_type->fs_flags & FS_NFSEXP_FSID) &&
149 + !(nxp->ex_flags & NFSEXP_FSID)) {
150 + nxp->ex_dev = inode->i_sb->s_dev;
151 + nxp->ex_flags |= NFSEXP_FSID;
155 exp = exp_get(clp, dev, ino);
156 Index: lum/fs/nfsd/nfsfh.c
157 ===================================================================
158 --- lum.orig/fs/nfsd/nfsfh.c 2003-11-28 13:26:21.000000000 -0500
159 +++ lum/fs/nfsd/nfsfh.c 2004-06-07 17:51:58.000000000 -0400
161 int sequence; /* sequence counter */
164 +static struct dentry *lookup_it(struct inode *inode, struct dentry * dentry)
166 + if (inode->i_op->lookup_it)
167 + return inode->i_op->lookup_it(inode, dentry, NULL, NULL, 0);
169 + return inode->i_op->lookup(inode, dentry);
174 * A rather strange filldir function to capture
175 * the name matching the specified inode number.
179 struct nfsd_getdents_callback buffer;
180 + struct lookup_intent it;
181 + struct file *filp = NULL;
184 if (!dir || !S_ISDIR(dir->i_mode))
187 * Open the directory ...
189 - error = init_private_file(&file, dentry, FMODE_READ);
191 + if (dentry->d_op && dentry->d_op->d_revalidate_it) {
192 + if ((dentry->d_flags & DCACHE_NFSD_DISCONNECTED) &&
193 + (dentry->d_parent == dentry) ) {
194 + it.it_op_release = NULL;
196 + * XXX Temporary Hack: Simulating init_private_file without
197 + * f_op->open for disconnected dentry Since we don't have actual
198 + * dentry->d_name to revalidate in revalidate_it()
201 + memset(filp, 0, sizeof(*filp));
202 + filp->f_mode = FMODE_READ;
203 + atomic_set(&filp->f_count, 1);
204 + filp->f_dentry = dentry;
205 + filp->f_uid = current->fsuid;
206 + filp->f_gid = current->fsgid;
207 + filp->f_op = dentry->d_inode->i_fop;
210 + intent_init(&it, IT_OPEN, 0);
211 + error = revalidate_it(dentry, &it);
214 + error = init_private_file_it(&file, dentry, FMODE_READ, &it);
217 + error = init_private_file_it(&file, dentry, FMODE_READ, NULL);
223 if (!file.f_op->readdir)
229 - if (file.f_op->release)
230 + if (file.f_op->release && !filp)
231 file.f_op->release(dir, &file);
233 + if (dentry->d_op &&
234 + dentry->d_op->d_revalidate_it &&
235 + it.it_op_release && !filp)
236 + intent_release(&it);
241 * it is well connected. But nobody returns different dentrys do they?
243 down(&child->d_inode->i_sem);
244 - pdentry = child->d_inode->i_op->lookup(child->d_inode, tdentry);
245 + pdentry = lookup_it(child->d_inode, tdentry);
246 up(&child->d_inode->i_sem);
247 d_drop(tdentry); /* we never want ".." hashed */
248 if (!pdentry && tdentry->d_inode == NULL) {
250 pdentry->d_flags |= DCACHE_NFSD_DISCONNECTED;
251 pdentry->d_op = child->d_op;
253 + if (child->d_op && child->d_op->d_revalidate_it)
254 + pdentry->d_op = child->d_op;
257 pdentry = ERR_PTR(-ENOMEM);
259 struct dentry *pdentry;
260 struct inode *parent;
262 + if (result->d_op && result->d_op->d_revalidate_it)
263 + dentry->d_op = result->d_op;
264 pdentry = nfsd_findparent(dentry);
265 err = PTR_ERR(pdentry);
269 inode = dentry->d_inode;
271 + /* cache coherency for non-device filesystems */
272 + if (inode->i_op && inode->i_op->revalidate_it) {
273 + inode->i_op->revalidate_it(dentry, NULL);
276 /* Type check. The correct error return for type mismatches
277 * does not seem to be generally agreed upon. SunOS seems to
278 * use EISDIR if file isn't S_IFREG; a comment in the NFSv3
280 dentry->d_parent->d_name.name, dentry->d_name.name);
283 - printk(KERN_ERR "fh_update: %s/%s already up-to-date!\n",
284 - dentry->d_parent->d_name.name, dentry->d_name.name);
285 + if(!dentry->d_parent->d_inode->i_op->mkdir_raw)
286 + printk(KERN_ERR "fh_update: %s/%s already up-to-date!\n",
287 + dentry->d_parent->d_name.name, dentry->d_name.name);
291 Index: lum/fs/nfsd/vfs.c
292 ===================================================================
293 --- lum.orig/fs/nfsd/vfs.c 2003-11-28 13:26:21.000000000 -0500
294 +++ lum/fs/nfsd/vfs.c 2004-06-07 17:25:22.000000000 -0400
296 static struct raparms * raparml;
297 static struct raparms * raparm_cache;
299 +static int link_raw(struct dentry *dold, struct dentry *ddir,
300 + struct dentry *dnew)
304 + struct nameidata old_nd = { .dentry = dold };
305 + struct nameidata nd = { .dentry = ddir, .last = dnew->d_name };
306 + struct inode_operations *op = nd.dentry->d_inode->i_op;
307 + err = op->link_raw(&old_nd, &nd);
308 + d_instantiate(dnew, dold->d_inode);
309 + if(dold->d_inode->i_op && dold->d_inode->i_op->revalidate_it)
310 + dold->d_inode->i_op->revalidate_it(dnew, NULL);
315 +static int unlink_raw(struct dentry *dentry, char *fname, int flen,
316 + struct dentry *rdentry)
319 + struct qstr last = { .name = fname, .len = flen };
320 + struct nameidata nd = { .dentry = dentry, .last = last };
321 + struct inode_operations *op = nd.dentry->d_inode->i_op;
322 + err = op->unlink_raw(&nd);
329 +static int rmdir_raw(struct dentry *dentry, char *fname, int flen,
330 + struct dentry *rdentry)
333 + struct qstr last = { .name = fname, .len = flen };
334 + struct nameidata nd = { .dentry = dentry, .last = last };
335 + struct inode_operations *op = nd.dentry->d_inode->i_op;
336 + err = op->rmdir_raw(&nd);
338 + rdentry->d_inode->i_flags |= S_DEAD;
345 +static int symlink_raw(struct dentry *dentry, char *fname, int flen,
349 + struct qstr last = { .name = fname, .len = flen };
350 + struct nameidata nd = { .dentry = dentry, .last = last };
351 + struct inode_operations *op = nd.dentry->d_inode->i_op;
352 + err = op->symlink_raw(&nd, path);
357 +static int mkdir_raw(struct dentry *dentry, char *fname, int flen, int mode)
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->mkdir_raw(&nd, mode);
368 +static int mknod_raw(struct dentry *dentry, char *fname, int flen, int mode,
372 + struct qstr last = { .name = fname, .len = flen };
373 + struct nameidata nd = { .dentry = dentry, .last = last };
374 + struct inode_operations *op = nd.dentry->d_inode->i_op;
375 + err = op->mknod_raw(&nd, mode, dev);
380 +static int rename_raw(struct dentry *fdentry, struct dentry *tdentry,
381 + struct dentry *odentry, struct dentry *ndentry)
385 + struct nameidata old_nd = { .dentry = fdentry, .last = odentry->d_name};
386 + struct nameidata new_nd = { .dentry = tdentry, .last = ndentry->d_name};
387 + struct inode_operations *op = old_nd.dentry->d_inode->i_op;
388 + err = op->rename_raw(&old_nd, &new_nd);
389 + d_move(odentry, ndentry);
394 +static int setattr_raw(struct inode *inode, struct iattr *iap)
398 + iap->ia_valid |= ATTR_RAW;
399 + err = inode->i_op->setattr_raw(inode, iap);
404 +int revalidate_it(struct dentry *dentry, struct lookup_intent *it)
408 + if (dentry && dentry->d_op && dentry->d_op->d_revalidate_it) {
409 + if (!dentry->d_op->d_revalidate_it(dentry, 0, NULL, it) &&
410 + !d_invalidate(dentry)) {
422 * Look up one component of a pathname.
423 * N.B. After this call _both_ fhp and resfh need an fh_put
426 err = nfserr_notsync;
427 if (!check_guard || guardtime == inode->i_ctime) {
428 - err = notify_change(dentry, iap);
429 + if ( dentry->d_inode->i_op && dentry->d_inode->i_op->setattr_raw)
430 + err = setattr_raw(dentry->d_inode, iap);
432 + err = notify_change(dentry, iap);
438 struct dentry *dentry;
440 + struct lookup_intent it;
443 /* If we get here, then the client has already done an "open", and (hopefully)
445 filp->f_mode = FMODE_READ;
448 + intent_init(&it, IT_OPEN, (filp->f_flags & ~O_ACCMODE) | filp->f_mode);
450 + err = revalidate_it(dentry, &it);
457 if (filp->f_op && filp->f_op->open) {
458 err = filp->f_op->open(inode, filp);
460 atomic_dec(&filp->f_count);
465 + if (it.it_op_release)
466 + intent_release(&it);
473 struct dentry *dentry, *dchild;
476 + int err, error = -EOPNOTSUPP;
480 @@ -836,20 +974,44 @@
481 dentry = fhp->fh_dentry;
482 dirp = dentry->d_inode;
486 + if (dirp->i_op->mkdir_raw)
487 + error = mkdir_raw(dentry, fname, flen, iap->ia_mode);
494 + if (dirp->i_op->mknod_raw) {
495 + if (type == S_IFREG)
497 + error = mknod_raw(dentry, fname, flen, iap->ia_mode, rdev);
501 + printk("nfsd: bad file type %o in nfsd_create\n", type);
505 - if(!dirp->i_op || !dirp->i_op->lookup)
506 + if(!dirp->i_op || !(dirp->i_op->lookup || dirp->i_op->lookup_it))
509 * Check whether the response file handle has been verified yet.
510 * If it has, the parent directory should already be locked.
512 - if (!resfhp->fh_dentry) {
513 - /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create */
515 + if (!resfhp->fh_dentry || dirp->i_op->lookup_it) {
516 + /* called from nfsd_proc_mkdir, or possibly nfsd3_proc_create
517 + and nfsd_proc_create in case of lustre
519 + if (!resfhp->fh_dentry)
521 dchild = lookup_one_len(fname, dentry, flen);
522 err = PTR_ERR(dchild);
525 + resfhp->fh_dentry = NULL;
526 err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
529 @@ -870,10 +1032,12 @@
530 * Make sure the child dentry is still negative ...
533 - if (dchild->d_inode) {
534 - dprintk("nfsd_create: dentry %s/%s not negative!\n",
535 - dentry->d_name.name, dchild->d_name.name);
537 + if ( error == -EOPNOTSUPP) {
538 + if (dchild->d_inode) {
539 + dprintk("nfsd_create: dentry %s/%s not negative!\n",
540 + dentry->d_name.name, dchild->d_name.name);
545 if (!(iap->ia_valid & ATTR_MODE))
546 @@ -886,16 +1050,19 @@
550 - err = vfs_create(dirp, dchild, iap->ia_mode);
551 + if (error == -EOPNOTSUPP)
552 + err = vfs_create(dirp, dchild, iap->ia_mode);
555 - err = vfs_mkdir(dirp, dchild, iap->ia_mode);
556 + if (error == -EOPNOTSUPP)
557 + err = vfs_mkdir(dirp, dchild, iap->ia_mode);
563 - err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
564 + if (error == -EOPNOTSUPP)
565 + err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
568 printk("nfsd: bad file type %o in nfsd_create\n", type);
569 @@ -964,7 +1131,13 @@
570 /* Get all the sanity checks out of the way before
571 * we lock the parent. */
573 - if(!dirp->i_op || !dirp->i_op->lookup)
574 + if (dirp->i_op->mknod_raw) {
575 + err = mknod_raw(dentry, fname, flen, iap->ia_mode, 0);
576 + if (err && err != -EOPNOTSUPP)
580 + if(!dirp->i_op || !(dirp->i_op->lookup || dirp->i_op->lookup_it))
584 @@ -1015,6 +1188,8 @@
585 case NFS3_CREATE_GUARDED:
588 + if(dirp->i_op->mknod_raw)
593 @@ -1121,7 +1296,7 @@
596 struct dentry *dentry, *dnew;
598 + int err, cerr, error = -EOPNOTSUPP;
602 @@ -1135,12 +1310,18 @@
605 dentry = fhp->fh_dentry;
607 + if (dentry->d_inode->i_op->symlink_raw)
608 + error = symlink_raw(dentry, fname, flen, path);
610 dnew = lookup_one_len(fname, dentry, flen);
615 - err = vfs_symlink(dentry->d_inode, dnew, path);
617 + if (err == -EOPNOTSUPP || !dentry->d_inode->i_op->symlink_raw)
618 + err = vfs_symlink(dentry->d_inode, dnew, path);
620 if (EX_ISSYNC(fhp->fh_export))
621 nfsd_sync_dir(dentry);
622 @@ -1150,7 +1331,10 @@
623 iap->ia_valid |= ATTR_CTIME;
624 iap->ia_mode = (iap->ia_mode&S_IALLUGO)
626 - err = notify_change(dnew, iap);
627 + if (dnew->d_inode->i_op && dnew->d_inode->i_op->setattr_raw)
628 + err = setattr_raw(dnew->d_inode, iap);
630 + err = notify_change(dnew, iap);
633 else if (EX_ISSYNC(fhp->fh_export))
634 @@ -1210,7 +1394,10 @@
635 dold = tfhp->fh_dentry;
636 dest = dold->d_inode;
638 - err = vfs_link(dold, dirp, dnew);
639 + if (dirp->i_op->link_raw)
640 + err = link_raw(dold, ddir, dnew);
642 + err = vfs_link(dold, dirp, dnew);
644 if (EX_ISSYNC(ffhp->fh_export)) {
646 @@ -1295,7 +1482,10 @@
650 - err = vfs_rename(fdir, odentry, tdir, ndentry);
651 + if(fdir->i_op->rename_raw)
652 + err = rename_raw(fdentry, tdentry, odentry, ndentry);
654 + err = vfs_rename(fdir, odentry, tdir, ndentry);
655 if (!err && EX_ISSYNC(tfhp->fh_export)) {
656 nfsd_sync_dir(tdentry);
657 nfsd_sync_dir(fdentry);
658 @@ -1316,7 +1506,7 @@
660 double_up(&tdir->i_sem, &fdir->i_sem);
661 ffhp->fh_locked = tfhp->fh_locked = 0;
667 @@ -1362,9 +1552,15 @@
671 - err = vfs_unlink(dirp, rdentry);
672 + if (dirp->i_op->unlink_raw)
673 + err = unlink_raw(dentry, fname, flen, rdentry);
675 + err = vfs_unlink(dirp, rdentry);
676 } else { /* It's RMDIR */
677 - err = vfs_rmdir(dirp, rdentry);
678 + if (dirp->i_op->rmdir_raw)
679 + err = rmdir_raw(dentry, fname, flen, rdentry);
681 + err = vfs_rmdir(dirp, rdentry);
685 Index: lum/include/linux/fs.h
686 ===================================================================
687 --- lum.orig/include/linux/fs.h 2004-06-07 17:25:22.000000000 -0400
688 +++ lum/include/linux/fs.h 2004-06-07 17:25:22.000000000 -0400
690 #define FS_SINGLE 8 /* Filesystem that can have only one superblock */
691 #define FS_NOMOUNT 16 /* Never mount from userland */
692 #define FS_LITTER 32 /* Keeps the tree in dcache */
693 +#define FS_NFSEXP_FSID 64 /* Use file system specific fsid for
694 + * exporting non device filesystems.
696 #define FS_ODD_RENAME 32768 /* Temporary stuff; will go away as soon
697 * as nfs_rename() will be cleaned up
699 @@ -1122,6 +1125,9 @@
700 struct nameidata *nd, struct lookup_intent *it);
701 extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
702 int flags, struct lookup_intent *it);
703 +extern int revalidate_it(struct dentry *dentry, struct lookup_intent *it);
704 +extern int init_private_file_it(struct file *, struct dentry *dentry, int mode,
705 + struct lookup_intent *it);
706 extern int filp_close(struct file *, fl_owner_t id);
707 extern char * getname(const char *);
709 @@ -1419,6 +1425,8 @@
710 extern int follow_down(struct vfsmount **, struct dentry **);
711 extern int follow_up(struct vfsmount **, struct dentry **);
712 extern struct dentry * lookup_one_len(const char *, struct dentry *, int);
713 +extern struct dentry * lookup_one_len_it(const char *, struct dentry *, int,
714 + struct lookup_intent *);
715 extern struct dentry * lookup_hash(struct qstr *, struct dentry *, struct nameidata *);
716 #define user_path_walk(name,nd) __user_walk(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, nd)
717 #define user_path_walk_link(name,nd) __user_walk(name, LOOKUP_POSITIVE, nd)
718 @@ -1434,6 +1442,8 @@
720 typedef int (*find_inode_t)(struct inode *, unsigned long, void *);
721 extern struct inode * iget4(struct super_block *, unsigned long, find_inode_t, void *);
722 +extern struct inode * ilookup4(struct super_block *, unsigned long,
723 + find_inode_t, void *);
724 static inline struct inode *iget(struct super_block *sb, unsigned long ino)
726 return iget4(sb, ino, NULL, NULL);
727 Index: lum/kernel/ksyms.c
728 ===================================================================
729 --- lum.orig/kernel/ksyms.c 2004-06-07 17:25:22.000000000 -0400
730 +++ lum/kernel/ksyms.c 2004-06-07 17:25:22.000000000 -0400
732 EXPORT_SYMBOL(iunique);
733 EXPORT_SYMBOL(ilookup);
734 EXPORT_SYMBOL(iget4);
735 +EXPORT_SYMBOL(ilookup4);
737 EXPORT_SYMBOL(inode_init_once);
738 EXPORT_SYMBOL(force_delete);
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 EXPORT_SYMBOL(sys_close);
746 EXPORT_SYMBOL(dcache_lock);