[PATCH 13/13] Rename {__}d_path() to {__}print_path() and fix comments

Previous thread: 100% iowait on one of cpus in current -git by Maxim Levitsky on Monday, October 22, 2007 - 2:22 am. (22 messages)

Next thread: [PATCH -v6 3/3] x86 boot: document for 32 bit boot protocol by Huang, Ying on Monday, October 22, 2007 - 3:17 am. (1 message)
To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:53 am

Hi Andrew,

Could you please consider these patches for -mm ? These patches
apply on 2.6.23-mm1 and are mostly a repost of earlier patches.

Patches 1 to 11 have been Acked by Christoph Hellwig.

Patch 12 is another instance where (vfsmnt, dentry) to path conversion
is possible.

Patch 13 is a patch which renames d_path to print_path and fixes
comments as suggested by Christoph.

Compile and boot tested on x86, x86_64 and powerpc.

Regards,
Bharata.
-

To: Bharata B Rao <bharata@...>
Cc: Andrew Morton <akpm@...>, Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 9:57 am

Any reason we've got this patchset posted by three people now? :)

-

To: Christoph Hellwig <hch@...>
Cc: Andrew Morton <akpm@...>, Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 10:33 pm

Two reasons actually !

- The set of patches posted by Jan last was on 2.6.23-rc8-mm1. So I
thought let me help Andrew a bit by making them available on latest
-mm :) And I didn't know that these were already under consideration
by Andrew.

- The set of patches posted by Jan didn't even pass compile test for me.
So I made sure that the patches compiled and worked on x86, x86_64 and powerpc.

Regards,
Bharata.
-

To: Bharata B Rao <bharata@...>
Cc: Christoph Hellwig <hch@...>, Andrew Morton <akpm@...>, Andreas Gruenbacher <agruen@...>, <viro@...>, <linux-kernel@...>
Date: Tuesday, October 23, 2007 - 4:43 am

And I merged your feedback already in ...

The thing is: how do we keep going from here? Do you want to send my patches
in the future or are you going to ask me before sending things out? We don't
need to duplicate the work here. I already put my quilt stack into a public
place for you to work on them but I don't like the way this is going on at the
moment.
-

To: Jan Blunck <jblunck@...>
Cc: Christoph Hellwig <hch@...>, Andrew Morton <akpm@...>, Andreas Gruenbacher <agruen@...>, <viro@...>, <linux-kernel@...>
Date: Tuesday, October 23, 2007 - 11:31 pm

My intention was to help speed up the Union Mount effort by ensuring
that patches don't rot waiting for developer's attention. Going by the
past interactions, I got a feeling that you have lot of other work
besides this, while I have time to spare on this. Hence wanted to do my
bit to get patches moving as quickly as possible.

As I have conveyed to you many times, I would still like you to maintain
the patches and send out as timely as possible on lkml. If you can't do
this because of your other commitments, then I would more than willing
to maintain these and give them maximum attention.

And thanks for making available the patches publicly, I have been asking
this for months now.

Regards,
Bharata.
-

To: Christoph Hellwig <hch@...>
Cc: <bharata@...>, <jblunck@...>, <agruen@...>, <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 6:56 pm

On Mon, 22 Oct 2007 15:57:58 +0200

presumably because I haven't been merging it.

I was in bugfix-only mode from a week prior to 2.6.24 release and during
the merge window. Partly caused by the already-idiotic amount of stuff we
had queued for 2.6.24, partly because we needed to concentrate on
stabilising the 2.6.25 patchpile rather than writing new stuff.

And partly to send the signal that rather than beavering away on new
features all the time, we should also be spending some (more) time testing,
reviewing and bugfixing the current and soon-to-be-current code.

Probably I should have been more explicit about it, but it wasn't really
planned. Next time I'll send more "thanks, I parked this for consideration
at a more appropriate time" emails.

-

To: Andrew Morton <akpm@...>
Cc: Christoph Hellwig <hch@...>, <bharata@...>, <agruen@...>, <viro@...>, <linux-kernel@...>
Date: Tuesday, October 23, 2007 - 4:39 am

