mirror of
https://gitlab.com/apparmor/apparmor.git
synced 2025-03-04 08:24:42 +01:00
Minor parameter passing cleanup in fs/nfsd/vfs.c
This commit is contained in:
parent
6dc1c8e7e2
commit
0aaaab25e3
7 changed files with 133 additions and 40 deletions
|
@ -11,10 +11,10 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
Cc: Miklos Szeredi <mszeredi@suse.cz>
|
||||
|
||||
---
|
||||
fs/nfsd/vfs.c | 11 ++++++-----
|
||||
fs/nfsd/vfs.c | 12 +++++++-----
|
||||
fs/open.c | 16 +++++++++++-----
|
||||
include/linux/fs.h | 3 +++
|
||||
3 files changed, 20 insertions(+), 10 deletions(-)
|
||||
3 files changed, 21 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/fs/nfsd/vfs.c
|
||||
+++ b/fs/nfsd/vfs.c
|
||||
|
@ -45,19 +45,19 @@ Cc: Miklos Szeredi <mszeredi@suse.cz>
|
|||
out:
|
||||
kfree(buf);
|
||||
return error;
|
||||
@@ -1987,13 +1987,14 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
|
||||
@@ -1992,12 +1992,14 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
|
||||
|
||||
mnt = fhp->fh_export->ex_mnt;
|
||||
if (size)
|
||||
error = vfs_setxattr(fhp->fh_dentry, fhp->fh_export->ex_mnt,
|
||||
- name, value, size,0);
|
||||
+ name, value, size, 0, NULL);
|
||||
- error = vfs_setxattr(fhp->fh_dentry, mnt, name, value, size,0);
|
||||
+ error = vfs_setxattr(fhp->fh_dentry, mnt, name, value, size, 0,
|
||||
+ NULL);
|
||||
else {
|
||||
if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT)
|
||||
error = 0;
|
||||
else {
|
||||
error = vfs_removexattr(fhp->fh_dentry,
|
||||
- fhp->fh_export->ex_mnt, name);
|
||||
+ fhp->fh_export->ex_mnt, name,
|
||||
- error = vfs_removexattr(fhp->fh_dentry, mnt, name);
|
||||
+ error = vfs_removexattr(fhp->fh_dentry, mnt, name,
|
||||
+ NULL);
|
||||
if (error == -ENODATA)
|
||||
error = 0;
|
||||
|
|
|
@ -12,9 +12,9 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
fs/ecryptfs/inode.c | 5 ++++-
|
||||
fs/namei.c | 5 +++--
|
||||
fs/nfsd/nfs4recover.c | 3 ++-
|
||||
fs/nfsd/vfs.c | 3 ++-
|
||||
fs/nfsd/vfs.c | 8 +++++---
|
||||
include/linux/fs.h | 2 +-
|
||||
5 files changed, 12 insertions(+), 6 deletions(-)
|
||||
5 files changed, 15 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/fs/ecryptfs/inode.c
|
||||
+++ b/fs/ecryptfs/inode.c
|
||||
|
@ -69,16 +69,49 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
out_unlock:
|
||||
--- a/fs/nfsd/vfs.c
|
||||
+++ b/fs/nfsd/vfs.c
|
||||
@@ -1186,7 +1186,8 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
@@ -1115,6 +1115,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
int type, dev_t rdev, struct svc_fh *resfhp)
|
||||
{
|
||||
struct dentry *dentry, *dchild = NULL;
|
||||
+ struct svc_export *exp;
|
||||
struct inode *dirp;
|
||||
__be32 err;
|
||||
int host_err;
|
||||
@@ -1131,6 +1132,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
goto out;
|
||||
|
||||
dentry = fhp->fh_dentry;
|
||||
+ exp = fhp->fh_export;
|
||||
dirp = dentry->d_inode;
|
||||
|
||||
err = nfserr_notdir;
|
||||
@@ -1147,7 +1149,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
host_err = PTR_ERR(dchild);
|
||||
if (IS_ERR(dchild))
|
||||
goto out_nfserr;
|
||||
- err = fh_compose(resfhp, fhp->fh_export, dchild, fhp);
|
||||
+ err = fh_compose(resfhp, exp, dchild, fhp);
|
||||
if (err)
|
||||
goto out;
|
||||
} else {
|
||||
@@ -1186,7 +1188,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
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, fhp->fh_export->ex_mnt,
|
||||
+ iap->ia_mode);
|
||||
+ host_err = vfs_mkdir(dirp, dchild, exp->ex_mnt, iap->ia_mode);
|
||||
break;
|
||||
case S_IFCHR:
|
||||
case S_IFBLK:
|
||||
@@ -1201,7 +1203,7 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
if (host_err < 0)
|
||||
goto out_nfserr;
|
||||
|
||||
- if (EX_ISSYNC(fhp->fh_export)) {
|
||||
+ if (EX_ISSYNC(exp)) {
|
||||
err = nfserrno(nfsd_sync_dir(dentry));
|
||||
write_inode_now(dchild->d_inode, 1);
|
||||
}
|
||||
--- a/include/linux/fs.h
|
||||
+++ b/include/linux/fs.h
|
||||
@@ -980,7 +980,7 @@ extern void unlock_super(struct super_bl
|
||||
|
|
|
@ -64,13 +64,13 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
error = -EPERM;
|
||||
--- a/fs/nfsd/vfs.c
|
||||
+++ b/fs/nfsd/vfs.c
|
||||
@@ -1193,7 +1193,8 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
@@ -1194,7 +1194,8 @@ nfsd_create(struct svc_rqst *rqstp, stru
|
||||
case S_IFBLK:
|
||||
case S_IFIFO:
|
||||
case S_IFSOCK:
|
||||
- host_err = vfs_mknod(dirp, dchild, iap->ia_mode, rdev);
|
||||
+ host_err = vfs_mknod(dirp, dchild, fhp->fh_export->ex_mnt,
|
||||
+ iap->ia_mode, rdev);
|
||||
+ host_err = vfs_mknod(dirp, dchild, exp->ex_mnt, iap->ia_mode,
|
||||
+ rdev);
|
||||
break;
|
||||
default:
|
||||
printk("nfsd: bad file type %o in nfsd_create\n", type);
|
||||
|
|
|
@ -9,20 +9,36 @@ Signed-off-by: Andreas Gruenbacher <agruen@suse.de>
|
|||
Signed-off-by: John Johansen <jjohansen@suse.de>
|
||||
|
||||
---
|
||||
fs/nfsd/vfs.c | 3 ++-
|
||||
fs/nfsd/vfs.c | 7 ++++---
|
||||
fs/xattr.c | 12 ++++++------
|
||||
include/linux/xattr.h | 2 +-
|
||||
3 files changed, 9 insertions(+), 8 deletions(-)
|
||||
3 files changed, 11 insertions(+), 10 deletions(-)
|
||||
|
||||
--- a/fs/nfsd/vfs.c
|
||||
+++ b/fs/nfsd/vfs.c
|
||||
@@ -1992,7 +1992,8 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
|
||||
@@ -1957,6 +1957,7 @@ nfsd_get_posix_acl(struct svc_fh *fhp, i
|
||||
int
|
||||
nfsd_set_posix_acl(struct svc_fh *fhp, int type, struct posix_acl *acl)
|
||||
{
|
||||
+ struct vfsmount *mnt;
|
||||
struct inode *inode = fhp->fh_dentry->d_inode;
|
||||
char *name;
|
||||
void *value = NULL;
|
||||
@@ -1989,14 +1990,14 @@ nfsd_set_posix_acl(struct svc_fh *fhp, i
|
||||
} else
|
||||
size = 0;
|
||||
|
||||
+ mnt = fhp->fh_export->ex_mnt;
|
||||
if (size)
|
||||
- error = vfs_setxattr(fhp->fh_dentry, fhp->fh_export->ex_mnt,
|
||||
- name, value, size,0);
|
||||
+ error = vfs_setxattr(fhp->fh_dentry, mnt, name, value, size,0);
|
||||
else {
|
||||
if (!S_ISDIR(inode->i_mode) && type == ACL_TYPE_DEFAULT)
|
||||
error = 0;
|
||||
else {
|
||||
- error = vfs_removexattr(fhp->fh_dentry, name);
|
||||
+ error = vfs_removexattr(fhp->fh_dentry,
|
||||
+ fhp->fh_export->ex_mnt, name);
|
||||
+ error = vfs_removexattr(fhp->fh_dentry, mnt, name);
|
||||
if (error == -ENODATA)
|
||||
error = 0;
|
||||
}
|
||||
|
|
|
@ -12,10 +12,10 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
fs/ecryptfs/inode.c | 4 +++-
|
||||
fs/namei.c | 4 ++--
|
||||
fs/nfsd/nfs4recover.c | 2 +-
|
||||
fs/nfsd/vfs.c | 2 +-
|
||||
fs/nfsd/vfs.c | 8 +++++---
|
||||
fs/reiserfs/xattr.c | 2 +-
|
||||
include/linux/fs.h | 2 +-
|
||||
6 files changed, 9 insertions(+), 7 deletions(-)
|
||||
6 files changed, 13 insertions(+), 9 deletions(-)
|
||||
|
||||
--- a/fs/ecryptfs/inode.c
|
||||
+++ b/fs/ecryptfs/inode.c
|
||||
|
@ -70,15 +70,47 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
}
|
||||
--- a/fs/nfsd/vfs.c
|
||||
+++ b/fs/nfsd/vfs.c
|
||||
@@ -1702,7 +1702,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
|
||||
@@ -1666,6 +1666,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
|
||||
char *fname, int flen)
|
||||
{
|
||||
struct dentry *dentry, *rdentry;
|
||||
+ struct svc_export *exp;
|
||||
struct inode *dirp;
|
||||
__be32 err;
|
||||
int host_err;
|
||||
@@ -1680,6 +1681,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
|
||||
fh_lock_nested(fhp, I_MUTEX_PARENT);
|
||||
dentry = fhp->fh_dentry;
|
||||
dirp = dentry->d_inode;
|
||||
+ exp = fhp->fh_export;
|
||||
|
||||
rdentry = lookup_one_len(fname, dentry, flen);
|
||||
host_err = PTR_ERR(rdentry);
|
||||
@@ -1697,21 +1699,21 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
|
||||
|
||||
if (type != S_IFDIR) { /* It's UNLINK */
|
||||
#ifdef MSNFS
|
||||
- if ((fhp->fh_export->ex_flags & NFSEXP_MSNFS) &&
|
||||
+ if ((exp->ex_flags & NFSEXP_MSNFS) &&
|
||||
(atomic_read(&rdentry->d_count) > 1)) {
|
||||
host_err = -EPERM;
|
||||
} else
|
||||
#endif
|
||||
host_err = vfs_unlink(dirp, rdentry);
|
||||
} else { /* It's RMDIR */
|
||||
- host_err = vfs_rmdir(dirp, rdentry);
|
||||
+ host_err = vfs_rmdir(dirp, rdentry, fhp->fh_export->ex_mnt);
|
||||
+ host_err = vfs_rmdir(dirp, rdentry, exp->ex_mnt);
|
||||
}
|
||||
|
||||
dput(rdentry);
|
||||
|
||||
if (host_err)
|
||||
goto out_nfserr;
|
||||
- if (EX_ISSYNC(fhp->fh_export))
|
||||
+ if (EX_ISSYNC(exp))
|
||||
host_err = nfsd_sync_dir(dentry);
|
||||
|
||||
out_nfserr:
|
||||
--- a/fs/reiserfs/xattr.c
|
||||
+++ b/fs/reiserfs/xattr.c
|
||||
@@ -823,7 +823,7 @@ int reiserfs_delete_xattrs(struct inode
|
||||
|
|
|
@ -11,9 +11,9 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
---
|
||||
fs/ecryptfs/inode.c | 4 +++-
|
||||
fs/namei.c | 6 ++++--
|
||||
fs/nfsd/vfs.c | 7 +++++--
|
||||
fs/nfsd/vfs.c | 12 ++++++++----
|
||||
include/linux/fs.h | 2 +-
|
||||
4 files changed, 13 insertions(+), 6 deletions(-)
|
||||
4 files changed, 16 insertions(+), 8 deletions(-)
|
||||
|
||||
--- a/fs/ecryptfs/inode.c
|
||||
+++ b/fs/ecryptfs/inode.c
|
||||
|
@ -66,37 +66,49 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
mutex_unlock(&nd.dentry->d_inode->i_mutex);
|
||||
--- a/fs/nfsd/vfs.c
|
||||
+++ b/fs/nfsd/vfs.c
|
||||
@@ -1435,6 +1435,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
|
||||
@@ -1436,6 +1436,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
|
||||
struct iattr *iap)
|
||||
{
|
||||
struct dentry *dentry, *dnew;
|
||||
+ struct vfsmount *mnt;
|
||||
+ struct svc_export *exp;
|
||||
__be32 err, cerr;
|
||||
int host_err;
|
||||
umode_t mode;
|
||||
@@ -1461,6 +1462,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
|
||||
@@ -1462,6 +1463,7 @@ nfsd_symlink(struct svc_rqst *rqstp, str
|
||||
if (iap && (iap->ia_valid & ATTR_MODE))
|
||||
mode = iap->ia_mode & S_IALLUGO;
|
||||
|
||||
+ mnt = fhp->fh_export->ex_mnt;
|
||||
+ exp = fhp->fh_export;
|
||||
if (unlikely(path[plen] != 0)) {
|
||||
char *path_alloced = kmalloc(plen+1, GFP_KERNEL);
|
||||
if (path_alloced == NULL)
|
||||
@@ -1468,11 +1470,12 @@ nfsd_symlink(struct svc_rqst *rqstp, str
|
||||
@@ -1469,20 +1471,22 @@ nfsd_symlink(struct svc_rqst *rqstp, str
|
||||
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, mnt,
|
||||
+ path_alloced, mode);
|
||||
+ host_err = vfs_symlink(dentry->d_inode, dnew,
|
||||
+ exp->ex_mnt, path_alloced, mode);
|
||||
kfree(path_alloced);
|
||||
}
|
||||
} else
|
||||
- host_err = vfs_symlink(dentry->d_inode, dnew, path, mode);
|
||||
+ host_err = vfs_symlink(dentry->d_inode, dnew, mnt, path, mode);
|
||||
+ host_err = vfs_symlink(dentry->d_inode, dnew, exp->ex_mnt, path,
|
||||
+ mode);
|
||||
|
||||
if (!host_err) {
|
||||
if (EX_ISSYNC(fhp->fh_export))
|
||||
- if (EX_ISSYNC(fhp->fh_export))
|
||||
+ if (EX_ISSYNC(exp))
|
||||
host_err = nfsd_sync_dir(dentry);
|
||||
}
|
||||
err = nfserrno(host_err);
|
||||
fh_unlock(fhp);
|
||||
|
||||
- cerr = fh_compose(resfhp, fhp->fh_export, dnew, fhp);
|
||||
+ cerr = fh_compose(resfhp, exp, dnew, fhp);
|
||||
dput(dnew);
|
||||
if (err==0) err = cerr;
|
||||
out:
|
||||
--- a/include/linux/fs.h
|
||||
+++ b/include/linux/fs.h
|
||||
@@ -982,7 +982,7 @@ extern int vfs_permission(struct nameida
|
||||
|
|
|
@ -65,14 +65,14 @@ Signed-off-by: John Johansen <jjohansen@suse.de>
|
|||
}
|
||||
--- a/fs/nfsd/vfs.c
|
||||
+++ b/fs/nfsd/vfs.c
|
||||
@@ -1700,7 +1700,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
|
||||
@@ -1704,7 +1704,7 @@ nfsd_unlink(struct svc_rqst *rqstp, stru
|
||||
host_err = -EPERM;
|
||||
} else
|
||||
#endif
|
||||
- host_err = vfs_unlink(dirp, rdentry);
|
||||
+ host_err = vfs_unlink(dirp, rdentry, fhp->fh_export->ex_mnt);
|
||||
+ host_err = vfs_unlink(dirp, rdentry, exp->ex_mnt);
|
||||
} else { /* It's RMDIR */
|
||||
host_err = vfs_rmdir(dirp, rdentry, fhp->fh_export->ex_mnt);
|
||||
host_err = vfs_rmdir(dirp, rdentry, exp->ex_mnt);
|
||||
}
|
||||
--- a/include/linux/fs.h
|
||||
+++ b/include/linux/fs.h
|
||||
|
|
Loading…
Add table
Reference in a new issue