From c4cc53fd34883363b972b06078411a42682d1f50 Mon Sep 17 00:00:00 2001 From: braam Date: Thu, 20 Jun 2002 16:46:11 +0000 Subject: [PATCH] Bring stock kernel 2.4.18 intent patch up to date. - with this patch the intent-test passes on user mode linux --- lustre/patches/patch-2.4.18 | 268 +++++++++++++++++++++++++++++++------------- 1 file changed, 192 insertions(+), 76 deletions(-) diff --git a/lustre/patches/patch-2.4.18 b/lustre/patches/patch-2.4.18 index 2540c4c..4325799 100644 --- a/lustre/patches/patch-2.4.18 +++ b/lustre/patches/patch-2.4.18 @@ -396,7 +396,7 @@ #endif /* _I386_PAGE_H */ --- lum-pristine/include/linux/blkdev.h Mon Nov 26 06:29:17 2001 -+++ lum/include/linux/blkdev.h Sat Jun 15 00:34:24 2002 ++++ lum/include/linux/blkdev.h Thu Jun 20 10:18:40 2002 @@ -228,4 +228,8 @@ return retval; } @@ -407,7 +407,7 @@ +void dev_clear_rdonly(int); #endif --- lum-pristine/include/linux/slab.h Fri Dec 21 10:42:04 2001 -+++ lum/include/linux/slab.h Sat Jun 15 00:34:24 2002 ++++ lum/include/linux/slab.h Thu Jun 20 10:18:35 2002 @@ -57,6 +57,7 @@ extern int kmem_cache_shrink(kmem_cache_t *); extern void *kmem_cache_alloc(kmem_cache_t *, int); @@ -417,7 +417,7 @@ extern void *kmalloc(size_t, int); extern void kfree(const void *); --- lum-pristine/include/linux/jbd.h Mon Feb 25 12:38:13 2002 -+++ lum/include/linux/jbd.h Sat Jun 15 00:36:15 2002 ++++ lum/include/linux/jbd.h Thu Jun 20 10:19:02 2002 @@ -249,6 +249,13 @@ return bh->b_private; } @@ -480,8 +480,8 @@ EXPORT_SYMBOL(default_llseek); EXPORT_SYMBOL(dentry_open); --- lum-pristine/include/linux/dcache.h Thu Nov 22 12:46:18 2001 -+++ lum/include/linux/dcache.h Fri Jun 14 16:50:42 2002 -@@ -6,6 +6,31 @@ ++++ lum/include/linux/dcache.h Thu Jun 20 10:18:35 2002 +@@ -6,6 +6,32 @@ #include #include @@ -498,6 +498,7 @@ +#define IT_GETATTR (1<<10) +#define IT_SETATTR (1<<11) +#define IT_READLINK (1<<12) ++#define IT_MKNOD (1<<13) + +struct lookup_intent { + int it_op; @@ -513,7 +514,7 @@ /* * linux/include/linux/dcache.h * -@@ -79,17 +104,20 @@ +@@ -79,17 +105,20 @@ struct dentry_operations *d_op; struct super_block * d_sb; /* The root of the dentry tree */ unsigned long d_vfs_flags; @@ -535,7 +536,7 @@ /* the dentry parameter passed to d_hash and d_compare is the parent --- lum-pristine/include/linux/fs.h Thu Jun 13 14:07:26 2002 -+++ lum/include/linux/fs.h Sat Jun 15 00:34:24 2002 ++++ lum/include/linux/fs.h Thu Jun 20 10:18:35 2002 @@ -536,6 +536,7 @@ /* needed for tty driver, and maybe others */ @@ -590,7 +591,7 @@ extern void iput(struct inode *); extern void force_delete(struct inode *); --- lum-pristine/fs/namei.c Mon Feb 25 12:38:09 2002 -+++ lum/fs/namei.c Wed Jun 12 19:18:36 2002 ++++ lum/fs/namei.c Thu Jun 20 10:16:35 2002 @@ -94,6 +94,14 @@ * XEmacs seems to be relying on it... */ @@ -710,7 +711,20 @@ break; } goto return_base; -@@ -636,12 +662,24 @@ +@@ -626,6 +652,7 @@ + else if (this.len == 2 && this.name[1] == '.') + nd->last_type = LAST_DOTDOT; + return_base: ++ nd->dentry->d_it = it; + return 0; + out_dput: + dput(dentry); +@@ -633,15 +660,29 @@ + } + path_release(nd); + return_err: ++ if (!err) ++ nd->dentry->d_it = it; return err; } @@ -736,7 +750,7 @@ /* SMP-safe */ /* returns 1 if everything is done */ static int __emul_lookup_dentry(const char *name, struct nameidata *nd) -@@ -742,7 +780,8 @@ +@@ -742,7 +783,8 @@ * needs parent already locked. Doesn't follow mounts. * SMP-safe. */ @@ -746,7 +760,7 @@ { struct dentry * dentry; struct inode *inode; -@@ -765,13 +804,16 @@ +@@ -765,13 +807,16 @@ goto out; } @@ -764,7 +778,7 @@ dentry = inode->i_op->lookup(inode, new); unlock_kernel(); if (!dentry) -@@ -783,6 +825,12 @@ +@@ -783,6 +828,12 @@ return dentry; } @@ -777,7 +791,7 @@ /* SMP-safe */ struct dentry * lookup_one_len(const char * name, struct dentry * base, int len) { -@@ -804,7 +852,7 @@ +@@ -804,7 +855,7 @@ } this.hash = end_name_hash(hash); @@ -786,7 +800,7 @@ access: return ERR_PTR(-EACCES); } -@@ -836,6 +884,22 @@ +@@ -836,6 +887,22 @@ return err; } @@ -809,7 +823,7 @@ /* * It's inline, so penalty for filesystems that don't use sticky bit is * minimal. -@@ -970,7 +1034,8 @@ +@@ -970,7 +1037,8 @@ * for symlinks (where the permissions are checked later). * SMP-safe */ @@ -819,7 +833,7 @@ { int acc_mode, error = 0; struct inode *inode; -@@ -984,8 +1049,9 @@ +@@ -984,17 +1052,21 @@ * The simplest case - just a plain lookup. */ if (!(flag & O_CREAT)) { @@ -830,7 +844,10 @@ if (error) return error; dentry = nd->dentry; -@@ -995,6 +1061,8 @@ ++ dentry->d_it = it; + goto ok; + } + /* * Create - we need to know the parent. */ @@ -839,7 +856,7 @@ if (path_init(pathname, LOOKUP_PARENT, nd)) error = path_walk(pathname, nd); if (error) -@@ -1011,7 +1079,7 @@ +@@ -1011,7 +1083,7 @@ dir = nd->dentry; down(&dir->d_inode->i_sem); @@ -848,15 +865,27 @@ do_last: error = PTR_ERR(dentry); -@@ -1022,6 +1090,7 @@ +@@ -1020,6 +1092,7 @@ + goto exit; + } ++ dentry->d_it = it; /* Negative dentry, just create the file */ if (!dentry->d_inode) { -+ dentry->d_it = it; error = vfs_create(dir->d_inode, dentry, - mode & ~current->fs->umask); - up(&dir->d_inode->i_sem); -@@ -1181,13 +1250,20 @@ +@@ -1136,9 +1209,11 @@ + if (flag & FMODE_WRITE) + DQUOT_INIT(inode); + ++ intent_release(dentry); + return 0; + + exit_dput: ++ intent_release(dentry); + dput(dentry); + exit: + path_release(nd); +@@ -1181,13 +1256,20 @@ } dir = nd->dentry; down(&dir->d_inode->i_sem); @@ -879,7 +908,7 @@ { struct dentry *dentry; -@@ -1195,7 +1271,7 @@ +@@ -1195,7 +1277,7 @@ dentry = ERR_PTR(-EEXIST); if (nd->last_type != LAST_NORM) goto fail; @@ -888,15 +917,15 @@ if (IS_ERR(dentry)) goto fail; if (!is_dir && nd->last.name[nd->last.len] && !dentry->d_inode) -@@ -1241,6 +1317,7 @@ +@@ -1241,6 +1323,7 @@ char * tmp; struct dentry * dentry; struct nameidata nd; -+ struct lookup_intent it = { IT_CREAT , mode }; ++ struct lookup_intent it = { IT_MKNOD , mode }; if (S_ISDIR(mode)) return -EPERM; -@@ -1252,11 +1329,12 @@ +@@ -1252,11 +1335,12 @@ error = path_walk(tmp, &nd); if (error) goto out; @@ -910,7 +939,7 @@ switch (mode & S_IFMT) { case 0: case S_IFREG: error = vfs_create(nd.dentry->d_inode,dentry,mode); -@@ -1272,6 +1350,7 @@ +@@ -1272,6 +1356,7 @@ } dput(dentry); } @@ -918,7 +947,7 @@ up(&nd.dentry->d_inode->i_sem); path_release(&nd); out: -@@ -1310,6 +1389,7 @@ +@@ -1310,6 +1395,7 @@ { int error = 0; char * tmp; @@ -926,7 +955,7 @@ tmp = getname(pathname); error = PTR_ERR(tmp); -@@ -1321,13 +1401,15 @@ +@@ -1321,13 +1407,15 @@ error = path_walk(tmp, &nd); if (error) goto out; @@ -943,7 +972,7 @@ up(&nd.dentry->d_inode->i_sem); path_release(&nd); out: -@@ -1407,6 +1489,7 @@ +@@ -1407,6 +1495,7 @@ char * name; struct dentry *dentry; struct nameidata nd; @@ -951,7 +980,7 @@ name = getname(pathname); if(IS_ERR(name)) -@@ -1429,10 +1512,12 @@ +@@ -1429,10 +1518,12 @@ goto exit1; } down(&nd.dentry->d_inode->i_sem); @@ -965,7 +994,7 @@ dput(dentry); } up(&nd.dentry->d_inode->i_sem); -@@ -1476,6 +1561,7 @@ +@@ -1476,6 +1567,7 @@ char * name; struct dentry *dentry; struct nameidata nd; @@ -973,7 +1002,7 @@ name = getname(pathname); if(IS_ERR(name)) -@@ -1489,14 +1575,16 @@ +@@ -1489,14 +1581,16 @@ if (nd.last_type != LAST_NORM) goto exit1; down(&nd.dentry->d_inode->i_sem); @@ -991,7 +1020,7 @@ dput(dentry); } up(&nd.dentry->d_inode->i_sem); -@@ -1543,6 +1631,7 @@ +@@ -1543,6 +1637,7 @@ int error = 0; char * from; char * to; @@ -999,7 +1028,7 @@ from = getname(oldname); if(IS_ERR(from)) -@@ -1557,12 +1646,14 @@ +@@ -1557,12 +1652,14 @@ error = path_walk(to, &nd); if (error) goto out; @@ -1015,7 +1044,7 @@ up(&nd.dentry->d_inode->i_sem); path_release(&nd); out: -@@ -1626,6 +1717,7 @@ +@@ -1626,6 +1723,7 @@ int error; char * from; char * to; @@ -1023,7 +1052,7 @@ from = getname(oldname); if(IS_ERR(from)) -@@ -1648,12 +1740,14 @@ +@@ -1648,12 +1746,14 @@ error = -EXDEV; if (old_nd.mnt != nd.mnt) goto out_release; @@ -1039,7 +1068,7 @@ up(&nd.dentry->d_inode->i_sem); out_release: path_release(&nd); -@@ -1694,7 +1788,8 @@ +@@ -1694,7 +1794,8 @@ * locking]. */ int vfs_rename_dir(struct inode *old_dir, struct dentry *old_dentry, @@ -1049,7 +1078,7 @@ { int error; struct inode *target; -@@ -1748,12 +1843,14 @@ +@@ -1748,12 +1849,14 @@ } else double_down(&old_dir->i_zombie, &new_dir->i_zombie); @@ -1064,7 +1093,7 @@ if (target) { if (!error) target->i_flags |= S_DEAD; -@@ -1775,7 +1872,8 @@ +@@ -1775,7 +1878,8 @@ } int vfs_rename_other(struct inode *old_dir, struct dentry *old_dentry, @@ -1074,7 +1103,7 @@ { int error; -@@ -1802,10 +1900,12 @@ +@@ -1802,10 +1906,12 @@ DQUOT_INIT(old_dir); DQUOT_INIT(new_dir); double_down(&old_dir->i_zombie, &new_dir->i_zombie); @@ -1087,7 +1116,7 @@ double_up(&old_dir->i_zombie, &new_dir->i_zombie); if (error) return error; -@@ -1817,13 +1917,14 @@ +@@ -1817,13 +1923,14 @@ } int vfs_rename(struct inode *old_dir, struct dentry *old_dentry, @@ -1105,7 +1134,7 @@ if (!error) { if (old_dir == new_dir) inode_dir_notify(old_dir, DN_RENAME); -@@ -1841,6 +1942,7 @@ +@@ -1841,6 +1948,7 @@ struct dentry * old_dir, * new_dir; struct dentry * old_dentry, *new_dentry; struct nameidata oldnd, newnd; @@ -1113,7 +1142,7 @@ if (path_init(oldname, LOOKUP_PARENT, &oldnd)) error = path_walk(oldname, &oldnd); -@@ -1868,7 +1970,9 @@ +@@ -1868,7 +1976,9 @@ double_lock(new_dir, old_dir); @@ -1124,7 +1153,7 @@ error = PTR_ERR(old_dentry); if (IS_ERR(old_dentry)) goto exit3; -@@ -1884,14 +1988,15 @@ +@@ -1884,14 +1994,15 @@ if (newnd.last.name[newnd.last.len]) goto exit4; } @@ -1143,7 +1172,7 @@ dput(new_dentry); --- lum-pristine/fs/open.c Fri Oct 12 14:48:42 2001 -+++ lum/fs/open.c Fri Jun 7 12:49:14 2002 ++++ lum/fs/open.c Thu Jun 20 10:14:37 2002 @@ -19,6 +19,8 @@ #include @@ -1241,7 +1270,7 @@ if (mode & ~S_IRWXO) /* where's F_OK, X_OK, W_OK, R_OK? */ return -EINVAL; -@@ -339,7 +360,7 @@ +@@ -339,13 +360,14 @@ else current->cap_effective = current->cap_permitted; @@ -1250,7 +1279,14 @@ if (!res) { res = permission(nd.dentry->d_inode, mode); /* SuS v2 requires we report a read only fs too */ -@@ -361,6 +382,9 @@ + if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) + && !special_file(nd.dentry->d_inode->i_mode)) + res = -EROFS; ++ intent_release(nd.dentry); + path_release(&nd); + } + +@@ -361,6 +383,9 @@ int error; struct nameidata nd; char *name; @@ -1260,7 +1296,7 @@ name = getname(filename); error = PTR_ERR(name); -@@ -369,11 +393,12 @@ +@@ -369,11 +394,12 @@ error = 0; if (path_init(name,LOOKUP_POSITIVE|LOOKUP_FOLLOW|LOOKUP_DIRECTORY,&nd)) @@ -1274,7 +1310,7 @@ error = permission(nd.dentry->d_inode,MAY_EXEC); if (error) goto dput_and_out; -@@ -381,6 +406,7 @@ +@@ -381,6 +407,7 @@ set_fs_pwd(current->fs, nd.mnt, nd.dentry); dput_and_out: @@ -1282,7 +1318,7 @@ path_release(&nd); out: return error; -@@ -421,6 +447,9 @@ +@@ -421,6 +448,9 @@ int error; struct nameidata nd; char *name; @@ -1292,7 +1328,7 @@ name = getname(filename); error = PTR_ERR(name); -@@ -429,11 +458,12 @@ +@@ -429,11 +459,12 @@ path_init(name, LOOKUP_POSITIVE | LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd); @@ -1306,7 +1342,7 @@ error = permission(nd.dentry->d_inode,MAY_EXEC); if (error) goto dput_and_out; -@@ -446,6 +476,7 @@ +@@ -446,6 +477,7 @@ set_fs_altroot(); error = 0; dput_and_out: @@ -1314,7 +1350,7 @@ path_release(&nd); out: return error; -@@ -490,12 +521,15 @@ +@@ -490,12 +522,15 @@ struct inode * inode; int error; struct iattr newattrs; @@ -1331,7 +1367,7 @@ error = -EROFS; if (IS_RDONLY(inode)) goto dput_and_out; -@@ -511,6 +545,7 @@ +@@ -511,6 +546,7 @@ error = notify_change(nd.dentry, &newattrs); dput_and_out: @@ -1339,7 +1375,7 @@ path_release(&nd); out: return error; -@@ -580,10 +615,15 @@ +@@ -580,10 +616,15 @@ { struct nameidata nd; int error; @@ -1356,7 +1392,7 @@ path_release(&nd); } return error; -@@ -593,10 +633,15 @@ +@@ -593,10 +634,15 @@ { struct nameidata nd; int error; @@ -1373,7 +1409,7 @@ path_release(&nd); } return error; -@@ -630,10 +675,15 @@ +@@ -630,10 +676,15 @@ * for the internal routines (ie open_namei()/follow_link() etc). 00 is * used by symlinks. */ @@ -1389,7 +1425,7 @@ namei_flags = flags; if ((namei_flags+1) & O_ACCMODE) -@@ -641,14 +691,14 @@ +@@ -641,14 +692,14 @@ if (namei_flags & O_TRUNC) namei_flags |= 2; @@ -1407,7 +1443,7 @@ { struct file * f; struct inode *inode; -@@ -690,6 +740,7 @@ +@@ -690,6 +741,7 @@ goto cleanup_all; } f->f_flags &= ~(O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC); @@ -1415,7 +1451,13 @@ return f; -@@ -710,6 +761,13 @@ +@@ -705,11 +757,19 @@ + cleanup_file: + put_filp(f); + cleanup_dentry: ++ intent_release(dentry); + dput(dentry); + mntput(mnt); return ERR_PTR(error); } @@ -1430,8 +1472,76 @@ * Find an empty file descriptor entry, and mark it busy. */ --- lum-pristine/fs/stat.c Thu Sep 13 17:04:43 2001 -+++ lum/fs/stat.c Fri Jun 7 12:49:14 2002 -@@ -247,14 +247,16 @@ ++++ lum/fs/stat.c Thu Jun 20 10:13:18 2002 +@@ -135,13 +135,15 @@ + asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf) + { + struct nameidata nd; ++ struct lookup_intent it = {IT_GETATTR, 0}; + int error; + +- error = user_path_walk(filename, &nd); ++ error = user_path_walk_it(filename, &nd, &it); + if (!error) { + error = do_revalidate(nd.dentry); + if (!error) + error = cp_old_stat(nd.dentry->d_inode, statbuf); ++ intent_release(nd.dentry); + path_release(&nd); + } + return error; +@@ -151,13 +153,15 @@ + asmlinkage long sys_newstat(char * filename, struct stat * statbuf) + { + struct nameidata nd; ++ struct lookup_intent it = {IT_GETATTR, 0}; + int error; + +- error = user_path_walk(filename, &nd); ++ error = user_path_walk_it(filename, &nd, &it); + if (!error) { + error = do_revalidate(nd.dentry); + if (!error) + error = cp_new_stat(nd.dentry->d_inode, statbuf); ++ intent_release(nd.dentry); + path_release(&nd); + } + return error; +@@ -172,13 +176,15 @@ + asmlinkage long sys_lstat(char * filename, struct __old_kernel_stat * statbuf) + { + struct nameidata nd; ++ struct lookup_intent it = {IT_GETATTR, 0}; + int error; + +- error = user_path_walk_link(filename, &nd); ++ error = user_path_walk_link_it(filename, &nd, &it); + if (!error) { + error = do_revalidate(nd.dentry); + if (!error) + error = cp_old_stat(nd.dentry->d_inode, statbuf); ++ intent_release(nd.dentry); + path_release(&nd); + } + return error; +@@ -189,13 +195,15 @@ + asmlinkage long sys_newlstat(char * filename, struct stat * statbuf) + { + struct nameidata nd; ++ struct lookup_intent it = {IT_GETATTR, 0}; + int error; + +- error = user_path_walk_link(filename, &nd); ++ error = user_path_walk_link_it(filename, &nd, &it); + if (!error) { + error = do_revalidate(nd.dentry); + if (!error) + error = cp_new_stat(nd.dentry->d_inode, statbuf); ++ intent_release(nd.dentry); + path_release(&nd); + } + return error; +@@ -247,20 +255,22 @@ { struct nameidata nd; int error; @@ -1446,11 +1556,17 @@ if (!error) { struct inode * inode = nd.dentry->d_inode; - -+ nd.dentry->d_it = ⁢ error = -EINVAL; if (inode->i_op && inode->i_op->readlink && !(error = do_revalidate(nd.dentry))) { -@@ -333,9 +335,12 @@ + UPDATE_ATIME(inode); + error = inode->i_op->readlink(nd.dentry, buf, bufsiz); + } ++ intent_release(nd.dentry); + path_release(&nd); + } + return error; +@@ -333,12 +343,15 @@ { struct nameidata nd; int error; @@ -1460,11 +1576,14 @@ - error = user_path_walk(filename, &nd); + error = user_path_walk_it(filename, &nd, &it); if (!error) { -+ nd.dentry->d_it = ⁢ error = do_revalidate(nd.dentry); if (!error) error = cp_new_stat64(nd.dentry->d_inode, statbuf); -@@ -348,9 +353,12 @@ ++ intent_release(nd.dentry); + path_release(&nd); + } + return error; +@@ -348,12 +361,15 @@ { struct nameidata nd; int error; @@ -1474,11 +1593,14 @@ - error = user_path_walk_link(filename, &nd); + error = user_path_walk_link_it(filename, &nd, &it); if (!error) { -+ nd.dentry->d_it = ⁢ error = do_revalidate(nd.dentry); if (!error) error = cp_new_stat64(nd.dentry->d_inode, statbuf); -@@ -363,11 +371,16 @@ ++ intent_release(nd.dentry); + path_release(&nd); + } + return error; +@@ -363,6 +379,10 @@ { struct file * f; int err = -EBADF; @@ -1489,9 +1611,3 @@ f = fget(fd); if (f) { - struct dentry * dentry = f->f_dentry; - -+ dentry->d_it = ⁢ - err = do_revalidate(dentry); - if (!err) - err = cp_new_stat64(dentry->d_inode, statbuf); -- 1.8.3.1