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, mode;
+ *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.
{
struct dentry *dentry;
struct inode *inode;
-@@ -520,9 +556,9 @@ int link_path_walk(const char * name, st
+@@ -520,18 +556,18 @@ int link_path_walk(const char * name, st
break;
}
/* This does the actual lookups.. */
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;
break;
continue;
/* here ends the main loop */
-@@ -583,9 +619,9 @@ last_component:
+@@ -583,22 +619,24 @@ last_component:
if (err < 0)
break;
}
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)
/* 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;
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);
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,
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;
path_release(&nd);
}
return error;
+--- linux-2.4.18-18.8.0-l9/fs/exec.c~vfs_intent-2.4.18-18 Sun Feb 9 01:14:52 2003
++++ linux-2.4.18-18.8.0-l9-braam/fs/exec.c Sun Feb 9 01:29:49 2003
+@@ -344,15 +344,19 @@ int setup_arg_pages(struct linux_binprm
+ return 0;
+ }
+
++extern struct file *dentry_open_it(struct dentry *dentry, struct vfsmount *mnt,
++ int flags, struct lookup_intent *it);
++
+ struct file *open_exec(const char *name)
+ {
+ struct nameidata nd;
+ 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) {
--- 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 @@
+@@ -6,6 +6,26 @@
#include <asm/atomic.h>
#include <linux/mount.h>
+#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)
+
+struct lookup_intent {