All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Helsley <matthltc@us.ibm.com>
To: linux-fsdevel@vger.kernel.org
Cc: Alexander Viro <viro@zeniv.linux.org.uk>, Christoph Hellwig <hch@lst.de>
Subject: [RFC][PATCH] vfs: extend passing of nameidata to most vfs helpers
Date: Wed, 05 Mar 2008 03:29:41 -0800	[thread overview]
Message-ID: <1204716581.10960.5.camel@localhost.localdomain> (raw)

Make the core vfs helpers more orthogonal by passing nameidata structs into all of them
(not just vfs_create)

Signed-off-by: Matt Helsley <matthltc@us.ibm.com>
---

TODO: Add the nameidata pointers to vfs_rename

Applies and compiles to 2.6.25-rc3-mm1
Tested successfully on 2.6.25-rc2-mm1 (rc3-mm1 in progress)

Right now I have the patches in a volatile form -- they aren't broken up to make
gradual API migration easier. One way to make them more digestible for inclusion
might be:

PATCH 1 - Add vfs_*_namei() helpers
PATCH 2 - Use new helpers in fs/namei.c
PATCH 3 - Use new helpers in nfsd
PATCH 4 - Use new helpers in reiserfs
PATCH 5 - Use new helpers in unionfs
PATCH 6 - Use new helpers in IPC
PATCH 7 - Use new helpers in control groups
PATCH 8 - Use new helpers in unix sockets
PATCH 9 - Remove old helpers
PATCH 10 - Rename new helpers: namei.c
PATCH 11 - Rename new helpers: nfsd 
PATCH 12 - Rename new helpers: reiserfs
PATCH 13 - Rename new helpers: unionfs
PATCH 14 - Rename new helpers: IPC
PATCH 15 - Rename new helpers: control groups
PATCH 16 - Rename new helpers: unix sockets

Is there a better/preferred way to break this up?

 fs/ecryptfs/inode.c     |   12 +++++-----
 fs/namei.c              |   54 +++++++++++++++++++++++++++---------------------
 fs/nfsd/nfs4recover.c   |    6 ++---
 fs/nfsd/vfs.c           |   14 ++++++------
 fs/reiserfs/xattr.c     |    2 -
 fs/unionfs/commonfops.c |    2 -
 fs/unionfs/copyup.c     |    2 -
 fs/unionfs/dirhelper.c  |    2 -
 fs/unionfs/inode.c      |   15 +++++++------
 fs/unionfs/rename.c     |    4 +--
 fs/unionfs/sioq.c       |    8 +++----
 fs/unionfs/unlink.c     |    4 +--
 include/linux/fs.h      |   15 ++++++++-----
 ipc/mqueue.c            |    2 -
 kernel/cgroup.c         |    2 -
 net/unix/af_unix.c      |    2 -
 16 files changed, 79 insertions(+), 67 deletions(-)

Index: linux-2.6.25-rc2-mm1/fs/namei.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/namei.c
+++ linux-2.6.25-rc2-mm1/fs/namei.c
@@ -1462,21 +1462,22 @@ static inline int check_sticky(struct in
  *  8. If we were asked to remove a non-directory and victim isn't one - EISDIR.
  *  9. We can't remove a root or mountpoint.
  * 10. We don't allow removal of NFS sillyrenamed files; it's handled by
  *     nfs_async_unlink().
  */
-static int may_delete(struct inode *dir,struct dentry *victim,int isdir)
+static int may_delete(struct inode *dir, struct dentry *victim, int isdir,
+		      struct nameidata *nd)
 {
 	int error;
 
 	if (!victim->d_inode)
 		return -ENOENT;
 
 	BUG_ON(victim->d_parent->d_inode != dir);
 	audit_inode_child(victim->d_name.name, victim, dir);
 
-	error = permission(dir,MAY_WRITE | MAY_EXEC, NULL);
+ 	error = permission(dir,MAY_WRITE | MAY_EXEC, nd);
 	if (error)
 		return error;
 	if (IS_APPEND(dir))
 		return -EPERM;
 	if (check_sticky(dir, victim->d_inode)||IS_APPEND(victim->d_inode)||
@@ -2013,13 +2014,14 @@ enoent:
 fail:
 	return dentry;
 }
 EXPORT_SYMBOL_GPL(lookup_create);
 
-int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev)
+int vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev,
+	      struct nameidata *nd)
 {
-	int error = may_create(dir, dentry, NULL);
+	int error = may_create(dir, dentry, nd);
 
 	if (error)
 		return error;
 
 	if ((S_ISCHR(mode) || S_ISBLK(mode)) && !capable(CAP_MKNOD))
@@ -2090,14 +2092,15 @@ asmlinkage long sys_mknodat(int dfd, con
 		case 0: case S_IFREG:
 			error = vfs_create(nd.path.dentry->d_inode,dentry,mode,&nd);
 			break;
 		case S_IFCHR: case S_IFBLK:
 			error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,
-					new_decode_dev(dev));
+					new_decode_dev(dev), &nd);
 			break;
 		case S_IFIFO: case S_IFSOCK:
