Embed a struct path into struct nameidata instead of nd->{dentry,mnt}
This is the central patch of a cleanup series. In most cases there is no good
reason why someone would want to use a dentry for itself. This series reflects
that fact and embeds a struct path into nameidata.
Together with the other patches of this series
- it enforced the correct order of getting/releasing the reference count on
<dentry,vfsmount> pairs
- it prepares the VFS for stacking support since it is essential to have a
struct path in every place where the stack can be traversed
- it reduces the overall code size:
without patch series:
text data bss dec hex filename
5321639 858418 715768 6895825 6938d1 vmlinux
with patch series:
text data bss dec hex filename
5320026 858418 715768 6894212
693284 vmlinux
This patch:
Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.
[akpm@linux-foundation.org: coding-style fixes]
[akpm@linux-foundation.org: fix cifs]
[akpm@linux-foundation.org: fix smack]
Signed-off-by: Jan Blunck <jblunck@suse.de>
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
Acked-by: Christoph Hellwig <hch@lst.de>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Casey Schaufler <casey@schaufler-ca.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
c5e725f33b
commit
4ac9137858
@@ -120,9 +120,9 @@ out_no_tfm:
|
||||
static void
|
||||
nfsd4_sync_rec_dir(void)
|
||||
{
|
||||
mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
|
||||
nfsd_sync_dir(rec_dir.dentry);
|
||||
mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
|
||||
mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
|
||||
nfsd_sync_dir(rec_dir.path.dentry);
|
||||
mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -142,9 +142,9 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
|
||||
nfs4_save_user(&uid, &gid);
|
||||
|
||||
/* lock the parent */
|
||||
mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
|
||||
mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
|
||||
|
||||
dentry = lookup_one_len(dname, rec_dir.dentry, HEXDIR_LEN-1);
|
||||
dentry = lookup_one_len(dname, rec_dir.path.dentry, HEXDIR_LEN-1);
|
||||
if (IS_ERR(dentry)) {
|
||||
status = PTR_ERR(dentry);
|
||||
goto out_unlock;
|
||||
@@ -154,11 +154,11 @@ nfsd4_create_clid_dir(struct nfs4_client *clp)
|
||||
dprintk("NFSD: nfsd4_create_clid_dir: DIRECTORY EXISTS\n");
|
||||
goto out_put;
|
||||
}
|
||||
status = vfs_mkdir(rec_dir.dentry->d_inode, dentry, S_IRWXU);
|
||||
status = vfs_mkdir(rec_dir.path.dentry->d_inode, dentry, S_IRWXU);
|
||||
out_put:
|
||||
dput(dentry);
|
||||
out_unlock:
|
||||
mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
|
||||
mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
|
||||
if (status == 0) {
|
||||
clp->cl_firststate = 1;
|
||||
nfsd4_sync_rec_dir();
|
||||
@@ -221,7 +221,7 @@ nfsd4_list_rec_dir(struct dentry *dir, recdir_func *f)
|
||||
|
||||
nfs4_save_user(&uid, &gid);
|
||||
|
||||
filp = dentry_open(dget(dir), mntget(rec_dir.mnt), O_RDONLY);
|
||||
filp = dentry_open(dget(dir), mntget(rec_dir.path.mnt), O_RDONLY);
|
||||
status = PTR_ERR(filp);
|
||||
if (IS_ERR(filp))
|
||||
goto out;
|
||||
@@ -286,9 +286,9 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
|
||||
|
||||
dprintk("NFSD: nfsd4_unlink_clid_dir. name %.*s\n", namlen, name);
|
||||
|
||||
mutex_lock(&rec_dir.dentry->d_inode->i_mutex);
|
||||
dentry = lookup_one_len(name, rec_dir.dentry, namlen);
|
||||
mutex_unlock(&rec_dir.dentry->d_inode->i_mutex);
|
||||
mutex_lock(&rec_dir.path.dentry->d_inode->i_mutex);
|
||||
dentry = lookup_one_len(name, rec_dir.path.dentry, namlen);
|
||||
mutex_unlock(&rec_dir.path.dentry->d_inode->i_mutex);
|
||||
if (IS_ERR(dentry)) {
|
||||
status = PTR_ERR(dentry);
|
||||
return status;
|
||||
@@ -297,7 +297,7 @@ nfsd4_unlink_clid_dir(char *name, int namlen)
|
||||
if (!dentry->d_inode)
|
||||
goto out;
|
||||
|
||||
status = nfsd4_clear_clid_dir(rec_dir.dentry, dentry);
|
||||
status = nfsd4_clear_clid_dir(rec_dir.path.dentry, dentry);
|
||||
out:
|
||||
dput(dentry);
|
||||
return status;
|
||||
@@ -347,12 +347,12 @@ nfsd4_recdir_purge_old(void) {
|
||||
|
||||
if (!rec_dir_init)
|
||||
return;
|
||||
status = nfsd4_list_rec_dir(rec_dir.dentry, purge_old);
|
||||
status = nfsd4_list_rec_dir(rec_dir.path.dentry, purge_old);
|
||||
if (status == 0)
|
||||
nfsd4_sync_rec_dir();
|
||||
if (status)
|
||||
printk("nfsd4: failed to purge old clients from recovery"
|
||||
" directory %s\n", rec_dir.dentry->d_name.name);
|
||||
" directory %s\n", rec_dir.path.dentry->d_name.name);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -373,10 +373,10 @@ int
|
||||
nfsd4_recdir_load(void) {
|
||||
int status;
|
||||
|
||||
status = nfsd4_list_rec_dir(rec_dir.dentry, load_recdir);
|
||||
status = nfsd4_list_rec_dir(rec_dir.path.dentry, load_recdir);
|
||||
if (status)
|
||||
printk("nfsd4: failed loading clients from recovery"
|
||||
" directory %s\n", rec_dir.dentry->d_name.name);
|
||||
" directory %s\n", rec_dir.path.dentry->d_name.name);
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user