Oh, I got that one. I don't know why Bharata sent the patch series
again. Especially since I don't know which version of the patches he sent out :(

The original patches where rotting in my queue for quite some time until
Andreas got fed up with me having no time to work on them. Now since Andreas
is busy working on other things I took over again. Thats it.
-

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 3:04 am

Changes the name of d_path() and __d_path() to print_path() and __print_path()
respectively and fixes the kerneldoc comments for print_path().

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
arch/blackfin/kernel/traps.c | 2 -
drivers/md/bitmap.c | 2 -
drivers/usb/gadget/file_storage.c | 4 +--
fs/compat_ioctl.c | 3 +-
fs/dcache.c | 41 +++++++++++++++++---------------------
fs/dcookies.c | 2 -
fs/ecryptfs/super.c | 2 -
fs/nfsd/export.c | 2 -
fs/proc/base.c | 2 -
fs/seq_file.c | 2 -
fs/sysfs/file.c | 2 -
fs/unionfs/super.c | 2 -
include/linux/dcache.h | 2 -
kernel/audit.c | 2 -
14 files changed, 34 insertions(+), 36 deletions(-)

--- a/arch/blackfin/kernel/traps.c
+++ b/arch/blackfin/kernel/traps.c
@@ -102,7 +102,7 @@ static int printk_address(unsigned long
struct file *file = vma->vm_file;
if (file) {
char _tmpbuf[256];
- name = d_path(file->f_dentry,
+ name = print_path(file->f_dentry,
file->f_vfsmnt,
_tmpbuf,
sizeof(_tmpbuf));
--- a/drivers/md/bitmap.c
+++ b/drivers/md/bitmap.c
@@ -215,7 +215,7 @@ char *file_path(struct file *file, char
d = file->f_path.dentry;
v = file->f_path.mnt;

- buf = d_path(d, v, buf, count);
+ buf = print_path(d, v, buf, count);

return IS_ERR(buf) ? NULL : buf;
}
--- a/drivers/usb/gadget/file_storage.c
+++ b/drivers/usb/gadget/file_storage.c
@@ -3567,7 +3567,7 @@ static ssize_t show_file(struct device *

down_read(&fsg->filesem);
if (backing_file_is_open(curlun)) { // Get the complete pathname
- p = d_path(curlun->filp->f_path.dentry,
+ p = print_path(curlun->filp->f_path.dentry,
curlun->filp->f_path.mnt, bu...

To: Bharata B Rao <bharata@...>
Cc: Andrew Morton <akpm@...>, Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 6:14 am

I don't think we want to put in this rename until d_path is changed to
actually take a struct path * describing the path to be printed.

-

To: Christoph Hellwig <hch@...>
Cc: <bharata@...>, <jblunck@...>, <agruen@...>, <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 6:56 pm

On Mon, 22 Oct 2007 11:14:43 +0100

I didn't merge this one.
-

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 3:03 am

Replace the (vfsmnt, dentry) arguments in proc_inode operation proc_get_link()
by struct path.

Also, this should eventually allow do_proc_readlink() to call d_path() with
a struct path argument.

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
fs/proc/base.c | 60 +++++++++++++++++++++---------------------------
fs/proc/internal.h | 2 -
fs/proc/task_mmu.c | 6 ++--
fs/proc/task_nommu.c | 6 ++--
include/linux/proc_fs.h | 2 -
5 files changed, 35 insertions(+), 41 deletions(-)

--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -153,7 +153,7 @@ static int get_nr_threads(struct task_st
return count;
}

-static int proc_cwd_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
+static int proc_cwd_link(struct inode *inode, struct path *path)
{
struct task_struct *task = get_proc_task(inode);
struct fs_struct *fs = NULL;
@@ -165,8 +165,8 @@ static int proc_cwd_link(struct inode *i
}
if (fs) {
read_lock(&fs->lock);
- *mnt = mntget(fs->pwd.mnt);
- *dentry = dget(fs->pwd.dentry);
+ *path = fs->pwd;
+ path_get(path);
read_unlock(&fs->lock);
result = 0;
put_fs_struct(fs);
@@ -174,7 +174,7 @@ static int proc_cwd_link(struct inode *i
return result;
}

-static int proc_root_link(struct inode *inode, struct dentry **dentry, struct vfsmount **mnt)
+static int proc_root_link(struct inode *inode, struct path *path)
{
struct task_struct *task = get_proc_task(inode);
struct fs_struct *fs = NULL;
@@ -186,8 +186,8 @@ static int proc_root_link(struct inode *
}
if (fs) {
read_lock(&fs->lock);
- *mnt = mntget(fs->root.mnt);
- *dentry = dget(fs->root.dentry);
+ *path = fs->root;
+ path_get(path);
read_unlock(&fs->lock);
result = 0;
put_fs_struct(fs);
@@ -1039,34 +1039,32 @@ static void *proc_pid_follow_link(struct
if (!proc_fd_access_allowed(inode))
goto out;

- error = PROC_I(inode)->op.proc_ge...

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 3:02 am

From: Andreas Gruenbacher <agruen@suse.de>

One less argument to __d_path.

All callers to __d_path pass the dentry and vfsmount of a struct
path to __d_path. Pass the struct path directly, instead.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
fs/dcache.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1779,8 +1779,7 @@ shouldnt_be_hashed:
* "buflen" should be positive. Caller holds the dcache_lock.
*/
static char * __d_path( struct dentry *dentry, struct vfsmount *vfsmnt,
- struct dentry *root, struct vfsmount *rootmnt,
- char *buffer, int buflen)
+ struct path *root, char *buffer, int buflen)
{
char * end = buffer+buflen;
char * retval;
@@ -1805,7 +1804,7 @@ static char * __d_path( struct dentry *d
for (;;) {
struct dentry * parent;

- if (dentry == root && vfsmnt == rootmnt)
+ if (dentry == root->dentry && vfsmnt == root->mnt)
break;
if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) {
/* Global root? */
@@ -1868,7 +1867,7 @@ char * d_path(struct dentry *dentry, str
path_get(&current->fs->root);
read_unlock(&current->fs->lock);
spin_lock(&dcache_lock);
- res = __d_path(dentry, vfsmnt, root.dentry, root.mnt, buf, buflen);
+ res = __d_path(dentry, vfsmnt, &root, buf, buflen);
spin_unlock(&dcache_lock);
path_put(&root);
return res;
@@ -1936,8 +1935,7 @@ asmlinkage long sys_getcwd(char __user *
unsigned long len;
char * cwd;

- cwd = __d_path(pwd.dentry, pwd.mnt, root.dentry, root.mnt,
- page, PAGE_SIZE);
+ cwd = __d_path(pwd.dentry, pwd.mnt, &root, page, PAGE_SIZE);
spin_unlock(&dcache_lock);

error = PTR_ERR(cwd);
-

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 3:02 am

From: Jan Blunck <jblunck@suse.de>

In nearly all cases the set_fs_{root,pwd}() calls work on a struct
path. Change the function to reflect this and use path_get() here.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
fs/namespace.c | 28 ++++++++++++++--------------
fs/open.c | 12 ++++--------
include/linux/fs_struct.h | 4 ++--
3 files changed, 20 insertions(+), 24 deletions(-)

--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -2040,15 +2040,14 @@ out1:
* Replace the fs->{rootmnt,root} with {mnt,dentry}. Put the old values.
* It can block. Requires the big lock held.
*/
-void set_fs_root(struct fs_struct *fs, struct vfsmount *mnt,
- struct dentry *dentry)
+void set_fs_root(struct fs_struct *fs, struct path *path)
{
struct path old_root;

write_lock(&fs->lock);
old_root = fs->root;
- fs->root.mnt = mntget(mnt);
- fs->root.dentry = dget(dentry);
+ fs->root = *path;
+ path_get(path);
write_unlock(&fs->lock);
if (old_root.dentry)
path_put(&old_root);
@@ -2058,15 +2057,14 @@ void set_fs_root(struct fs_struct *fs, s
* Replace the fs->{pwdmnt,pwd} with {mnt,dentry}. Put the old values.
* It can block. Requires the big lock held.
*/
-void set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
- struct dentry *dentry)
+void set_fs_pwd(struct fs_struct *fs, struct path *path)
{
struct path old_pwd;

write_lock(&fs->lock);
old_pwd = fs->pwd;
- fs->pwd.mnt = mntget(mnt);
- fs->pwd.dentry = dget(dentry);
+ fs->pwd = *path;
+ path_get(path);
write_unlock(&fs->lock);

if (old_pwd.dentry)
@@ -2087,12 +2085,10 @@ static void chroot_fs_refs(struct nameid
task_unlock(p);
if (fs->root.dentry == old_nd->path.dentry
&& fs->root.mn...

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 3:01 am

From: Jan Blunck <jblunck@suse.de>

* Use struct path in fs_struct.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
fs/dcache.c | 34 ++++++++++++---------------
fs/namei.c | 53 ++++++++++++++++++------------------------
fs/namespace.c | 57 ++++++++++++++++++++--------------------------
fs/proc/base.c | 8 +++---
include/linux/fs_struct.h | 6 +---
init/do_mounts.c | 6 ++--
kernel/auditsc.c | 4 +--
kernel/exit.c | 12 +++------
kernel/fork.c | 18 +++++++-------
9 files changed, 87 insertions(+), 111 deletions(-)

--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -1851,8 +1851,7 @@ char * d_path(struct dentry *dentry, str
char *buf, int buflen)
{
char *res;
- struct vfsmount *rootmnt;
- struct dentry *root;
+ struct path root;

/*
* We have various synthetic filesystems that never get mounted. On
@@ -1865,14 +1864,13 @@ char * d_path(struct dentry *dentry, str
return dentry->d_op->d_dname(dentry, buf, buflen);

read_lock(&current->fs->lock);
- rootmnt = mntget(current->fs->rootmnt);
- root = dget(current->fs->root);
+ root = current->fs->root;
+ path_get(&current->fs->root);
read_unlock(&current->fs->lock);
spin_lock(&dcache_lock);
- res = __d_path(dentry, vfsmnt, root, rootmnt, buf, buflen);
+ res = __d_path(dentry, vfsmnt, root.dentry, root.mnt, buf, buflen);
spin_unlock(&dcache_lock);
- dput(root);
- mntput(rootmnt);
+ path_put(&root);
return res;
}

@@ -1918,28 +1916,28 @@ char *dynamic_dname(struct dentry *dentr
asmlinkage long sys_getcwd(char __user *buf, unsigned long size)
{
int error;
- struct vfsmount *pwdmnt, *rootmnt;
- struct dentry *pwd, *root;
+ struct path ...

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 3:00 am

From: Jan Blunck <jblunck@suse.de>

This introduces the symmetric function to path_put() for getting a reference
to the dentry and vfsmount of a struct path in the right order.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
fs/namei.c | 17 +++++++++++++++--
fs/unionfs/super.c | 2 +-
include/linux/namei.h | 6 ------
include/linux/path.h | 1 +
4 files changed, 17 insertions(+), 9 deletions(-)

--- a/fs/namei.c
+++ b/fs/namei.c
@@ -363,6 +363,19 @@ int deny_write_access(struct file * file
}

/**
+ * path_get - get a reference to a path
+ * @path: path to get the reference to
+ *
+ * Given a path increment the reference count to the dentry and the vfsmount.
+ */
+void path_get(struct path *path)
+{
+ mntget(path->mnt);
+ dget(path->dentry);
+}
+EXPORT_SYMBOL(path_get);
+
+/**
* path_put - put a reference to a path
* @path: path to put the reference to
*
@@ -1161,8 +1174,8 @@ static int fastcall do_path_lookup(int d
if (retval)
goto fput_fail;

- nd->path.mnt = mntget(file->f_path.mnt);
- nd->path.dentry = dget(dentry);
+ nd->path = file->f_path;
+ path_get(&file->f_path);

fput_light(file, fput_needed);
}
--- a/fs/unionfs/super.c
+++ b/fs/unionfs/super.c
@@ -544,7 +544,7 @@ static int unionfs_remount_fs(struct sup
memcpy(tmp_lower_paths, UNIONFS_D(sb->s_root)->lower_paths,
cur_branches * sizeof(struct path));
for (i = 0; i < cur_branches; i++)
- pathget(&tmp_lower_paths[i]); /* drop refs at end of fxn */
+ path_get(&tmp_lower_paths[i]); /* drop refs at end of fxn */

/*******************************************************************
* For each branch command, do path_lookup on the requested branch,
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
...

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:59 am

From: Jan Blunck <jblunck@suse.de>

Use path_put() in a few places instead of {mnt,d}put()

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
fs/afs/mntpt.c | 3 +--
fs/namei.c | 15 +++++----------
2 files changed, 6 insertions(+), 12 deletions(-)

--- a/fs/afs/mntpt.c
+++ b/fs/afs/mntpt.c
@@ -235,8 +235,7 @@ static void *afs_mntpt_follow_link(struc
err = do_add_mount(newmnt, nd, MNT_SHRINKABLE, &afs_vfsmounts);
switch (err) {
case 0:
- dput(nd->path.dentry);
- mntput(nd->path.mnt);
+ path_put(&nd->path);
nd->path.mnt = newmnt;
nd->path.dentry = dget(newmnt->mnt_root);
schedule_delayed_work(&afs_mntpt_expiry_timer,
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -626,8 +626,7 @@ static __always_inline int __do_follow_l
if (dentry->d_inode->i_op->put_link)
dentry->d_inode->i_op->put_link(dentry, nd, cookie);
}
- dput(dentry);
- mntput(path->mnt);
+ path_put(path);

return error;
}
@@ -1034,8 +1033,7 @@ static int fastcall link_path_walk(const
result = __link_path_walk(name, nd);
}

- dput(save.path.dentry);
- mntput(save.path.mnt);
+ path_put(&save.path);

return result;
}
@@ -1057,8 +1055,7 @@ static int __emul_lookup_dentry(const ch

if (!nd->path.dentry->d_inode ||
S_ISDIR(nd->path.dentry->d_inode->i_mode)) {
- struct dentry *old_dentry = nd->path.dentry;
- struct vfsmount *old_mnt = nd->path.mnt;
+ struct path old_path = nd->path;
struct qstr last = nd->last;
int last_type = nd->last_type;
struct fs_struct *fs = current->fs;
@@ -1074,14 +1071,12 @@ static int __emul_lookup_dentry(const ch
read_unlock(&fs->lock);
if (path_walk(name, nd) == 0) {
if (nd->path.dentry->d_inode) {
- dput(old_dentry);
- m...

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:58 am

From: Jan Blunck <jblunck@suse.de>

Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
arch/alpha/kernel/osf_sys.c | 2
arch/mips/kernel/sysirix.c | 6
arch/parisc/hpux/sys_hpux.c | 2
arch/powerpc/platforms/cell/spufs/inode.c | 18 +-
arch/sparc64/solaris/fs.c | 8
arch/um/drivers/mconsole_kern.c | 6
drivers/md/dm-table.c | 2
drivers/mtd/mtdsuper.c | 10 -
fs/afs/mntpt.c | 22 +-
fs/autofs4/root.c | 3
fs/block_dev.c | 4
fs/coda/pioctl.c | 2
fs/compat.c | 4
fs/configfs/symlink.c | 4
fs/dquot.c | 7
fs/ecryptfs/dentry.c | 12 -
fs/ecryptfs/inode.c | 24 +-
fs/ecryptfs/main.c | 4
fs/exec.c | 4
fs/ext3/super.c | 4
fs/ext4/super.c | 4
fs/gfs2/ops_fstype.c | 5
fs/inotify_user.c | 2
fs/namei.c | 258 +++++++++++++++---------------
fs/namespace.c | 195 ++++++++++++----------
fs/nfs/dir.c | 2
fs/nfs/namespace.c | 27 +--
fs/nfs/nfs4proc.c | 15 -
fs/nfsctl.c | 2
fs/nfsd/export.c | 35 ++--
fs/nfsd/nfs4recover.c | 36 ++--
fs/nfsd/nfs4stat...

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:59 am

From: Jan Blunck <jblunck@suse.de>

* Add path_put() functions for releasing a reference to the dentry and
vfsmount of a struct path in the right order

* Switch from path_release(nd) to path_put(&nd->path)

* Rename dput_path() to path_put_conditional()

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
---
arch/alpha/kernel/osf_sys.c | 2
arch/mips/kernel/sysirix.c | 6 +-
arch/parisc/hpux/sys_hpux.c | 2
arch/powerpc/platforms/cell/spufs/syscalls.c | 2
arch/sparc64/solaris/fs.c | 4 -
drivers/md/dm-table.c | 2
drivers/mtd/mtdsuper.c | 4 -
fs/afs/mntpt.c | 2
fs/autofs4/root.c | 2
fs/block_dev.c | 2
fs/coda/pioctl.c | 4 -
fs/compat.c | 4 -
fs/configfs/symlink.c | 4 -
fs/dquot.c | 2
fs/ecryptfs/main.c | 2
fs/exec.c | 4 -
fs/ext3/super.c | 4 -
fs/ext4/super.c | 4 -
fs/gfs2/ops_fstype.c | 2
fs/inotify_user.c | 4 -
fs/namei.c | 56 ++++++++++++++-------------
fs/namespace.c | 20 ++++-----
fs/nfs/namespace.c | 2
fs/nfsctl.c | 2
fs/nfsd/export.c | 10 ++--
fs/nfsd/nfs4recover.c | 2
fs/nfsd/nfs4state.c | 2
fs/open.c | 22...

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:57 am

From: Jan Blunck <jblunck@suse.de>

Move the definition of struct path into its own header file for further
patches.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
include/linux/namei.h | 6 +-----
include/linux/path.h | 12 ++++++++++++
2 files changed, 13 insertions(+), 5 deletions(-)

--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -4,6 +4,7 @@
#include <linux/dcache.h>
#include <linux/linkage.h>
#include <linux/mount.h>
+#include <linux/path.h>

struct vfsmount;

@@ -30,11 +31,6 @@ struct nameidata {
} intent;
};

-struct path {
- struct vfsmount *mnt;
- struct dentry *dentry;
-};
-
/*
* Type of the last component on LOOKUP_PARENT
*/
--- /dev/null
+++ b/include/linux/path.h
@@ -0,0 +1,12 @@
+#ifndef _LINUX_PATH_H
+#define _LINUX_PATH_H
+
+struct dentry;
+struct vfsmount;
+
+struct path {
+ struct vfsmount *mnt;
+ struct dentry *dentry;
+};
+
+#endif /* _LINUX_PATH_H */
-

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:56 am

From: Jan Blunck <jblunck@suse.de>

path_release_on_umount() should only be called from sys_umount(). I merged the
function into sys_umount() instead of having in in namei.c.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
fs/namei.c | 10 ----------
fs/namespace.c | 4 +++-
include/linux/namei.h | 1 -
3 files changed, 3 insertions(+), 12 deletions(-)

--- a/fs/namei.c
+++ b/fs/namei.c
@@ -368,16 +368,6 @@ void path_release(struct nameidata *nd)
mntput(nd->mnt);
}

-/*
- * umount() mustn't call path_release()/mntput() as that would clear
- * mnt_expiry_mark
- */
-void path_release_on_umount(struct nameidata *nd)
-{
- dput(nd->dentry);
- mntput_no_expire(nd->mnt);
-}
-
/**
* release_open_intent - free up open intent resources
* @nd: pointer to nameidata
--- a/fs/namespace.c
+++ b/fs/namespace.c
@@ -988,7 +988,9 @@ asmlinkage long sys_umount(char __user *

retval = do_umount(nd.mnt, flags);
dput_and_out:
- path_release_on_umount(&nd);
+ /* we mustn't call path_put() as that would clear mnt_expiry_mark */
+ dput(nd.dentry);
+ mntput_no_expire(nd.mnt);
out:
return retval;
}
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -73,7 +73,6 @@ extern int FASTCALL(path_lookup(const ch
extern int vfs_path_lookup(struct dentry *, struct vfsmount *,
const char *, unsigned int, struct nameidata *);
extern void path_release(struct nameidata *);
-extern void path_release_on_umount(struct nameidata *);

extern int __user_path_lookup_open(const char __user *, unsigned lookup_flags, struct nameidata *nd, int open_flags);
extern int path_lookup_open(int dfd, const char *name, unsigned lookup_flags, struct nameidata *, int open_flags);
-

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:55 am

From: Jan Blunck <jblunck@suse.de>

This test seems to be unnecessary since we always have rootfs mounted before
calling a usermodehelper.

Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
kernel/kmod.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)

--- a/kernel/kmod.c
+++ b/kernel/kmod.c
@@ -173,10 +173,7 @@ static int ____call_usermodehelper(void
*/
set_user_nice(current, 0);

- retval = -EPERM;
- if (current->fs->root)
- retval = kernel_execve(sub_info->path,
- sub_info->argv, sub_info->envp);
+ retval = kernel_execve(sub_info->path, sub_info->argv, sub_info->envp);

/* Exec failed? */
sub_info->retval = retval;
-

To: Andrew Morton <akpm@...>
Cc: Jan Blunck <jblunck@...>, Andreas Gruenbacher <agruen@...>, Christoph Hellwig <hch@...>, <viro@...>, <linux-kernel@...>
Date: Monday, October 22, 2007 - 2:54 am

From: Jan Blunck <jblunck@suse.de>

The sound drivers and the pnpbios core test for current->root != NULL. This
test seems to be unnecessary since we always have rootfs mounted before
initializing the drivers.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Acked-by: Christoph Hellwig <hch@lst.de>
---
drivers/pnp/pnpbios/core.c | 2 --
sound/core/seq/seq_clientmgr.c | 4 ++--
sound/core/seq/seq_device.c | 3 ---
sound/core/sound.c | 4 ----
sound/core/timer.c | 2 --
sound/ppc/daca.c | 5 ++---
sound/ppc/tumbler.c | 5 ++---
7 files changed, 6 insertions(+), 19 deletions(-)

--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -105,8 +105,6 @@ static int pnp_dock_event(int dock, stru
char *argv[3], **envp, *buf, *scratch;
int i = 0, value;

- if (!current->fs->root)
- return -EAGAIN;
if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL)))
return -ENOMEM;
if (!(buf = kzalloc(256, GFP_KERNEL))) {
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -152,13 +152,13 @@ struct snd_seq_client *snd_seq_client_us
}
spin_unlock_irqrestore(&clients_lock, flags);
#ifdef CONFIG_KMOD
- if (!in_interrupt() && current->fs->root) {
+ if (!in_interrupt()) {
static char client_requested[SNDRV_SEQ_GLOBAL_CLIENTS];
static char card_requested[SNDRV_CARDS];
if (clientid < SNDRV_SEQ_GLOBAL_CLIENTS) {
int idx;

- if (! client_requested[clientid] && current->fs->root) {
+ if (!client_requested[clientid]) {
client_requested[clientid] = 1;
for (idx = 0; idx < 15; idx++) {
if (seq_client_load[idx] < 0)
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -150,9 +150,6 @@ void snd_seq_device_load_drivers(void)
if (snd_seq_in_init)
return;

- if (! current->fs->roo...

Previous thread: 100% iowait on one of cpus in current -git by Maxim Levitsky on Monday, October 22, 2007 - 2:22 am. (22 messages)

Next thread: [PATCH -v6 3/3] x86 boot: document for 32 bit boot protocol by Huang, Ying on Monday, October 22, 2007 - 3:17 am. (1 message)