From af992ffe4f70191cdd11ad794fc7c4905ab8a8b9 Mon Sep 17 00:00:00 2001 From: rread Date: Thu, 20 Feb 2003 05:31:45 +0000 Subject: [PATCH] Update b_multinet minor conflicts found in mds/handler.c and niobuf.c --- lustre/kernel_patches/patches/vfs_intent_hp.patch | 572 ++++++++++++++++------ lustre/mds/mds_open.c | 33 +- lustre/tests/acceptance-metadata-single.sh | 64 ++- lustre/tests/open_delay.c | 2 + lustre/tests/recovery-small.sh | 12 +- lustre/utils/obdbarrier.c | 1 + lustre/utils/obdio.c | 1 + lustre/utils/obdiolib.c | 1 + 8 files changed, 481 insertions(+), 205 deletions(-) diff --git a/lustre/kernel_patches/patches/vfs_intent_hp.patch b/lustre/kernel_patches/patches/vfs_intent_hp.patch index 63f09b3..501c776 100644 --- a/lustre/kernel_patches/patches/vfs_intent_hp.patch +++ b/lustre/kernel_patches/patches/vfs_intent_hp.patch @@ -1,15 +1,16 @@ - fs/dcache.c | 3 - fs/namei.c | 306 ++++++++++++++++++++++++++++++++++++++++--------- + fs/dcache.c | 8 + fs/namei.c | 335 +++++++++++++++++---- fs/nfsd/vfs.c | 2 - fs/open.c | 63 +++++++--- - fs/stat.c | 29 +++- - include/linux/dcache.h | 31 ++++ - include/linux/fs.h | 22 +++ + fs/open.c | 142 +++++++- + fs/stat.c | 24 + + include/linux/dcache.h | 26 + + include/linux/fs.h | 27 + kernel/ksyms.c | 1 - 8 files changed, 384 insertions(+), 73 deletions(-) + fs/exec.c | 18 - + 9 files changed, 487 insertions(+), 96 deletions(-) ---- linux-2.4.19-hp2_pnnl2/fs/dcache.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/fs/dcache.c Sun Jan 19 19:04:47 2003 +--- linux-2.4.19-hp2_pnnl4/fs/dcache.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/fs/dcache.c Sun Jan 19 19:04:47 2003 @@ -186,6 +188,13 @@ int d_invalidate(struct dentry * dentry) spin_unlock(&dcache_lock); return 0; @@ -32,8 +33,8 @@ INIT_LIST_HEAD(&dentry->d_hash); INIT_LIST_HEAD(&dentry->d_lru); INIT_LIST_HEAD(&dentry->d_subdirs); ---- linux-2.4.19-hp2_pnnl2/fs/namei.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/fs/namei.c Sun Jan 19 19:35:55 2003 +--- linux-2.4.19-hp2_pnnl4/fs/namei.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/fs/namei.c Sun Jan 19 19:35:55 2003 @@ -94,6 +97,13 @@ * XEmacs seems to be relying on it... */ @@ -134,6 +135,52 @@ path_release(nd); return -ELOOP; } +@@ -381,15 +416,26 @@ int follow_up(struct vfsmount **mnt, str + return __follow_up(mnt, dentry); + } + +-static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry) ++static inline int __follow_down(struct vfsmount **mnt, struct dentry **dentry, ++ struct lookup_intent *it) + { + struct vfsmount *mounted; + + spin_lock(&dcache_lock); + mounted = lookup_mnt(*mnt, *dentry); + if (mounted) { ++ int opc = 0, mode = 0; + *mnt = mntget(mounted); + spin_unlock(&dcache_lock); ++ if (it) { ++ opc = it->it_op; ++ mode = it->it_mode; ++ } ++ intent_release(*dentry, it); ++ if (it) { ++ it->it_op = opc; ++ it->it_mode = mode; ++ } + dput(*dentry); + mntput(mounted->mnt_parent); + *dentry = dget(mounted->mnt_root); +@@ -401,7 +447,7 @@ static inline int __follow_down(struct v + + int follow_down(struct vfsmount **mnt, struct dentry **dentry) + { +- return __follow_down(mnt,dentry); ++ return __follow_down(mnt,dentry,NULL); + } + + static inline void follow_dotdot(struct nameidata *nd) +@@ -437,7 +483,7 @@ static inline void follow_dotdot(struct + mntput(nd->mnt); + nd->mnt = parent; + } +- while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry)) ++ while (d_mountpoint(nd->dentry) && __follow_down(&nd->mnt, &nd->dentry, NULL)) + ; + } + @@ -447,7 +482,8 @@ static inline void follow_dotdot(struct * * We expect 'base' to be positive and a directory. @@ -144,7 +191,7 @@ { struct dentry *dentry; struct inode *inode; -@@ -520,9 +556,9 @@ int link_path_walk(const char * name, st +@@ -520,15 +556,15 @@ int link_path_walk(const char * name, st break; } /* This does the actual lookups.. */ @@ -156,6 +203,13 @@ err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; + } + /* Check mountpoints.. */ +- while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry)) ++ while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, NULL)) + ; + + err = -ENOENT; @@ -539,8 +575,8 @@ int link_path_walk(const char * name, st if (!inode->i_op) goto out_dput; @@ -176,7 +230,7 @@ break; continue; /* here ends the main loop */ -@@ -583,9 +619,9 @@ last_component: +@@ -583,19 +619,20 @@ last_component: if (err < 0) break; } @@ -188,7 +242,9 @@ err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; -@@ -594,8 +630,9 @@ last_component: + } +- while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry)) ++ while (d_mountpoint(dentry) && __follow_down(&nd->mnt, &dentry, it)) ; inode = dentry->d_inode; if ((lookup_flags & LOOKUP_FOLLOW) @@ -361,7 +417,13 @@ /* Negative dentry, just create the file */ if (!dentry->d_inode) { if (!IS_POSIXACL(dir->d_inode)) -@@ -1071,7 +1156,8 @@ do_last: +@@ -1066,12 +1151,13 @@ do_last: + error = -ELOOP; + if (flag & O_NOFOLLOW) + goto exit_dput; +- while (__follow_down(&nd->mnt,&dentry) && d_mountpoint(dentry)); ++ while (__follow_down(&nd->mnt,&dentry,it) && d_mountpoint(dentry)); + } error = -ENOENT; if (!dentry->d_inode) goto exit_dput; @@ -371,6 +433,15 @@ goto do_link; dput(nd->dentry); +@@ -1145,7 +1231,7 @@ do_last: + if (!error) { + DQUOT_INIT(inode); + +- error = do_truncate(dentry, 0); ++ error = do_truncate(dentry, 0, 1); + } + put_write_access(inode); + if (error) @@ -1157,8 +1243,10 @@ ok: return 0; @@ -440,7 +511,7 @@ + nd.last.name, + nd.last.len, + mode, dev); -+ /* the file system want to use normal vfs path now */ ++ /* the file system wants to use normal vfs path now */ + if (error != -EOPNOTSUPP) + goto out2; + } @@ -468,7 +539,7 @@ + nd.last.name, + nd.last.len, + mode); -+ /* the file system want to use normal vfs path now */ ++ /* the file system wants to use normal vfs path now */ + if (error != -EOPNOTSUPP) + goto out2; + } @@ -487,16 +558,32 @@ path_release(&nd); out: putname(tmp); -@@ -1450,8 +1578,17 @@ asmlinkage long sys_rmdir(const char * p +@@ -1450,8 +1578,33 @@ asmlinkage long sys_rmdir(const char * p error = -EBUSY; goto exit1; } + if (nd.dentry->d_inode->i_op->rmdir2) { + struct inode_operations *op = nd.dentry->d_inode->i_op; ++ struct dentry *last; ++ ++ down(&nd.dentry->d_inode->i_sem); ++ last = lookup_hash_it(&nd.last, nd.dentry, NULL); ++ up(&nd.dentry->d_inode->i_sem); ++ if (IS_ERR(last)) { ++ error = PTR_ERR(last); ++ goto exit1; ++ } ++ if (d_mountpoint(last)) { ++ dput(last); ++ error = -EBUSY; ++ goto exit1; ++ } ++ dput(last); ++ + error = op->rmdir2(nd.dentry->d_inode, + nd.last.name, + nd.last.len); -+ /* the file system want to use normal vfs path now */ ++ /* the file system wants to use normal vfs path now */ + if (error != -EOPNOTSUPP) + goto exit1; + } @@ -515,7 +602,7 @@ + error = op->unlink2(nd.dentry->d_inode, + nd.last.name, + nd.last.len); -+ /* the file system want to use normal vfs path now */ ++ /* the file system wants to use normal vfs path now */ + if (error != -EOPNOTSUPP) + goto exit1; + } @@ -530,13 +617,13 @@ if (error) goto out; - dentry = lookup_create(&nd, 0); -+ if (nd.dentry->d_inode->i_op->symlink2) { ++ if (nd.dentry->d_inode->i_op->symlink2) { + struct inode_operations *op = nd.dentry->d_inode->i_op; + error = op->symlink2(nd.dentry->d_inode, + nd.last.name, + nd.last.len, + from); -+ /* the file system want to use normal vfs path now */ ++ /* the file system wants to use normal vfs path now */ + if (error != -EOPNOTSUPP) + goto out2; + } @@ -574,7 +661,7 @@ + nd.dentry->d_inode, + nd.last.name, + nd.last.len); -+ /* the file system want to use normal vfs path now */ ++ /* the file system wants to use normal vfs path now */ + if (error != -EOPNOTSUPP) + goto out_release; + } @@ -636,24 +723,8 @@ if (!error) { if (old_dir == new_dir) inode_dir_notify(old_dir, DN_RENAME); -@@ -1886,9 +2068,23 @@ static inline int do_rename(const char * - if (newnd.last_type != LAST_NORM) - goto exit2; +@@ -1888,7 +2070,7 @@ static inline int do_rename(const char * -+ if (old_dir->d_inode->i_op->rename2) { -+ lock_kernel(); -+ error = old_dir->d_inode->i_op->rename2(old_dir->d_inode, -+ new_dir->d_inode, -+ oldnd.last.name, -+ oldnd.last.len, -+ newnd.last.name, -+ newnd.last.len); -+ unlock_kernel(); -+ /* the file system want to use normal vfs path now */ -+ if (error != -EOPNOTSUPP) -+ goto exit2; -+ } -+ double_lock(new_dir, old_dir); - old_dentry = lookup_hash(&oldnd.last, old_dir); @@ -661,7 +732,7 @@ error = PTR_ERR(old_dentry); if (IS_ERR(old_dentry)) goto exit3; -@@ -1904,14 +2100,14 @@ static inline int do_rename(const char * +@@ -1904,16 +2086,37 @@ static inline int do_rename(const char * if (newnd.last.name[newnd.last.len]) goto exit4; } @@ -671,13 +742,37 @@ if (IS_ERR(new_dentry)) goto exit4; ++ if (old_dir->d_inode->i_op->rename2) { ++ lock_kernel(); ++ /* don't rename mount point. mds will take care of ++ * the rest sanity checking */ ++ if (d_mountpoint(old_dentry)||d_mountpoint(new_dentry)) { ++ error = -EBUSY; ++ goto exit5; ++ } ++ ++ error = old_dir->d_inode->i_op->rename2(old_dir->d_inode, ++ new_dir->d_inode, ++ oldnd.last.name, ++ oldnd.last.len, ++ newnd.last.name, ++ newnd.last.len); ++ unlock_kernel(); ++ /* the file system wants to use normal vfs path now */ ++ if (error != -EOPNOTSUPP) ++ goto exit5; ++ } ++ lock_kernel(); error = vfs_rename(old_dir->d_inode, old_dentry, - new_dir->d_inode, new_dentry); + new_dir->d_inode, new_dentry, NULL); unlock_kernel(); - +- ++exit5: dput(new_dentry); + exit4: + dput(old_dentry); @@ -1964,7 +2163,8 @@ out: } @@ -721,8 +816,8 @@ if (page) { kunmap(page); page_cache_release(page); ---- linux-2.4.19-hp2_pnnl2/fs/nfsd/vfs.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/fs/nfsd/vfs.c Sun Jan 19 19:37:57 2003 +--- linux-2.4.19-hp2_pnnl4/fs/nfsd/vfs.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/fs/nfsd/vfs.c Sun Jan 19 19:37:57 2003 @@ -1295,7 +1295,7 @@ nfsd_rename(struct svc_rqst *rqstp, stru err = nfserr_perm; } else @@ -732,23 +827,50 @@ if (!err && EX_ISSYNC(tfhp->fh_export)) { nfsd_sync_dir(tdentry); nfsd_sync_dir(fdentry); ---- linux-2.4.19-hp2_pnnl2/fs/open.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/fs/open.c Sun Jan 19 19:41:00 2003 -@@ -19,6 +19,9 @@ +--- linux-2.4.19-hp2_pnnl4/fs/open.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/fs/open.c Sun Jan 19 19:41:00 2003 +@@ -19,6 +19,8 @@ #include #define special_file(m) (S_ISCHR(m)||S_ISBLK(m)||S_ISFIFO(m)||S_ISSOCK(m)) +extern int path_walk_it(const char *name, struct nameidata *nd, + struct lookup_intent *it); -+extern void intent_release(struct dentry *de, struct lookup_intent *it); int vfs_statfs(struct super_block *sb, struct statfs *buf) { +@@ -95,9 +97,10 @@ void fd_install(unsigned int fd, struct + write_unlock(&files->file_lock); + } + +-int do_truncate(struct dentry *dentry, loff_t length) ++int do_truncate(struct dentry *dentry, loff_t length, int called_from_open) + { + struct inode *inode = dentry->d_inode; ++ struct inode_operations *op = dentry->d_inode->i_op; + int error; + struct iattr newattrs; + +@@ -108,7 +111,14 @@ int do_truncate(struct dentry *dentry, l + down(&inode->i_sem); + newattrs.ia_size = length; + newattrs.ia_valid = ATTR_SIZE | ATTR_CTIME; +- error = notify_change(dentry, &newattrs); ++ if (called_from_open) ++ newattrs.ia_valid |= ATTR_FROM_OPEN; ++ if (op->setattr_raw) { ++ newattrs.ia_valid |= ATTR_RAW; ++ newattrs.ia_ctime = CURRENT_TIME; ++ error = op->setattr_raw(inode, &newattrs); ++ } else ++ error = notify_change(dentry, &newattrs); + up(&inode->i_sem); + return error; + } @@ -118,12 +121,13 @@ static inline long do_sys_truncate(const struct nameidata nd; struct inode * inode; int error; -+ struct lookup_intent it = { .it_op = IT_TRUNC }; ++ struct lookup_intent it = { .it_op = IT_GETATTR }; error = -EINVAL; if (length < 0) /* sorry, but loff_t says... */ @@ -759,7 +881,14 @@ if (error) goto out; inode = nd.dentry->d_inode; -@@ -168,6 +172,7 @@ static inline long do_sys_truncate(const +@@ -163,11 +167,13 @@ static inline long do_sys_truncate(const + error = locks_verify_truncate(inode, NULL, length); + if (!error) { + DQUOT_INIT(inode); +- error = do_truncate(nd.dentry, length); ++ intent_release(nd.dentry, &it); ++ error = do_truncate(nd.dentry, length, 0); + } put_write_access(inode); dput_and_out: @@ -767,44 +896,113 @@ path_release(&nd); out: return error; -@@ -259,8 +264,9 @@ asmlinkage long sys_utime(char * filenam - struct nameidata nd; +@@ -215,7 +228,7 @@ static inline long do_sys_ftruncate(unsi + + error = locks_verify_truncate(inode, file, length); + if (!error) +- error = do_truncate(dentry, length); ++ error = do_truncate(dentry, length, 0); + out_putf: + fput(file); + out: +@@ -260,14 +273,16 @@ asmlinkage long sys_utime(char * filenam struct inode * inode; struct iattr newattrs; -+ struct lookup_intent it = { .it_op = IT_SETATTR }; - error = user_path_walk(filename, &nd); -+ error = user_path_walk_it(filename, &nd, &it); ++ error = user_path_walk_it(filename, &nd, NULL); if (error) goto out; inode = nd.dentry->d_inode; -@@ -286,6 +292,7 @@ asmlinkage long sys_utime(char * filenam + +- error = -EROFS; +- if (IS_RDONLY(inode)) +- goto dput_and_out; ++ /* this is safe without a Lustre lock because it only depends ++ on the super block */ ++ error = -EROFS; ++ if (IS_RDONLY(inode)) ++ goto dput_and_out; + + /* Don't worry, the checks are done in inode_change_ok() */ + newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME; +@@ -279,11 +294,29 @@ asmlinkage long sys_utime(char * filenam + goto dput_and_out; + + newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET; +- } else { ++ } ++ ++ if (inode->i_op->setattr_raw) { ++ struct inode_operations *op = nd.dentry->d_inode->i_op; ++ ++ newattrs.ia_valid |= ATTR_RAW; ++ error = op->setattr_raw(inode, &newattrs); ++ /* the file system wants to use normal vfs path now */ ++ if (error != -EOPNOTSUPP) ++ goto dput_and_out; ++ } ++ ++ error = -EROFS; ++ if (IS_RDONLY(inode)) ++ goto dput_and_out; ++ ++ error = -EPERM; ++ if (!times) { + if (current->fsuid != inode->i_uid && + (error = permission(inode,MAY_WRITE)) != 0) + goto dput_and_out; } ++ error = notify_change(nd.dentry, &newattrs); dput_and_out: -+ intent_release(nd.dentry, &it); path_release(&nd); - out: - return error; -@@ -303,8 +310,9 @@ asmlinkage long sys_utimes(char * filena - struct nameidata nd; +@@ -304,16 +337,18 @@ asmlinkage long sys_utimes(char * filena struct inode * inode; struct iattr newattrs; -+ struct lookup_intent it = { .it_op = IT_SETATTR }; - error = user_path_walk(filename, &nd); -+ error = user_path_walk_it(filename, &nd, &it); ++ error = user_path_walk_it(filename, &nd, NULL); if (error) goto out; -@@ -331,6 +339,7 @@ asmlinkage long sys_utimes(char * filena - } - error = notify_change(nd.dentry, &newattrs); - dput_and_out: -+ intent_release(nd.dentry, &it); - path_release(&nd); - out: - return error; + inode = nd.dentry->d_inode; + +- error = -EROFS; +- if (IS_RDONLY(inode)) +- goto dput_and_out; +- ++ /* this is safe without a Lustre lock because it only depends ++ on the super block */ ++ error = -EROFS; ++ if (IS_RDONLY(inode)) ++ goto dput_and_out; ++ + /* Don't worry, the checks are done in inode_change_ok() */ + newattrs.ia_valid = ATTR_CTIME | ATTR_MTIME | ATTR_ATIME; + if (utimes) { +@@ -324,7 +359,20 @@ asmlinkage long sys_utimes(char * filena + newattrs.ia_atime = times[0].tv_sec; + newattrs.ia_mtime = times[1].tv_sec; + newattrs.ia_valid |= ATTR_ATIME_SET | ATTR_MTIME_SET; +- } else { ++ } ++ ++ if (inode->i_op->setattr_raw) { ++ struct inode_operations *op = nd.dentry->d_inode->i_op; ++ ++ newattrs.ia_valid |= ATTR_RAW; ++ error = op->setattr_raw(inode, &newattrs); ++ /* the file system wants to use normal vfs path now */ ++ if (error != -EOPNOTSUPP) ++ goto dput_and_out; ++ } ++ ++ error = -EPERM; ++ if (!utimes) { + if (current->fsuid != inode->i_uid && + (error = permission(inode,MAY_WRITE)) != 0) + goto dput_and_out; @@ -347,6 +356,7 @@ asmlinkage long sys_access(const char * int old_fsuid, old_fsgid; kernel_cap_t old_cap; @@ -879,53 +1077,46 @@ path_release(&nd); out: return error; -@@ -515,8 +530,9 @@ asmlinkage long sys_chmod(const char * f - struct inode * inode; - int error; - struct iattr newattrs; -+ struct lookup_intent it = { .it_op = IT_SETATTR }; +@@ -508,6 +564,18 @@ asmlinkage long sys_chmod(const char * f + if (IS_RDONLY(inode)) + goto dput_and_out; -- error = user_path_walk(filename, &nd); -+ error = user_path_walk_it(filename, &nd, &it); - if (error) ++ if (inode->i_op->setattr_raw) { ++ struct inode_operations *op = nd.dentry->d_inode->i_op; ++ ++ newattrs.ia_mode = mode; ++ newattrs.ia_valid = ATTR_MODE | ATTR_CTIME; ++ newattrs.ia_valid |= ATTR_RAW; ++ error = op->setattr_raw(inode, &newattrs); ++ /* the file system wants to use normal vfs path now */ ++ if (error != -EOPNOTSUPP) ++ goto dput_and_out; ++ } ++ + error = -EPERM; + if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) + goto dput_and_out; +@@ -538,6 +606,20 @@ static int chown_common(struct dentry * + error = -EROFS; + if (IS_RDONLY(inode)) + goto out; ++ ++ if (inode->i_op->setattr_raw) { ++ struct inode_operations *op = dentry->d_inode->i_op; ++ ++ newattrs.ia_uid = user; ++ newattrs.ia_gid = group; ++ newattrs.ia_valid = ATTR_UID | ATTR_GID; ++ newattrs.ia_valid |= ATTR_RAW; ++ error = op->setattr_raw(inode, &newattrs); ++ /* the file system wants to use normal vfs path now */ ++ if (error != -EOPNOTSUPP) ++ return error; ++ } ++ + error = -EPERM; + if (IS_IMMUTABLE(inode) || IS_APPEND(inode)) goto out; - inode = nd.dentry->d_inode; -@@ -536,6 +552,7 @@ asmlinkage long sys_chmod(const char * f - error = notify_change(nd.dentry, &newattrs); - - dput_and_out: -+ intent_release(nd.dentry, &it); - path_release(&nd); - out: - return error; -@@ -605,10 +622,12 @@ asmlinkage long sys_chown(const char * f - { - struct nameidata nd; - int error; -+ struct lookup_intent it = { .it_op = IT_SETATTR }; - -- error = user_path_walk(filename, &nd); -+ error = user_path_walk_it(filename, &nd, &it); - if (!error) { - error = chown_common(nd.dentry, user, group); -+ intent_release(nd.dentry, &it); - path_release(&nd); - } - return error; -@@ -618,10 +637,12 @@ asmlinkage long sys_lchown(const char * - { - struct nameidata nd; - int error; -+ struct lookup_intent it = { .it_op = IT_SETATTR }; - -- error = user_path_walk_link(filename, &nd); -+ error = user_path_walk_link_it(filename, &nd, &it); - if (!error) { - error = chown_common(nd.dentry, user, group); -+ intent_release(nd.dentry, &it); - path_release(&nd); - } - return error; @@ -655,10 +676,16 @@ asmlinkage long sys_fchown(unsigned int * for the internal routines (ie open_namei()/follow_link() etc). 00 is * used by symlinks. @@ -990,16 +1181,8 @@ /* * Find an empty file descriptor entry, and mark it busy. */ ---- linux-2.4.19-hp2_pnnl2/fs/stat.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/fs/stat.c Sun Jan 19 19:44:51 2003 -@@ -13,6 +13,7 @@ - - #include - -+extern void intent_release(struct dentry *de, struct lookup_intent *it); - /* - * Revalidate the inode. This is required for proper NFS attribute caching. - */ +--- linux-2.4.19-hp2_pnnl4/fs/stat.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/fs/stat.c Sun Jan 19 19:44:51 2003 @@ -135,13 +136,15 @@ static int cp_new_stat(struct inode * in asmlinkage long sys_stat(char * filename, struct __old_kernel_stat * statbuf) { @@ -1068,28 +1251,6 @@ path_release(&nd); } return error; -@@ -247,11 +256,12 @@ asmlinkage long sys_readlink(const char - { - struct nameidata nd; - int error; -+ struct lookup_intent it = { .it_op = IT_READLINK }; - - if (bufsiz <= 0) - return -EINVAL; - -- error = user_path_walk_link(path, &nd); -+ error = user_path_walk_link_it(path, &nd, &it); - if (!error) { - struct inode * inode = nd.dentry->d_inode; - -@@ -261,6 +271,7 @@ asmlinkage long sys_readlink(const char - UPDATE_ATIME(inode); - error = inode->i_op->readlink(nd.dentry, buf, bufsiz); - } -+ intent_release(nd.dentry, &it); - path_release(&nd); - } - return error; @@ -333,12 +344,14 @@ asmlinkage long sys_stat64(char * filena { struct nameidata nd; @@ -1122,9 +1283,72 @@ path_release(&nd); } return error; ---- linux-2.4.19-hp2_pnnl2/include/linux/dcache.h~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/include/linux/dcache.h Sun Jan 19 19:04:48 2003 -@@ -6,6 +6,27 @@ +--- linux-2.4.19-hp2_pnnl4/fs/exec.c~vfs_intent_hp Sun Feb 9 01:14:52 2003 ++++ linux-2.4.19-hp2_pnnl4-root/fs/exec.c Sun Feb 9 01:29:49 2003 +@@ -103,13 +104,18 @@ static inline void put_binfmt(struct lin + * + * Also note that we take the address to load from from the file itself. + */ ++extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt, ++ int flags, struct lookup_intent *it); ++int path_lookup_it(const char *path, unsigned flags, struct nameidata *nd, ++ struct lookup_intent *it); + asmlinkage long sys_uselib(const char * library) + { + struct file * file; + struct nameidata nd; + int error; ++ struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY }; + +- error = user_path_walk(library, &nd); ++ error = user_path_walk_it(library, &nd, &it); + if (error) + goto out; + +@@ -121,7 +127,8 @@ asmlinkage long sys_uselib(const char * + if (error) + goto exit; + +- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); ++ file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it); ++ intent_release(nd.dentry, &it); + error = PTR_ERR(file); + if (IS_ERR(file)) + goto out; +@@ -350,9 +350,10 @@ struct file *open_exec(const char *name) + struct inode *inode; + struct file *file; + int err = 0; ++ struct lookup_intent it = { .it_op = IT_OPEN, .it_flags = O_RDONLY }; + + if (path_init(name, LOOKUP_FOLLOW|LOOKUP_POSITIVE, &nd)) +- err = path_walk(name, &nd); ++ err = path_walk_it(name, &nd, &it); + file = ERR_PTR(err); + if (!err) { + inode = nd.dentry->d_inode; +@@ -363,7 +369,8 @@ struct file *open_exec(const char *name) + err = -EACCES; + file = ERR_PTR(err); + if (!err) { +- file = dentry_open(nd.dentry, nd.mnt, O_RDONLY); ++ file = dentry_open_it(nd.dentry, nd.mnt, O_RDONLY, &it); ++ intent_release(nd.dentry, &it); + if (!IS_ERR(file)) { + err = deny_write_access(file); + if (err) { +@@ -976,7 +986,7 @@ int do_coredump(long signr, struct pt_re + goto close_fail; + if (!file->f_op->write) + goto close_fail; +- if (do_truncate(file->f_dentry, 0) != 0) ++ if (do_truncate(file->f_dentry, 0, 0) != 0) + goto close_fail; + + retval = binfmt->core_dump(signr, regs, file); +--- linux-2.4.19-hp2_pnnl4/include/linux/dcache.h~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/include/linux/dcache.h Sun Jan 19 19:04:48 2003 +@@ -6,6 +6,25 @@ #include #include @@ -1132,10 +1356,8 @@ +#define IT_CREAT (1<<1) +#define IT_READDIR (1<<2) +#define IT_GETATTR (1<<3) -+#define IT_SETATTR (1<<4) -+#define IT_TRUNC (1<<5) -+#define IT_READLINK (1<<6) -+#define IT_LOOKUP (1<<7) ++#define IT_LOOKUP (1<<4) ++#define IT_UNLINK (1<<5) + +struct lookup_intent { + int it_op; @@ -1160,7 +1382,7 @@ unsigned long d_vfs_flags; void * d_fsdata; /* fs-specific data */ unsigned char d_iname[DNAME_INLINE_LEN]; /* small names */ -@@ -90,6 +119,8 @@ struct dentry_operations { +@@ -90,8 +119,13 @@ struct dentry_operations { int (*d_delete)(struct dentry *); void (*d_release)(struct dentry *); void (*d_iput)(struct dentry *, struct inode *); @@ -1168,8 +1390,13 @@ + void (*d_intent_release)(struct dentry *, struct lookup_intent *); }; ++/* defined in fs/namei.c */ ++extern void intent_release(struct dentry *de, struct lookup_intent *it); ++ /* the dentry parameter passed to d_hash and d_compare is the parent -@@ -124,6 +148,7 @@ d_iput: no no yes + * directory of the entries to be compared. It is used in case these + * functions need any directory specific information for determining +@@ -124,6 +149,7 @@ d_iput: no no yes * s_nfsd_free_path semaphore will be down */ #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ @@ -1177,8 +1404,17 @@ extern spinlock_t dcache_lock; ---- linux-2.4.19-hp2_pnnl2/include/linux/fs.h~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/include/linux/fs.h Sun Jan 19 19:04:48 2003 +--- linux-2.4.19-hp2_pnnl4/include/linux/fs.h~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/include/linux/fs.h Sun Jan 19 19:04:48 2003 +@@ -338,6 +338,8 @@ extern void set_bh_page(struct buffer_he + #define ATTR_MTIME_SET 256 + #define ATTR_FORCE 512 /* Not a change, but a change it */ + #define ATTR_ATTR_FLAG 1024 ++#define ATTR_RAW 2048 /* file system, not vfs will massage attrs */ ++#define ATTR_FROM_OPEN 4096 /* called from open path, ie O_TRUNC */ + + /* + * This is the Inode Attributes structure, used for notify_change(). It @@ -575,6 +575,7 @@ struct file { /* needed for tty driver, and maybe others */ @@ -1198,7 +1434,7 @@ /* * File types -@@ -876,16 +879,28 @@ struct file_operations { +@@ -876,20 +879,33 @@ struct file_operations { struct inode_operations { int (*create) (struct inode *,struct dentry *,int); struct dentry * (*lookup) (struct inode *,struct dentry *); @@ -1227,6 +1463,20 @@ void (*truncate) (struct inode *); int (*permission) (struct inode *, int); int (*revalidate) (struct dentry *); + int (*setattr) (struct dentry *, struct iattr *); ++ int (*setattr_raw) (struct inode *, struct iattr *); + int (*getattr) (struct dentry *, struct iattr *); + int (*setxattr) (struct dentry *, const char *, void *, size_t, int); + ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t); +@@ -1112,7 +1130,7 @@ static inline int get_lease(struct inode + + asmlinkage long sys_open(const char *, int, int); + asmlinkage long sys_close(unsigned int); /* yes, it's really unsigned */ +-extern int do_truncate(struct dentry *, loff_t start); ++extern int do_truncate(struct dentry *, loff_t start, int called_from_open); + + extern struct file *filp_open(const char *, int, int); + extern struct file * dentry_open(struct dentry *, struct vfsmount *, int); @@ -1354,6 +1369,7 @@ typedef int (*read_actor_t)(read_descrip extern loff_t default_llseek(struct file *file, loff_t offset, int origin); @@ -1253,8 +1503,8 @@ extern int page_readlink(struct dentry *, char *, int); extern int page_follow_link(struct dentry *, struct nameidata *); extern struct inode_operations page_symlink_inode_operations; ---- linux-2.4.19-hp2_pnnl2/kernel/ksyms.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 -+++ linux-2.4.19-hp2_pnnl2-root/kernel/ksyms.c Sun Jan 19 19:04:48 2003 +--- linux-2.4.19-hp2_pnnl4/kernel/ksyms.c~vfs_intent_hp Sun Jan 19 19:04:47 2003 ++++ linux-2.4.19-hp2_pnnl4-root/kernel/ksyms.c Sun Jan 19 19:04:48 2003 @@ -293,6 +293,7 @@ EXPORT_SYMBOL(read_cache_page); EXPORT_SYMBOL(set_page_dirty); EXPORT_SYMBOL(vfs_readlink); diff --git a/lustre/mds/mds_open.c b/lustre/mds/mds_open.c index 2f65384..bec31ca 100644 --- a/lustre/mds/mds_open.c +++ b/lustre/mds/mds_open.c @@ -1,10 +1,7 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * lustre/mds/handler.c - * Lustre Metadata Server (mds) request handler - * - * Copyright (c) 2001, 2002 Cluster File Systems, Inc. + * Copyright (c) 2003 Cluster File Systems, Inc. * Author: Peter Braam * Author: Andreas Dilger * Author: Phil Schwan @@ -35,10 +32,11 @@ #include #include #include -#include #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)) #include #include +#else +#include #endif #include #include @@ -47,9 +45,8 @@ extern kmem_cache_t *mds_file_cache; extern inline struct mds_obd *mds_req2mds(struct ptlrpc_request *req); -extern void mds_start_transno(struct mds_obd *mds); -extern int mds_finish_transno(struct mds_obd *mds, void *handle, - struct ptlrpc_request *req, int rc); +int mds_finish_transno(struct mds_obd *mds, struct inode *i, void *handle, + struct ptlrpc_request *req, int rc, __u32 op_data); extern int enqueue_ordered_locks(int lock_mode, struct obd_device *obd, struct ldlm_res_id *p1_res_id, struct ldlm_res_id *p2_res_id, @@ -130,18 +127,18 @@ int mds_open(struct mds_update_record *rec, int offset, if ((rec->ur_flags & O_CREAT) && !dchild->d_inode) { int err; void *handle; - mds_start_transno(mds); rep->lock_policy_res1 |= IT_OPEN_CREATE; handle = fsfilt_start(obd, parent->d_inode, FSFILT_OP_CREATE); if (IS_ERR(handle)) { rc = PTR_ERR(handle); - mds_finish_transno(mds, handle, req, rc); + mds_finish_transno(mds, parent->d_inode, handle, req, + rc, rep->lock_policy_res1); GOTO(out_step_3, rc); } rc = vfs_create(parent->d_inode, dchild, rec->ur_mode); - rc = mds_finish_transno(mds, handle, req, rc); - err = fsfilt_commit(obd, parent->d_inode, handle); - if (rc || err) { + err = mds_finish_transno(mds, parent->d_inode, handle, req, rc, + rep->lock_policy_res1); + if (err) { CERROR("error on commit: err = %d\n", err); if (!rc) rc = err; @@ -199,7 +196,7 @@ int mds_open(struct mds_update_record *rec, int offset, mfd = kmem_cache_alloc(mds_file_cache, GFP_KERNEL); if (!mfd) { CERROR("mds: out of memory\n"); - GOTO(out_step_4, req->rq_status = -ENOMEM); + GOTO(out_step_4, rc = -ENOMEM); } /* dentry_open does a dput(de) and mntput(mds->mds_vfsmnt) on error */ @@ -233,6 +230,12 @@ int mds_open(struct mds_update_record *rec, int offset, l_dput(dchild); out_step_2: l_dput(parent); - ldlm_lock_decref(&parent_lockh, parent_mode); + if (rc) { + ldlm_lock_decref(&parent_lockh, parent_mode); + } else { + memcpy(&req->rq_ack_locks[0].lock, &parent_lockh, + sizeof(parent_lockh)); + req->rq_ack_locks[0].mode = parent_mode; + } RETURN(rc); } diff --git a/lustre/tests/acceptance-metadata-single.sh b/lustre/tests/acceptance-metadata-single.sh index 501d2be..53774e5 100644 --- a/lustre/tests/acceptance-metadata-single.sh +++ b/lustre/tests/acceptance-metadata-single.sh @@ -6,20 +6,30 @@ set -e # load, varying debug levels # -SRCDIR="`dirname $0`/" -. $SRCDIR/common.sh +SRCDIR="`dirname $0`" +CREATE=$SRCDIR/create.pl + +debug_client_on() +{ + echo -1 > /proc/sys/portals/debug +} + +debug_client_off() +{ + echo 0 > /proc/sys/portals/debug +} MNT=${MNT:-/mnt/lustre} debug_client_on echo "create.pl, 1 mount, 1 thread, 10 ops, debug on" -perl create.pl -- $MNT -1 10 +perl $CREATE -- $MNT -1 10 echo "create.pl, 1 mount, 1 thread, 100 ops, debug on" -perl create.pl --silent -- $MNT -1 100 +perl $CREATE --silent -- $MNT -1 100 echo "create.pl --mcreate=0, 1 mount, 1 thread, 10 ops, debug on" -perl create.pl --mcreate=0 -- $MNT -1 10 +perl $CREATE --mcreate=0 -- $MNT -1 10 echo "create.pl --mcreate=0, 1 mount, 1 thread, 100 ops, debug on" -perl create.pl --mcreate=0 --silent -- $MNT -1 100 +perl $CREATE --mcreate=0 --silent -- $MNT -1 100 echo "rename.pl, 1 mount, 1 thread, 10 ops, debug on" perl rename.pl $MNT 10 echo "rename.pl, 1 mount, 1 thread, 100 ops, debug on" @@ -27,20 +37,20 @@ perl rename.pl --silent $MNT 100 debug_client_off echo "create.pl, 1 mount, 1 thread, 1000 ops, debug off" -perl create.pl --silent -- $MNT -1 1000 +perl $CREATE --silent -- $MNT -1 1000 echo "create.pl --mcreate=0, 1 mount, 1 thread, 1000 ops, debug off" -perl create.pl --silent --mcreate=0 -- $MNT -1 1000 +perl $CREATE --silent --mcreate=0 -- $MNT -1 1000 echo "rename.pl, 1 mount, 1 thread, 1000 ops, debug off" perl rename.pl --silent $MNT 1000 debug_client_on echo "create.pl, 1 mount, 2 threads, 100 ops, debug on" -perl create.pl --silent -- $MNT -1 100 & -perl create.pl --silent -- $MNT -1 100 & +perl $CREATE --silent -- $MNT -1 100 & +perl $CREATE --silent -- $MNT -1 100 & wait echo "create.pl --mcreate=0, 1 mount, 2 threads, 100 ops, debug on" -perl create.pl --silent --mcreate=0 -- $MNT -1 100 & -perl create.pl --silent --mcreate=0 -- $MNT -1 100 & +perl $CREATE --silent --mcreate=0 -- $MNT -1 100 & +perl $CREATE --silent --mcreate=0 -- $MNT -1 100 & wait echo "rename.pl, 1 mount, 2 thread, 1000 ops, debug on" perl rename.pl --silent $MNT 1000 & @@ -49,12 +59,12 @@ wait debug_client_off echo "create.pl, 1 mount, 2 threads, 2000 ops, debug off" -perl create.pl --silent -- $MNT -1 2000 & -perl create.pl --silent -- $MNT -1 2000 & +perl $CREATE --silent -- $MNT -1 2000 & +perl $CREATE --silent -- $MNT -1 2000 & wait echo "create.pl --mcreate=0, 1 mount, 2 threads, 2000 ops, debug off" -perl create.pl --silent --mcreate=0 -- $MNT -1 2000 & -perl create.pl --silent --mcreate=0 -- $MNT -1 2000 & +perl $CREATE --silent --mcreate=0 -- $MNT -1 2000 & +perl $CREATE --silent --mcreate=0 -- $MNT -1 2000 & wait echo "rename.pl, 1 mount, 2 threads, 2000 ops, debug off" perl rename.pl --silent $MNT 2000 & @@ -64,12 +74,12 @@ wait debug_client_on echo "create.pl, 1 mount, 4 threads, 100 ops, debug on" for i in `seq 1 4`; do - perl create.pl --silent -- $MNT -1 100 & + perl $CREATE --silent -- $MNT -1 100 & done wait echo "create.pl --mcreate=0, 1 mount, 4 threads, 100 ops, debug on" for i in `seq 1 4`; do - perl create.pl --silent --mcreate=0 -- $MNT -1 100 & + perl $CREATE --silent --mcreate=0 -- $MNT -1 100 & done wait echo "rename.pl, 1 mount, 4 threads, 2000 ops, debug on" @@ -81,12 +91,12 @@ wait debug_client_off echo "create.pl, 1 mount, 4 threads, 2000 ops, debug off" for i in `seq 1 4`; do - perl create.pl --silent -- $MNT -1 2000 & + perl $CREATE --silent -- $MNT -1 2000 & done wait echo "create.pl --mcreate=0, 1 mount, 4 threads, 2000 ops, debug off" for i in `seq 1 4`; do - perl create.pl --silent --mcreate=0 -- $MNT -1 2000 & + perl $CREATE --silent --mcreate=0 -- $MNT -1 2000 & done wait echo "rename.pl, 1 mount, 4 threads, 2000 ops, debug off" @@ -98,12 +108,12 @@ wait debug_client_on echo "create.pl, 1 mount, 8 threads, 500 ops, debug on" for i in `seq 1 8`; do - perl create.pl --silent -- $MNT -1 500 & + perl $CREATE --silent -- $MNT -1 500 & done wait echo "create.pl --mcreate=0, 1 mount, 8 threads, 500 ops, debug on" for i in `seq 1 8`; do - perl create.pl --silent --mcreate=0 -- $MNT -1 500 & + perl $CREATE --silent --mcreate=0 -- $MNT -1 500 & done wait echo "rename.pl, 1 mount, 8 threads, 2000 ops, debug on" @@ -115,12 +125,12 @@ wait debug_client_off echo "create.pl, 1 mount, 8 threads, 2000 ops, debug off" for i in `seq 1 8`; do - perl create.pl --silent -- $MNT -1 2000 & + perl $CREATE --silent -- $MNT -1 2000 & done wait echo "create.pl --mcreate=0, 1 mount, 8 threads, 2000 ops, debug off" for i in `seq 1 8`; do - perl create.pl --silent --mcreate=0 -- $MNT -1 2000 & + perl $CREATE --silent --mcreate=0 -- $MNT -1 2000 & done wait echo "rename.pl, 1 mount, 8 threads, 2000 ops, debug off" @@ -128,3 +138,9 @@ for i in `seq 1 8`; do perl rename.pl --silent $MNT 2000 & done wait +sh rundbench 1 +sh rundbench 2 +sh rundbench 4 +sh rundbench 8 +sh rundbench 16 +sh rundbench 32 diff --git a/lustre/tests/open_delay.c b/lustre/tests/open_delay.c index 2f418846..de4815c 100644 --- a/lustre/tests/open_delay.c +++ b/lustre/tests/open_delay.c @@ -2,6 +2,8 @@ #include #include #include +#include +#include #include #include #include diff --git a/lustre/tests/recovery-small.sh b/lustre/tests/recovery-small.sh index 26bb81f..0d0acec 100755 --- a/lustre/tests/recovery-small.sh +++ b/lustre/tests/recovery-small.sh @@ -10,9 +10,9 @@ PATH=$PATH:$LUSTRE/utils:$LUSTRE/tests PDSH='pdsh -S -w' # XXX I wish all this stuff was in some default-config.sh somewhere -MDSNODE=${MDSNODE:-dev2} -OSTNODE=${OSTNODE:-dev3} -CLIENT=${CLIENTNODE:-dev4} +MDSNODE=${MDSNODE:-mdev6} +OSTNODE=${OSTNODE:-mdev7} +CLIENT=${CLIENTNODE:-mdev8} NETWORKTYPE=${NETWORKTYPE:-tcp} MOUNTPT=${MOUNTPT:-/mnt/lustre} CONFIG=recovery-small.xml @@ -109,7 +109,7 @@ replay() { shutdown_mds -f start_mds wait - do_client "ls $MOUNPT" # trigger failover, if we haven't already + do_client "df -h $MOUNPT" # trigger failover, if we haven't already } if [ ! -z "$ONLY" ]; then @@ -120,5 +120,7 @@ fi setup drop_request "mcreate /mnt/lustre/1" drop_reply "mcreate /mnt/lustre/2" -replay "mcreate /mnt/lustre/3" +# replay "mcreate /mnt/lustre/3" +drop_request "tchmod 111 /mnt/lustre/2" +drop_reply "tchmod 666 /mnt/lustre/2" cleanup diff --git a/lustre/utils/obdbarrier.c b/lustre/utils/obdbarrier.c index 911ab5f..3363824 100644 --- a/lustre/utils/obdbarrier.c +++ b/lustre/utils/obdbarrier.c @@ -26,6 +26,7 @@ #include #include +#include #include "obdiolib.h" int diff --git a/lustre/utils/obdio.c b/lustre/utils/obdio.c index ccee788..65a4cac 100644 --- a/lustre/utils/obdio.c +++ b/lustre/utils/obdio.c @@ -26,6 +26,7 @@ #include #include +#include #include "obdiolib.h" int diff --git a/lustre/utils/obdiolib.c b/lustre/utils/obdiolib.c index ef95055..0404808 100644 --- a/lustre/utils/obdiolib.c +++ b/lustre/utils/obdiolib.c @@ -30,6 +30,7 @@ #include #include +#include #include "obdiolib.h" void -- 1.8.3.1