~ubuntu-branches/ubuntu/hardy/apparmor/hardy-proposed

« back to all changes in this revision

Viewing changes to kernel-patches/for-mainline/vfs_symlink-args.diff

  • Committer: Bazaar Package Importer
  • Author(s): Mathias Gug
  • Date: 2007-09-11 10:44:56 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20070911104456-2a2vwe4wb0hxbc53
Tags: 2.1+961-0ubuntu1
* New upstream version.
  * Support resolvconf. Fix LP: #132468.
* Move package maintainance to bzr:
  * Apply all patches directly into the tree with dpatch apply-all.
  * debian/patches/: remove all patches as they are applied inline now.
  * debian/control, debian/control.modules.in: remove dpatch from
    Build Depends.
  * debian/rules:
    * remove dpatch include.
    * remove patch and unpatch dependencies
* debian/control:
  * Rename libapparmor-dev to libapparmor1-dev.
    Add Provides: and Conflict: tags.
  * Remove universe component in Section tag.
  * Remove apparmor-utils depends on bsdutils.
  * Update apparmor-modules Recommends to apparmor-modules-2.1.
* utils/:
  * Add audit man page.
* Fix mod_appamor library: remove rpath info.
  * debian/rules: remove rpath info.
  * debian/control: add chrpath as a build dependency.
* Remove apparmor-modules-source package:
  * debian/conrol: remove apparmor-modules-source package.
  * debian/apparmor.postinst, debian/apparmor.preinst,
    debian/apparmor.prerm: remove error_handler function.
  * debian/rules: remove error_handler option from dh_installinit.
  * debian/apparmor-modules-_KVERS_.postinst.modules.in,
    debian/control.modules.in: remove control and postinst files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
From: Andreas Gruenbacher <agruen@suse.de>
 
2
Subject: Pass nameidata2 to vfs_symlink()
 
3
 
 
4
Instead of passing independent dentry and vfsmount parameters, use a
 
5
nameidata2.
 
6
 
 
7
Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
 
8
 
 
9
---
 
10
 fs/ecryptfs/inode.c |   16 +++++++---------
 
11
 fs/namei.c          |   10 +++++-----
 
12
 fs/nfsd/vfs.c       |   18 +++++++++---------
 
13
 include/linux/fs.h  |    2 +-
 
14
 4 files changed, 22 insertions(+), 24 deletions(-)
 
15
 
 
16
--- a/fs/ecryptfs/inode.c
 
17
+++ b/fs/ecryptfs/inode.c
 
18
@@ -474,10 +474,9 @@ out_unlock:
 
19
 static int ecryptfs_symlink(struct inode *dir, struct dentry *dentry,
 
20
                            const char *symname)
 
