aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2013-01-24 02:18:08 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2013-02-26 02:46:08 -0500
commit3dadecce20603aa380023c65e6f55f108fd5e952 (patch)
tree9c6b1540787ba3c0c2342447bf1b35836b1e4314
parente72837e3e7bae3f182c4ac63c9424e86f1158dd0 (diff)
switch vfs_getattr() to struct path
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/base/devtmpfs.c3
-rw-r--r--drivers/base/firmware_class.c2
-rw-r--r--drivers/block/loop.c2
-rw-r--r--fs/ecryptfs/ecryptfs_kernel.h6
-rw-r--r--fs/ecryptfs/inode.c3
-rw-r--r--fs/nfsd/nfs3proc.c5
-rw-r--r--fs/nfsd/nfs3xdr.c10
-rw-r--r--fs/nfsd/nfs4xdr.c4
-rw-r--r--fs/nfsd/nfsproc.c12
-rw-r--r--fs/nfsd/nfsxdr.c3
-rw-r--r--fs/nfsd/vfs.h8
-rw-r--r--fs/stat.c13
-rw-r--r--include/linux/fs.h2
-rw-r--r--kernel/module.c2
14 files changed, 40 insertions, 35 deletions
diff --git a/drivers/base/devtmpfs.c b/drivers/base/devtmpfs.c
index 17cf7cad601e..01fc5b07f951 100644
--- a/drivers/base/devtmpfs.c
+++ b/drivers/base/devtmpfs.c
@@ -302,7 +302,8 @@ static int handle_remove(const char *nodename, struct device *dev)
302 302
303 if (dentry->d_inode) { 303 if (dentry->d_inode) {
304 struct kstat stat; 304 struct kstat stat;
305 err = vfs_getattr(parent.mnt, dentry, &stat); 305 struct path p = {.mnt = parent.mnt, .dentry = dentry};
306 err = vfs_getattr(&p, &stat);
306 if (!err && dev_mynode(dev, dentry->d_inode, &stat)) { 307 if (!err && dev_mynode(dev, dentry->d_inode, &stat)) {
307 struct iattr newattrs; 308 struct iattr newattrs;
308 /* 309 /*
diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index b392b353be39..a2be09dd7771 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -290,7 +290,7 @@ MODULE_PARM_DESC(path, "customized firmware image search path with a higher prio
290static noinline_for_stack long fw_file_size(struct file *file) 290static noinline_for_stack long fw_file_size(struct file *file)
291{ 291{
292 struct kstat st; 292 struct kstat st;
293 if (vfs_getattr(file->f_path.mnt, file->f_path.dentry, &st)) 293 if (vfs_getattr(&file->f_path, &st))
294 return -1; 294 return -1;
295 if (!S_ISREG(st.mode)) 295 if (!S_ISREG(st.mode))
296 return -1; 296 return -1;
diff --git a/drivers/block/loop.c b/drivers/block/loop.c
index ae1251270624..8031a8cdd698 100644
--- a/drivers/block/loop.c
+++ b/drivers/block/loop.c
@@ -1139,7 +1139,7 @@ loop_get_status(struct loop_device *lo, struct loop_info64 *info)
1139 1139
1140 if (lo->lo_state != Lo_bound) 1140 if (lo->lo_state != Lo_bound)
1141 return -ENXIO; 1141 return -ENXIO;
1142 error = vfs_getattr(file->f_path.mnt, file->f_path.dentry, &stat); 1142 error = vfs_getattr(&file->f_path, &stat);
1143 if (error) 1143 if (error)
1144 return error; 1144 return error;
1145 memset(info, 0, sizeof(*info)); 1145 memset(info, 0, sizeof(*info));
diff --git a/fs/ecryptfs/ecryptfs_kernel.h b/fs/ecryptfs/ecryptfs_kernel.h
index cfb4b9fed520..7e2c6f5d7985 100644
--- a/fs/ecryptfs/ecryptfs_kernel.h
+++ b/fs/ecryptfs/ecryptfs_kernel.h
@@ -509,6 +509,12 @@ ecryptfs_dentry_to_lower_mnt(struct dentry *dentry)
509 return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt; 509 return ((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path.mnt;
510} 510}
511 511
512static inline struct path *
513ecryptfs_dentry_to_lower_path(struct dentry *dentry)
514{
515 return &((struct ecryptfs_dentry_info *)dentry->d_fsdata)->lower_path;
516}
517
512static inline void 518static inline void
513ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt) 519ecryptfs_set_dentry_lower_mnt(struct dentry *dentry, struct vfsmount *lower_mnt)
514{ 520{
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c
index cc7709e7c508..e0f07fb6d56b 100644
--- a/fs/ecryptfs/inode.c
+++ b/fs/ecryptfs/inode.c
@@ -1027,8 +1027,7 @@ int ecryptfs_getattr(struct vfsmount *mnt, struct dentry *dentry,
1027 struct kstat lower_stat; 1027 struct kstat lower_stat;
1028 int rc; 1028 int rc;
1029 1029
1030 rc = vfs_getattr(ecryptfs_dentry_to_lower_mnt(dentry), 1030 rc = vfs_getattr(ecryptfs_dentry_to_lower_path(dentry), &lower_stat);
1031 ecryptfs_dentry_to_lower(dentry), &lower_stat);
1032 if (!rc) { 1031 if (!rc) {
1033 fsstack_copy_attr_all(dentry->d_inode, 1032 fsstack_copy_attr_all(dentry->d_inode,
1034 ecryptfs_inode_to_lower(dentry->d_inode)); 1033 ecryptfs_inode_to_lower(dentry->d_inode));
diff --git a/fs/nfsd/nfs3proc.c b/fs/nfsd/nfs3proc.c
index 1fc02dfdc5c4..401289913130 100644
--- a/fs/nfsd/nfs3proc.c
+++ b/fs/nfsd/nfs3proc.c
@@ -43,7 +43,6 @@ static __be32
43nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp, 43nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
44 struct nfsd3_attrstat *resp) 44 struct nfsd3_attrstat *resp)
45{ 45{
46 int err;
47 __be32 nfserr; 46 __be32 nfserr;
48 47
49 dprintk("nfsd: GETATTR(3) %s\n", 48 dprintk("nfsd: GETATTR(3) %s\n",
@@ -55,9 +54,7 @@ nfsd3_proc_getattr(struct svc_rqst *rqstp, struct nfsd_fhandle *argp,
55 if (nfserr) 54 if (nfserr)
56 RETURN_STATUS(nfserr); 55 RETURN_STATUS(nfserr);
57 56
58 err = vfs_getattr(resp->fh.fh_export->ex_path.mnt, 57 nfserr = fh_getattr(&resp->fh, &resp->stat);
59 resp->fh.fh_dentry, &resp->stat);
60 nfserr = nfserrno(err);
61 58
62 RETURN_STATUS(nfserr); 59 RETURN_STATUS(nfserr);
63} 60}
diff --git a/fs/nfsd/nfs3xdr.c b/fs/nfsd/nfs3xdr.c
index 324c0baf7cda..7af9417be88d 100644
--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -11,6 +11,7 @@
11#include "xdr3.h" 11#include "xdr3.h"
12#include "auth.h" 12#include "auth.h"
13#include "netns.h" 13#include "netns.h"
14#include "vfs.h"
14 15
15#define NFSDDBG_FACILITY NFSDDBG_XDR 16#define NFSDDBG_FACILITY NFSDDBG_XDR
16 17
@@ -204,10 +205,10 @@ encode_post_op_attr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
204{ 205{
205 struct dentry *dentry = fhp->fh_dentry; 206 struct dentry *dentry = fhp->fh_dentry;
206 if (dentry && dentry->d_inode) { 207 if (dentry && dentry->d_inode) {
207 int err; 208 __be32 err;
208 struct kstat stat; 209 struct kstat stat;
209 210
210 err = vfs_getattr(fhp->fh_export->ex_path.mnt, dentry, &stat); 211 err = fh_getattr(fhp, &stat);
211 if (!err) { 212 if (!err) {
212 *p++ = xdr_one; /* attributes follow */ 213 *p++ = xdr_one; /* attributes follow */
213 lease_get_mtime(dentry->d_inode, &stat.mtime); 214 lease_get_mtime(dentry->d_inode, &stat.mtime);
@@ -254,13 +255,12 @@ encode_wcc_data(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
254 */ 255 */
255void fill_post_wcc(struct svc_fh *fhp) 256void fill_post_wcc(struct svc_fh *fhp)
256{ 257{
257 int err; 258 __be32 err;
258 259
259 if (fhp->fh_post_saved) 260 if (fhp->fh_post_saved)
260 printk("nfsd: inode locked twice during operation.\n"); 261 printk("nfsd: inode locked twice during operation.\n");
261 262
262 err = vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, 263 err = fh_getattr(fhp, &fhp->fh_post_attr);
263 &fhp->fh_post_attr);
264 fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; 264 fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version;
265 if (err) { 265 if (err) {
266 fhp->fh_post_saved = 0; 266 fhp->fh_post_saved = 0;
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 0dc11586682f..17e70dabe21c 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1997,7 +1997,7 @@ static int get_parent_attributes(struct svc_export *exp, struct kstat *stat)
1997 if (path.dentry != path.mnt->mnt_root) 1997 if (path.dentry != path.mnt->mnt_root)
1998 break; 1998 break;
1999 } 1999 }
2000 err = vfs_getattr(path.mnt, path.dentry, stat); 2000 err = vfs_getattr(&path, stat);
2001 path_put(&path); 2001 path_put(&path);
2002 return err; 2002 return err;
2003} 2003}
@@ -2050,7 +2050,7 @@ nfsd4_encode_fattr(struct svc_fh *fhp, struct svc_export *exp,
2050 goto out; 2050 goto out;
2051 } 2051 }
2052 2052
2053 err = vfs_getattr(exp->ex_path.mnt, dentry, &stat); 2053 err = vfs_getattr(&path, &stat);
2054 if (err) 2054 if (err)
2055 goto out_nfserr; 2055 goto out_nfserr;
2056 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL | 2056 if ((bmval0 & (FATTR4_WORD0_FILES_FREE | FATTR4_WORD0_FILES_TOTAL |
diff --git a/fs/nfsd/nfsproc.c b/fs/nfsd/nfsproc.c
index aad6d457b9e8..54c6b3d3cc79 100644
--- a/fs/nfsd/nfsproc.c
+++ b/fs/nfsd/nfsproc.c
@@ -26,17 +26,13 @@ static __be32
26nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp) 26nfsd_return_attrs(__be32 err, struct nfsd_attrstat *resp)
27{ 27{
28 if (err) return err; 28 if (err) return err;
29 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, 29 return fh_getattr(&resp->fh, &resp->stat);
30 resp->fh.fh_dentry,
31 &resp->stat));
32} 30}
33static __be32 31static __be32
34nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp) 32nfsd_return_dirop(__be32 err, struct nfsd_diropres *resp)
35{ 33{
36 if (err) return err; 34 if (err) return err;
37 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, 35 return fh_getattr(&resp->fh, &resp->stat);
38 resp->fh.fh_dentry,
39 &resp->stat));
40} 36}
41/* 37/*
42 * Get a file's attributes 38 * Get a file's attributes
@@ -150,9 +146,7 @@ nfsd_proc_read(struct svc_rqst *rqstp, struct nfsd_readargs *argp,
150 &resp->count); 146 &resp->count);
151 147
152 if (nfserr) return nfserr; 148 if (nfserr) return nfserr;
153 return nfserrno(vfs_getattr(resp->fh.fh_export->ex_path.mnt, 149 return fh_getattr(&resp->fh, &resp->stat);
154 resp->fh.fh_dentry,
155 &resp->stat));
156} 150}
157 151
158/* 152/*
diff --git a/fs/nfsd/nfsxdr.c b/fs/nfsd/nfsxdr.c
index 979b42106979..bf6d3bccdd98 100644
--- a/fs/nfsd/nfsxdr.c
+++ b/fs/nfsd/nfsxdr.c
@@ -4,6 +4,7 @@
4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de> 4 * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
5 */ 5 */
6 6
7#include "vfs.h"
7#include "xdr.h" 8#include "xdr.h"
8#include "auth.h" 9#include "auth.h"
9 10
@@ -197,7 +198,7 @@ encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp,
197__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp) 198__be32 *nfs2svc_encode_fattr(struct svc_rqst *rqstp, __be32 *p, struct svc_fh *fhp)
198{ 199{
199 struct kstat stat; 200 struct kstat stat;
200 vfs_getattr(fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &stat); 201 fh_getattr(fhp, &stat); /* BUG */
201 return encode_fattr(rqstp, p, fhp, &stat); 202 return encode_fattr(rqstp, p, fhp, &stat);
202} 203}
203 204
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h
index 359594c393d2..5b5894159f22 100644
--- a/fs/nfsd/vfs.h
+++ b/fs/nfsd/vfs.h
@@ -6,6 +6,7 @@
6#define LINUX_NFSD_VFS_H 6#define LINUX_NFSD_VFS_H
7 7
8#include "nfsfh.h" 8#include "nfsfh.h"
9#include "nfsd.h"
9 10
10/* 11/*
11 * Flags for nfsd_permission 12 * Flags for nfsd_permission
@@ -125,4 +126,11 @@ static inline void fh_drop_write(struct svc_fh *fh)
125 } 126 }
126} 127}
127 128
129static inline __be32 fh_getattr(struct svc_fh *fh, struct kstat *stat)
130{
131 struct path p = {.mnt = fh->fh_export->ex_path.mnt,
132 .dentry = fh->fh_dentry};
133 return nfserrno(vfs_getattr(&p, stat));
134}
135
128#endif /* LINUX_NFSD_VFS_H */ 136#endif /* LINUX_NFSD_VFS_H */
diff --git a/fs/stat.c b/fs/stat.c
index 14f45459c83d..04ce1ac20d20 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -37,17 +37,17 @@ void generic_fillattr(struct inode *inode, struct kstat *stat)
37 37
38EXPORT_SYMBOL(generic_fillattr); 38EXPORT_SYMBOL(generic_fillattr);
39 39
40int vfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) 40int vfs_getattr(struct path *path, struct kstat *stat)
41{ 41{
42 struct inode *inode = dentry->d_inode; 42 struct inode *inode = path->dentry->d_inode;
43 int retval; 43 int retval;
44 44
45 retval = security_inode_getattr(mnt, dentry); 45 retval = security_inode_getattr(path->mnt, path->dentry);
46 if (retval) 46 if (retval)
47 return retval; 47 return retval;
48 48
49 if (inode->i_op->getattr) 49 if (inode->i_op->getattr)
50 return inode->i_op->getattr(mnt, dentry, stat); 50 return inode->i_op->getattr(path->mnt, path->dentry, stat);
51 51
52 generic_fillattr(inode, stat); 52 generic_fillattr(inode, stat);
53 return 0; 53 return 0;
@@ -61,8 +61,7 @@ int vfs_fstat(unsigned int fd, struct kstat *stat)
61 int error = -EBADF; 61 int error = -EBADF;
62 62
63 if (f.file) { 63 if (f.file) {
64 error = vfs_getattr(f.file->f_path.mnt, f.file->f_path.dentry, 64 error = vfs_getattr(&f.file->f_path, stat);
65 stat);
66 fdput(f); 65 fdput(f);
67 } 66 }
68 return error; 67 return error;
@@ -89,7 +88,7 @@ retry:
89 if (error) 88 if (error)
90 goto out; 89 goto out;
91 90
92 error = vfs_getattr(path.mnt, path.dentry, stat); 91 error = vfs_getattr(&path, stat);
93 path_put(&path); 92 path_put(&path);
94 if (retry_estale(error, lookup_flags)) { 93 if (retry_estale(error, lookup_flags)) {
95 lookup_flags |= LOOKUP_REVAL; 94 lookup_flags |= LOOKUP_REVAL;
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3ab69777b4d8..7f471520b88b 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2468,7 +2468,7 @@ extern int page_symlink(struct inode *inode, const char *symname, int len);
2468extern const struct inode_operations page_symlink_inode_operations; 2468extern const struct inode_operations page_symlink_inode_operations;
2469extern int generic_readlink(struct dentry *, char __user *, int); 2469extern int generic_readlink(struct dentry *, char __user *, int);
2470extern void generic_fillattr(struct inode *, struct kstat *); 2470extern void generic_fillattr(struct inode *, struct kstat *);
2471extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); 2471extern int vfs_getattr(struct path *, struct kstat *);
2472void __inode_add_bytes(struct inode *inode, loff_t bytes); 2472void __inode_add_bytes(struct inode *inode, loff_t bytes);
2473void inode_add_bytes(struct inode *inode, loff_t bytes); 2473void inode_add_bytes(struct inode *inode, loff_t bytes);
2474void inode_sub_bytes(struct inode *inode, loff_t bytes); 2474void inode_sub_bytes(struct inode *inode, loff_t bytes);
diff --git a/kernel/module.c b/kernel/module.c
index b10b048367e1..950076eb3273 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -2519,7 +2519,7 @@ static int copy_module_from_fd(int fd, struct load_info *info)
2519 if (err) 2519 if (err)
2520 goto out; 2520 goto out;
2521 2521
2522 err = vfs_getattr(file->f_vfsmnt, file->f_dentry, &stat); 2522 err = vfs_getattr(&file->f_path, &stat);
2523 if (err) 2523 if (err)
2524 goto out; 2524 goto out;
2525 2525