-			error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0);
+			error = vfs_mknod(nd.path.dentry->d_inode,dentry,mode,0,
+					  &nd);
 			break;
 	}
 	mnt_drop_write(nd.path.mnt);
 out_dput:
 	dput(dentry);
@@ -2113,13 +2116,14 @@ out:
 asmlinkage long sys_mknod(const char __user *filename, int mode, unsigned dev)
 {
 	return sys_mknodat(AT_FDCWD, filename, mode, dev);
 }
 
-int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode)
+int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode,
+	      struct nameidata *nd)
 {
-	int error = may_create(dir, dentry, NULL);
+	int error = may_create(dir, dentry, nd);
 
 	if (error)
 		return error;
 
 	if (!dir->i_op || !dir->i_op->mkdir)
@@ -2160,11 +2164,11 @@ asmlinkage long sys_mkdirat(int dfd, con
 	if (!IS_POSIXACL(nd.path.dentry->d_inode))
 		mode &= ~current->fs->umask;
 	error = mnt_want_write(nd.path.mnt);
 	if (error)
 		goto out_dput;
-	error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode);
+	error = vfs_mkdir(nd.path.dentry->d_inode, dentry, mode, &nd);
 	mnt_drop_write(nd.path.mnt);
 out_dput:
 	dput(dentry);
 out_unlock:
 	mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
@@ -2205,13 +2209,13 @@ void dentry_unhash(struct dentry *dentry
 		__d_drop(dentry);
 	spin_unlock(&dentry->d_lock);
 	spin_unlock(&dcache_lock);
 }
 
-int vfs_rmdir(struct inode *dir, struct dentry *dentry)
+int vfs_rmdir(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
 {
-	int error = may_delete(dir, dentry, 1);
+	int error = may_delete(dir, dentry, 1, nd);
 
 	if (error)
 		return error;
 
 	if (!dir->i_op || !dir->i_op->rmdir)
@@ -2272,11 +2276,11 @@ static long do_rmdir(int dfd, const char
 	if (IS_ERR(dentry))
 		goto exit2;
 	error = mnt_want_write(nd.path.mnt);
 	if (error)
 		goto exit3;
-	error = vfs_rmdir(nd.path.dentry->d_inode, dentry);
+	error = vfs_rmdir(nd.path.dentry->d_inode, dentry, &nd);
 	mnt_drop_write(nd.path.mnt);
 exit3:
 	dput(dentry);
 exit2:
 	mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
@@ -2290,13 +2294,13 @@ exit:
 asmlinkage long sys_rmdir(const char __user *pathname)
 {
 	return do_rmdir(AT_FDCWD, pathname);
 }
 
-int vfs_unlink(struct inode *dir, struct dentry *dentry)
+int vfs_unlink(struct inode *dir, struct dentry *dentry, struct nameidata *nd)
 {
-	int error = may_delete(dir, dentry, 0);
+	int error = may_delete(dir, dentry, 0, nd);
 
 	if (error)
 		return error;
 
 	if (!dir->i_op || !dir->i_op->unlink)
@@ -2358,11 +2362,11 @@ static long do_unlinkat(int dfd, const c
 		if (inode)
 			atomic_inc(&inode->i_count);
 		error = mnt_want_write(nd.path.mnt);
 		if (error)
 			goto exit2;
-		error = vfs_unlink(nd.path.dentry->d_inode, dentry);
+		error = vfs_unlink(nd.path.dentry->d_inode, dentry, &nd);
 		mnt_drop_write(nd.path.mnt);
 	exit2:
 		dput(dentry);
 	}
 	mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
@@ -2394,13 +2398,14 @@ asmlinkage long sys_unlinkat(int dfd, co
 asmlinkage long sys_unlink(const char __user *pathname)
 {
 	return do_unlinkat(AT_FDCWD, pathname);
 }
 
-int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname, int mode)
+int vfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname,
+		int mode, struct nameidata *nd)
 {
-	int error = may_create(dir, dentry, NULL);
+	int error = may_create(dir, dentry, nd);
 
 	if (error)
 		return error;
 
 	if (!dir->i_op || !dir->i_op->symlink)
@@ -2443,11 +2448,12 @@ asmlinkage long sys_symlinkat(const char
 		goto out_unlock;
 
 	error = mnt_want_write(nd.path.mnt);
 	if (error)
 		goto out_dput;
-	error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO);
+	error = vfs_symlink(nd.path.dentry->d_inode, dentry, from, S_IALLUGO,
+			    &nd);
 	mnt_drop_write(nd.path.mnt);
 out_dput:
 	dput(dentry);
 out_unlock:
 	mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
@@ -2462,19 +2468,20 @@ out_putname:
 asmlinkage long sys_symlink(const char __user *oldname, const char __user *newname)
 {
 	return sys_symlinkat(oldname, AT_FDCWD, newname);
 }
 
-int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry)
+int vfs_link(struct dentry *old_dentry, struct inode *dir,
+	     struct dentry *new_dentry, struct nameidata *new_nd)
 {
 	struct inode *inode = old_dentry->d_inode;
 	int error;
 
 	if (!inode)
 		return -ENOENT;
 
-	error = may_create(dir, new_dentry, NULL);
+	error = may_create(dir, new_dentry, new_nd);
 	if (error)
 		return error;
 
 	if (dir->i_sb != inode->i_sb)
 		return -EXDEV;
@@ -2543,11 +2550,12 @@ asmlinkage long sys_linkat(int olddfd, c
 	if (IS_ERR(new_dentry))
 		goto out_unlock;
 	error = mnt_want_write(nd.path.mnt);
 	if (error)
 		goto out_dput;
-	error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode, new_dentry);
+	error = vfs_link(old_nd.path.dentry, nd.path.dentry->d_inode,
+			 new_dentry, &nd);
 	mnt_drop_write(nd.path.mnt);
 out_dput:
 	dput(new_dentry);
 out_unlock:
 	mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
@@ -2677,18 +2685,18 @@ int vfs_rename(struct inode *old_dir, st
 	const char *old_name;
 
 	if (old_dentry->d_inode == new_dentry->d_inode)
  		return 0;
  
-	error = may_delete(old_dir, old_dentry, is_dir);
+	error = may_delete(old_dir, old_dentry, is_dir, NULL);
 	if (error)
 		return error;
 
 	if (!new_dentry->d_inode)
 		error = may_create(new_dir, new_dentry, NULL);
 	else
-		error = may_delete(new_dir, new_dentry, is_dir);
+		error = may_delete(new_dir, new_dentry, is_dir, NULL);
 	if (error)
 		return error;
 
 	if (!old_dir->i_op || !old_dir->i_op->rename)
 		return -EPERM;
Index: linux-2.6.25-rc2-mm1/fs/nfsd/nfs4recover.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/nfsd/nfs4recover.c
+++ linux-2.6.25-rc2-mm1/fs/nfsd/nfs4recover.c
@@ -156,11 +156,11 @@ nfsd4_create_clid_dir(struct nfs4_client
 		goto out_put;
 	}
 	status = mnt_want_write(rec_dir.path.mnt);
 	if (status)
 		goto out_put;
-	status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry, S_IRWXU);
+	status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry, S_IRWXU, NULL);
 	mnt_drop_write(rec_dir.path.mnt);
 out_put:
 	dput(dentry);
 out_unlock:
 	mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
@@ -261,11 +261,11 @@ nfsd4_remove_clid_file(struct dentry *di
 	if (!S_ISREG(dir->d_inode->i_mode)) {
 		printk("nfsd4: non-file found in client recovery directory\n");
 		return -EINVAL;
 	}
 	mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
-	status = vfs_unlink(dir->d_inode, dentry);
+	status = vfs_unlink(dir->d_inode, dentry, NULL);
 	mutex_unlock(&dir->d_inode->i_mutex);
 	return status;
 }
 
 static int
@@ -276,11 +276,11 @@ nfsd4_clear_clid_dir(struct dentry *dir,
 	/* For now this directory should already be empty, but we empty it of
 	 * any regular files anyway, just in case the directory was created by
 	 * a kernel from the future.... */
 	nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
 	mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
-	status = vfs_rmdir(dir->d_inode, dentry);
+	status = vfs_rmdir(dir->d_inode, dentry, NULL);
 	mutex_unlock(&dir->d_inode->i_mutex);
 	return status;
 }
 
 static int
Index: linux-2.6.25-rc2-mm1/fs/nfsd/vfs.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/nfsd/vfs.c
+++ linux-2.6.25-rc2-mm1/fs/nfsd/vfs.c
@@ -1256,20 +1256,20 @@ nfsd_create(struct svc_rqst *rqstp, stru
 	switch (type) {
 	case S_IFREG:
 		host_err = vfs_create(dirp, dchild, iap->ia_mode, NULL);
 		break;
 	case S_IFDIR:
-		host_err = vfs_mkdir(dirp, dchild, iap->ia_mode);
+		host_err = vfs_mkdir(dirp, dchild, iap->ia_mode, NULL);
 		break;
 	case S_IFCHR:
 	case S_IFBLK:
 	case S_IFIFO:
 	case S_IFSOCK:
 		host_err = mnt_want_write(fhp->fh_export->ex_path.mnt);
 		if (host_err)
 			break;
-		host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
+		host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev, NULL);
 		mnt_drop_write(fhp->fh_export->ex_path.mnt);
 		break;
 	default:
 	        printk("nfsd: bad file type %o in nfsd_create\n", type);
 		host_err = -EINVAL;
@@ -1531,15 +1531,15 @@ nfsd_symlink(struct svc_rqst *rqstp, str
 		if (path_alloced == NULL)
 			host_err = -ENOMEM;
 		else {
 			strncpy(path_alloced, path, plen);
 			path_alloced[plen] = 0;
-			host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode);
+			host_err = vfs_symlink(dentry->d_inode, dnew, path_alloced, mode, NULL);
 			kfree(path_alloced);
 		}
 	} else
-		host_err = vfs_symlink(dentry->d_inode, dnew, path, mode);
+		host_err = vfs_symlink(dentry->d_inode, dnew, path, mode, NULL);
 
 	if (!host_err) {
 		if (EX_ISSYNC(fhp->fh_export))
 			host_err = nfsd_sync_dir(dentry);
 	}
@@ -1594,11 +1594,11 @@ nfsd_link(struct svc_rqst *rqstp, struct
 		goto out_nfserr;
 
 	dold = tfhp->fh_dentry;
 	dest = dold->d_inode;
 
-	host_err = vfs_link(dold, dirp, dnew);
+	host_err = vfs_link(dold, dirp, dnew, NULL);
 	if (!host_err) {
 		if (EX_ISSYNC(ffhp->fh_export)) {
 			err = nfserrno(nfsd_sync_dir(ddir));
 			write_inode_now(dest, 1);
 		}
@@ -1768,13 +1768,13 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
 		if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
 			(atomic_read(&rdentry->d_count) > 1)) {
 			host_err = -EPERM;
 		} else
 #endif
-		host_err = vfs_unlink(dirp, rdentry);
+		host_err = vfs_unlink(dirp, rdentry, NULL);
 	} else { /* It's RMDIR */
-		host_err = vfs_rmdir(dirp, rdentry);
+		host_err = vfs_rmdir(dirp, rdentry, NULL);
 	}
 
 	dput(rdentry);
 
 	if (host_err)
Index: linux-2.6.25-rc2-mm1/ipc/mqueue.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/ipc/mqueue.c
+++ linux-2.6.25-rc2-mm1/ipc/mqueue.c
@@ -755,11 +755,11 @@ asmlinkage long sys_mq_unlink(const char
 	if (inode)
 		atomic_inc(&inode->i_count);
 	err = mnt_want_write(mqueue_mnt);
 	if (err)
 		goto out_err;
-	err = vfs_unlink(dentry->d_parent->d_inode, dentry);
+	err = vfs_unlink(dentry->d_parent->d_inode, dentry, NULL);
 	mnt_drop_write(mqueue_mnt);
 out_err:
 	dput(dentry);
 
 out_unlock:
Index: linux-2.6.25-rc2-mm1/net/unix/af_unix.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/net/unix/af_unix.c
+++ linux-2.6.25-rc2-mm1/net/unix/af_unix.c
@@ -820,11 +820,11 @@ static int unix_bind(struct socket *sock
 		mode = S_IFSOCK |
 		       (SOCK_INODE(sock)->i_mode & ~current->fs->umask);
 		err = mnt_want_write(nd.path.mnt);
 		if (err)
 			goto out_mknod_dput;
-		err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0);
+		err = vfs_mknod(nd.path.dentry->d_inode, dentry, mode, 0, NULL);
 		mnt_drop_write(nd.path.mnt);
 		if (err)
 			goto out_mknod_dput;
 		mutex_unlock(&nd.path.dentry->d_inode->i_mutex);
 		dput(nd.path.dentry);
Index: linux-2.6.25-rc2-mm1/include/linux/fs.h
===================================================================
--- linux-2.6.25-rc2-mm1.orig/include/linux/fs.h
+++ linux-2.6.25-rc2-mm1/include/linux/fs.h
@@ -1123,16 +1123,19 @@ extern void unlock_super(struct super_bl
 /*
  * VFS helper functions..
  */
 extern int vfs_permission(struct nameidata *, int);
 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
-extern int vfs_mkdir(struct inode *, struct dentry *, int);
-extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);
-extern int vfs_symlink(struct inode *, struct dentry *, const char *, int);
-extern int vfs_link(struct dentry *, struct inode *, struct dentry *);
-extern int vfs_rmdir(struct inode *, struct dentry *);
-extern int vfs_unlink(struct inode *, struct dentry *);
+extern int vfs_mkdir(struct inode *, struct dentry *, int, struct nameidata *);
+extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t,
+		     struct nameidata *);
+extern int vfs_symlink(struct inode *, struct dentry *, const char *, int,
+		       struct nameidata *);
+extern int vfs_link(struct dentry *, struct inode *, struct dentry *,
+		    struct nameidata *);
+extern int vfs_rmdir(struct inode *, struct dentry *, struct nameidata *);
+extern int vfs_unlink(struct inode *, struct dentry *, struct nameidata *);
 extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *);
 
 /*
  * VFS dentry helper functions.
  */
Index: linux-2.6.25-rc2-mm1/kernel/cgroup.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/kernel/cgroup.c
+++ linux-2.6.25-rc2-mm1/kernel/cgroup.c
@@ -2842,11 +2842,11 @@ int cgroup_clone(struct task_struct *tsk
 		ret = PTR_ERR(dentry);
 		goto out_release;
 	}
 
 	/* Create the cgroup directory, which also creates the cgroup */
-	ret = vfs_mkdir(inode, dentry, S_IFDIR | 0755);
+	ret = vfs_mkdir(inode, dentry, S_IFDIR | 0755, NULL);
 	child = __d_cgrp(dentry);
 	dput(dentry);
 	if (ret) {
 		printk(KERN_INFO
 		       "Failed to create cgroup %s: %d\n", nodename,
Index: linux-2.6.25-rc2-mm1/fs/reiserfs/xattr.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/reiserfs/xattr.c
+++ linux-2.6.25-rc2-mm1/fs/reiserfs/xattr.c
@@ -745,11 +745,11 @@ int reiserfs_delete_xattrs(struct inode 
 
 	/* Leftovers besides . and .. -- that's not good. */
 	if (dir->d_inode->i_nlink <= 2) {
 		root = get_xa_root(inode->i_sb, XATTR_REPLACE);
 		reiserfs_write_lock_xattrs(inode->i_sb);
-		err = vfs_rmdir(root->d_inode, dir);
+		err = vfs_rmdir(root->d_inode, dir, NULL);
 		reiserfs_write_unlock_xattrs(inode->i_sb);
 		dput(root);
 	} else {
 		reiserfs_warning(inode->i_sb,
 				 "Couldn't remove all entries in directory");
Index: linux-2.6.25-rc2-mm1/fs/ecryptfs/inode.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/ecryptfs/inode.c
+++ linux-2.6.25-rc2-mm1/fs/ecryptfs/inode.c
@@ -398,11 +398,11 @@ static int ecryptfs_link(struct dentry *
 	lower_new_dentry = ecryptfs_dentry_to_lower(new_dentry);
 	dget(lower_old_dentry);
 	dget(lower_new_dentry);
 	lower_dir_dentry = lock_parent(lower_new_dentry);
 	rc = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode,
-		      lower_new_dentry);
+		      lower_new_dentry, NULL);
 	if (rc || !lower_new_dentry->d_inode)
 		goto out_lock;
 	rc = ecryptfs_interpose(lower_new_dentry, new_dentry, dir->i_sb, 0);
 	if (rc)
 		goto out_lock;
@@ -426,11 +426,11 @@ static int ecryptfs_unlink(struct inode 
 	int rc = 0;
 	struct dentry *lower_dentry = ecryptfs_dentry_to_lower(dentry);
 	struct inode *lower_dir_inode = ecryptfs_inode_to_lower(dir);
 
 	lock_parent(lower_dentry);
-	rc = vfs_unlink(lower_dir_inode, lower_dentry);
+	rc = vfs_unlink(lower_dir_inode, lower_dentry, NULL);
 	if (rc) {
 		printk(KERN_ERR "Error in vfs_unlink; rc = [%d]\n", rc);
 		goto out_unlock;
 	}
 	fsstack_copy_attr_times(dir, lower_dir_inode);
@@ -464,11 +464,11 @@ static int ecryptfs_symlink(struct inode
 	if (encoded_symlen < 0) {
 		rc = encoded_symlen;
 		goto out_lock;
 	}
 	rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry,
-			 encoded_symname, mode);
+			 encoded_symname, mode, NULL);
 	kfree(encoded_symname);
 	if (rc || !lower_dentry->d_inode)
 		goto out_lock;
 	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
 	if (rc)
@@ -489,11 +489,11 @@ static int ecryptfs_mkdir(struct inode *
 	struct dentry *lower_dentry;
 	struct dentry *lower_dir_dentry;
 
 	lower_dentry = ecryptfs_dentry_to_lower(dentry);
 	lower_dir_dentry = lock_parent(lower_dentry);
-	rc = vfs_mkdir(lower_dir_dentry->d_inode, lower_dentry, mode);
+	rc = vfs_mkdir(lower_dir_dentry->d_inode, lower_dentry, mode, NULL);
 	if (rc || !lower_dentry->d_inode)
 		goto out;
 	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
 	if (rc)
 		goto out;
@@ -515,11 +515,11 @@ static int ecryptfs_rmdir(struct inode *
 
 	lower_dentry = ecryptfs_dentry_to_lower(dentry);
 	dget(dentry);
 	lower_dir_dentry = lock_parent(lower_dentry);
 	dget(lower_dentry);
-	rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
+	rc = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry, NULL);
 	dput(lower_dentry);
 	if (!rc)
 		d_delete(lower_dentry);
 	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
 	dir->i_nlink = lower_dir_dentry->d_inode->i_nlink;
@@ -537,11 +537,11 @@ ecryptfs_mknod(struct inode *dir, struct
 	struct dentry *lower_dentry;
 	struct dentry *lower_dir_dentry;
 
 	lower_dentry = ecryptfs_dentry_to_lower(dentry);
 	lower_dir_dentry = lock_parent(lower_dentry);
-	rc = vfs_mknod(lower_dir_dentry->d_inode, lower_dentry, mode, dev);
+	rc = vfs_mknod(lower_dir_dentry->d_inode, lower_dentry, mode, dev, NULL);
 	if (rc || !lower_dentry->d_inode)
 		goto out;
 	rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
 	if (rc)
 		goto out;
Index: linux-2.6.25-rc2-mm1/fs/unionfs/inode.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/unionfs/inode.c
+++ linux-2.6.25-rc2-mm1/fs/unionfs/inode.c
@@ -60,11 +60,11 @@ static int check_for_whiteout(struct den
 
 	/* .wh.foo has been found, so let's unlink it */
 	lower_dir_dentry = lock_parent_wh(wh_dentry);
 	/* see Documentation/filesystems/unionfs/issues.txt */
 	lockdep_off();
-	err = vfs_unlink(lower_dir_dentry->d_inode, wh_dentry);
+	err = vfs_unlink(lower_dir_dentry->d_inode, wh_dentry, NULL);
 	lockdep_on();
 	unlock_dir(lower_dir_dentry);
 
 	/*
 	 * Whiteouts are special files and should be deleted no matter what
@@ -345,11 +345,11 @@ static int unionfs_link(struct dentry *o
 		err = is_robranch_super(new_dentry->d_sb, dbstart(new_dentry));
 		if (!err) {
 			/* see Documentation/filesystems/unionfs/issues.txt */
 			lockdep_off();
 			err = vfs_unlink(lower_dir_dentry->d_inode,
-					 whiteout_dentry);
+					 whiteout_dentry, NULL);
 			lockdep_on();
 		}
 
 		fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
 		dir->i_nlink = unionfs_get_nlinks(dir);
@@ -378,11 +378,11 @@ static int unionfs_link(struct dentry *o
 	err = is_robranch(old_dentry);
 	if (!err) {
 		/* see Documentation/filesystems/unionfs/issues.txt */
 		lockdep_off();
 		err = vfs_link(lower_old_dentry, lower_dir_dentry->d_inode,
-			       lower_new_dentry);
+			       lower_new_dentry, NULL);
 		lockdep_on();
 	}
 	unlock_dir(lower_dir_dentry);
 
 docopyup:
@@ -411,11 +411,11 @@ docopyup:
 				 */
 				lockdep_off();
 				/* do vfs_link */
 				err = vfs_link(lower_old_dentry,
 					       lower_dir_dentry->d_inode,
-					       lower_new_dentry);
+					       lower_new_dentry, NULL);
 				lockdep_on();
 				unlock_dir(lower_dir_dentry);
 				goto check_link;
 			}
 		}
@@ -500,11 +500,11 @@ static int unionfs_symlink(struct inode 
 		goto out;
 	}
 
 	mode = S_IALLUGO;
 	err = vfs_symlink(lower_parent_dentry->d_inode, lower_dentry,
-			  symname, mode);
+			  symname, mode, NULL);
 	if (!err) {
 		err = PTR_ERR(unionfs_interpose(dentry, parent->i_sb, 0));
 		if (!err) {
 			unionfs_copy_attr_times(parent);
 			fsstack_copy_inode_size(parent,
@@ -631,11 +631,11 @@ static int unionfs_mkdir(struct inode *p
 			err = PTR_ERR(lower_parent_dentry);
 			goto out;
 		}
 
 		err = vfs_mkdir(lower_parent_dentry->d_inode, lower_dentry,
-				mode);
+				mode, NULL);
 
 		unlock_dir(lower_parent_dentry);
 
 		/* did the mkdir succeed? */
 		if (err)
@@ -734,11 +734,12 @@ static int unionfs_mknod(struct inode *p
 	if (IS_ERR(lower_parent_dentry)) {
 		err = PTR_ERR(lower_parent_dentry);
 		goto out;
 	}
 
-	err = vfs_mknod(lower_parent_dentry->d_inode, lower_dentry, mode, dev);
+	err = vfs_mknod(lower_parent_dentry->d_inode, lower_dentry, mode, dev,
+			NULL);
 	if (!err) {
 		err = PTR_ERR(unionfs_interpose(dentry, parent->i_sb, 0));
 		if (!err) {
 			unionfs_copy_attr_times(parent);
 			fsstack_copy_inode_size(parent,
Index: linux-2.6.25-rc2-mm1/fs/unionfs/sioq.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/unionfs/sioq.c
+++ linux-2.6.25-rc2-mm1/fs/unionfs/sioq.c
@@ -67,38 +67,38 @@ void __unionfs_create(struct work_struct
 void __unionfs_mkdir(struct work_struct *work)
 {
 	struct sioq_args *args = container_of(work, struct sioq_args, work);
 	struct mkdir_args *m = &args->mkdir;
 
-	args->err = vfs_mkdir(m->parent, m->dentry, m->mode);
+	args->err = vfs_mkdir(m->parent, m->dentry, m->mode, NULL);
 	complete(&args->comp);
 }
 
 void __unionfs_mknod(struct work_struct *work)
 {
 	struct sioq_args *args = container_of(work, struct sioq_args, work);
 	struct mknod_args *m = &args->mknod;
 
-	args->err = vfs_mknod(m->parent, m->dentry, m->mode, m->dev);
+	args->err = vfs_mknod(m->parent, m->dentry, m->mode, m->dev, NULL);
 	complete(&args->comp);
 }
 
 void __unionfs_symlink(struct work_struct *work)
 {
 	struct sioq_args *args = container_of(work, struct sioq_args, work);
 	struct symlink_args *s = &args->symlink;
 
-	args->err = vfs_symlink(s->parent, s->dentry, s->symbuf, s->mode);
+	args->err = vfs_symlink(s->parent, s->dentry, s->symbuf, s->mode, NULL);
 	complete(&args->comp);
 }
 
 void __unionfs_unlink(struct work_struct *work)
 {
 	struct sioq_args *args = container_of(work, struct sioq_args, work);
 	struct unlink_args *u = &args->unlink;
 
-	args->err = vfs_unlink(u->parent, u->dentry);
+	args->err = vfs_unlink(u->parent, u->dentry, NULL);
 	complete(&args->comp);
 }
 
 void __delete_whiteouts(struct work_struct *work)
 {
Index: linux-2.6.25-rc2-mm1/fs/unionfs/unlink.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/unionfs/unlink.c
+++ linux-2.6.25-rc2-mm1/fs/unionfs/unlink.c
@@ -42,11 +42,11 @@ static int unionfs_unlink_whiteout(struc
 	dget(lower_dentry);
 	err = is_robranch_super(dentry->d_sb, bindex);
 	if (!err) {
 		/* see Documentation/filesystems/unionfs/issues.txt */
 		lockdep_off();
-		err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry);
+		err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry, NULL);
 		lockdep_on();
 	}
 	/* if vfs_unlink succeeded, update our inode's times */
 	if (!err)
 		unionfs_copy_attr_times(dentry->d_inode);
@@ -160,11 +160,11 @@ static int unionfs_rmdir_first(struct in
 	dget(lower_dentry);
 	err = is_robranch(dentry);
 	if (!err) {
 		/* see Documentation/filesystems/unionfs/issues.txt */
 		lockdep_off();
-		err = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry);
+		err = vfs_rmdir(lower_dir_dentry->d_inode, lower_dentry, NULL);
 		lockdep_on();
 	}
 	dput(lower_dentry);
 
 	fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
Index: linux-2.6.25-rc2-mm1/fs/unionfs/dirhelper.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/unionfs/dirhelper.c
+++ linux-2.6.25-rc2-mm1/fs/unionfs/dirhelper.c
@@ -68,11 +68,11 @@ int do_delete_whiteouts(struct dentry *d
 			if (IS_ERR(lower_dentry)) {
 				err = PTR_ERR(lower_dentry);
 				break;
 			}
 			if (lower_dentry->d_inode)
-				err = vfs_unlink(lower_dir, lower_dentry);
+				err = vfs_unlink(lower_dir, lower_dentry, NULL);
 			dput(lower_dentry);
 			if (err)
 				break;
 		}
 	}
Index: linux-2.6.25-rc2-mm1/fs/unionfs/rename.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/unionfs/rename.c
+++ linux-2.6.25-rc2-mm1/fs/unionfs/rename.c
@@ -79,11 +79,11 @@ static int __unionfs_rename(struct inode
 
 		lower_wh_dir_dentry = lock_parent_wh(lower_wh_dentry);
 		err = is_robranch_super(old_dentry->d_sb, bindex);
 		if (!err)
 			err = vfs_unlink(lower_wh_dir_dentry->d_inode,
-					 lower_wh_dentry);
+					 lower_wh_dentry, NULL);
 
 		dput(lower_wh_dentry);
 		unlock_dir(lower_wh_dir_dentry);
 		if (err)
 			goto out;
@@ -220,11 +220,11 @@ static int do_unionfs_rename(struct inod
 
 		unlink_dir_dentry = lock_parent(unlink_dentry);
 		err = is_robranch_super(old_dir->i_sb, bindex);
 		if (!err)
 			err = vfs_unlink(unlink_dir_dentry->d_inode,
-					 unlink_dentry);
+					 unlink_dentry, NULL);
 
 		fsstack_copy_attr_times(new_dentry->d_parent->d_inode,
 					unlink_dir_dentry->d_inode);
 		/* propagate number of hard-links */
 		new_dentry->d_parent->d_inode->i_nlink =
Index: linux-2.6.25-rc2-mm1/fs/unionfs/commonfops.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/unionfs/commonfops.c
+++ linux-2.6.25-rc2-mm1/fs/unionfs/commonfops.c
@@ -86,11 +86,11 @@ retry:
 		atomic_inc(&lower_dentry->d_inode->i_count);
 		unionfs_set_lower_inode_idx(dentry->d_inode, bindex,
 					    lower_dentry->d_inode);
 	}
 	lower_dir_dentry = lock_parent(lower_dentry);
-	err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry);
+	err = vfs_unlink(lower_dir_dentry->d_inode, lower_dentry, NULL);
 	unlock_dir(lower_dir_dentry);
 
 out:
 	if (!err)
 		unionfs_check_dentry(dentry);
Index: linux-2.6.25-rc2-mm1/fs/unionfs/copyup.c
===================================================================
--- linux-2.6.25-rc2-mm1.orig/fs/unionfs/copyup.c
+++ linux-2.6.25-rc2-mm1/fs/unionfs/copyup.c
@@ -484,11 +484,11 @@ out_unlink:
 	/*
 	 * copyup failed, because we possibly ran out of space or
 	 * quota, or something else happened so let's unlink; we don't
 	 * really care about the return value of vfs_unlink
 	 */
-	vfs_unlink(new_lower_parent_dentry->d_inode, new_lower_dentry);
+	vfs_unlink(new_lower_parent_dentry->d_inode, new_lower_dentry, NULL);
 
 	if (copyup_file) {
 		/* need to close the file */
 
 		fput(*copyup_file);



             reply	other threads:[~2008-03-05 11:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-05 11:29 Matt Helsley [this message]
2008-03-05 17:48 ` [RFC][PATCH] vfs: extend passing of nameidata to most vfs helpers Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1204716581.10960.5.camel@localhost.localdomain \
    --to=matthltc@us.ibm.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.