21
 {
 
22
+       struct nameidata2 nd = {};
 
23
        int rc;
 
24
        struct dentry *lower_dentry;
 
25
-       struct vfsmount *lower_mnt;
 
26
-       struct dentry *lower_dir_dentry;
 
27
        umode_t mode;
 
28
        char *encoded_symname;
 
29
        unsigned int encoded_symlen;
 
30
@@ -485,8 +484,8 @@ static int ecryptfs_symlink(struct inode
 
31
 
 
32
        lower_dentry = ecryptfs_dentry_to_lower(dentry);
 
33
        dget(lower_dentry);
 
34
-       lower_mnt = ecryptfs_dentry_to_lower_mnt(dentry);
 
35
-       lower_dir_dentry = lock_parent(lower_dentry);
 
36
+       nd.mnt = ecryptfs_dentry_to_lower_mnt(dentry);
 
37
+       nd.dentry = lock_parent(lower_dentry);
 
38
        mode = S_IALLUGO;
 
39
        encoded_symlen = ecryptfs_encode_filename(crypt_stat, symname,
 
40
                                                  strlen(symname),
 
41
@@ -495,18 +494,17 @@ static int ecryptfs_symlink(struct inode
 
42
                rc = encoded_symlen;
 
43
                goto out_lock;
 
44
        }
 
45
-       rc = vfs_symlink(lower_dir_dentry->d_inode, lower_dentry, lower_mnt,
 
46
-                        encoded_symname, mode);
 
47
+       rc = vfs_symlink(&nd, lower_dentry, encoded_symname, mode);
 
48
        kfree(encoded_symname);
 
49
        if (rc || !lower_dentry->d_inode)
 
50
                goto out_lock;
 
51
        rc = ecryptfs_interpose(lower_dentry, dentry, dir->i_sb, 0);
 
52
        if (rc)
 
53
                goto out_lock;
 
54
-       fsstack_copy_attr_times(dir, lower_dir_dentry->d_inode);
 
55
-       fsstack_copy_inode_size(dir, lower_dir_dentry->d_inode);
 
56
+       fsstack_copy_attr_times(dir, nd.dentry->d_inode);
 
57
+       fsstack_copy_inode_size(dir, nd.dentry->d_inode);
 
58
 out_lock:
 
59
-       unlock_dir(lower_dir_dentry);
 
60
+       unlock_dir(nd.dentry);
 
61
        dput(lower_dentry);
 
62
        if (!dentry->d_inode)
 
63
                d_drop(dentry);
 
64
--- a/fs/namei.c
 
65
+++ b/fs/namei.c
 
66
@@ -2228,10 +2228,11 @@ asmlinkage long sys_unlink(const char __
 
67
        return do_unlinkat(AT_FDCWD, pathname);
 
68
 }
 
69
 
 
70
-int vfs_symlink(struct inode *dir, struct dentry *dentry, struct vfsmount *mnt,
 
71
+int vfs_symlink(struct nameidata2 *nd, struct dentry *dentry,
 
72
                const char *oldname, int mode)
 
73
 {
 
74
-       int error = may_create(dir, dentry, NULL);
 
75
+       struct inode *dir = nd->dentry->d_inode;
 
76
+       int error = may_create(dir, dentry, nd);
 
77
 
 
78
        if (error)
 
79
                return error;
 
80
@@ -2239,7 +2240,7 @@ int vfs_symlink(struct inode *dir, struc
 
81
        if (!dir->i_op || !dir->i_op->symlink)
 
82
                return -EPERM;
 
83
 
 
84
-       error = security_inode_symlink(dir, dentry, mnt, oldname);
 
85
+       error = security_inode_symlink(dir, dentry, nd->mnt, oldname);
 
86
        if (error)
 
87
                return error;
 
88
 
 
89
@@ -2275,8 +2276,7 @@ asmlinkage long sys_symlinkat(const char
 
90
        if (IS_ERR(dentry))
 
91
                goto out_unlock;
 
92
 
 
93
-       error = vfs_symlink(nd.dentry->d_inode, dentry, nd.mnt, from,
 
94
-                           S_IALLUGO);
 
95
+       error = vfs_symlink(ND2(&nd), dentry, from, S_IALLUGO);
 
96
        dput(dentry);
 
97
 out_unlock:
 
98
        mutex_unlock(&nd.dentry->d_inode->i_mutex);
 
99
--- a/fs/nfsd/vfs.c
 
100
+++ b/fs/nfsd/vfs.c
 
101
@@ -1447,7 +1447,8 @@ nfsd_symlink(struct svc_rqst *rqstp, str
 
102
                                struct svc_fh *resfhp,
 
103
                                struct iattr *iap)
 
104
 {
 
105
-       struct dentry   *dentry, *dnew;
 
106
+       struct nameidata2 nd = {};
 
107
+       struct dentry   *dnew;
 
108
        struct svc_export *exp;
 
109
        __be32          err, cerr;
 
110
        int             host_err;
 
111
@@ -1464,8 +1465,10 @@ nfsd_symlink(struct svc_rqst *rqstp, str
 
112
        if (err)
 
113
                goto out;
 
114
        fh_lock(fhp);
 
115
-       dentry = fhp->fh_dentry;
 
116
-       dnew = lookup_one_len(fname, dentry, flen);
 
117
+       nd.dentry = fhp->fh_dentry;
 
118
+       exp = fhp->fh_export;
 
119
+       nd.mnt = exp->ex_mnt;
 
120
+       dnew = lookup_one_len(fname, nd.dentry, flen);
 
121
        host_err = PTR_ERR(dnew);
 
122
        if (IS_ERR(dnew))
 
123
                goto out_nfserr;
 
124
@@ -1475,7 +1478,6 @@ nfsd_symlink(struct svc_rqst *rqstp, str
 
125
        if (iap && (iap->ia_valid & ATTR_MODE))
 
126
                mode = iap->ia_mode & S_IALLUGO;
 
127
 
 
128
-       exp = fhp->fh_export;
 
129
        if (unlikely(path[plen] != 0)) {
 
130
                char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
 
131
                if (path_alloced == NULL)
 
132
@@ -1483,17 +1485,15 @@ nfsd_symlink(struct svc_rqst *rqstp, str
 
133
                else {
 
134
                        strncpy(path_alloced, path, plen);
 
135
                        path_alloced[plen] = 0;
 
136
-                       host_err = vfs_symlink(dentry->d_inode, dnew,
 
137
-                                              exp->ex_mnt, path_alloced, mode);
 
138
+                       host_err = vfs_symlink(&nd, dnew, path_alloced, mode);
 
139
                        kfree(path_alloced);
 
140
                }
 
141
        } else
 
142
-               host_err = vfs_symlink(dentry->d_inode, dnew, exp->ex_mnt, path,
 
143
-                                      mode);
 
144
+               host_err = vfs_symlink(&nd, dnew, path, mode);
 
145
 
 
146
        if (!host_err) {
 
147
                if (EX_ISSYNC(exp))
 
148
-                       host_err = nfsd_sync_dir(dentry);
 
149
+                       host_err = nfsd_sync_dir(nd.dentry);
 
150
        }
 
151
        err = nfserrno(host_err);
 
152
        fh_unlock(fhp);
 
153
--- a/include/linux/fs.h
 
154
+++ b/include/linux/fs.h
 
155
@@ -991,7 +991,7 @@ extern int vfs_permission(struct nameida
 
156
 extern int vfs_create(struct nameidata2 *, struct dentry *, int);
 
157
 extern int vfs_mkdir(struct nameidata2 *, struct dentry *, int);
 
158
 extern int vfs_mknod(struct nameidata2 *, struct dentry *, int, dev_t);
 
159
-extern int vfs_symlink(struct inode *, struct dentry *, struct vfsmount *, const char *, int);
 
160
+extern int vfs_symlink(struct nameidata2 *, struct dentry *, const char *, int);
 
161
 extern int vfs_link(struct dentry *, struct vfsmount *, struct inode *, struct dentry *, struct vfsmount *);
 
162
 extern int vfs_rmdir(struct inode *, struct dentry *, struct vfsmount *);
 
163
 extern int vfs_unlink(struct inode *, struct dentry *, struct vfsmount *);