diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 19:10:49 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-10 19:10:49 -0500 |
commit | cbfe0de303a55ed96d8831c2d5f56f8131cd6612 (patch) | |
tree | b327762303c6a015421e4077e7c713b8a47a5e0e /fs/nfsd | |
parent | 8322b6fddfd2cee41a7732284e5f04750511f4b2 (diff) | |
parent | ba00410b8131b23edfb0e09f8b6dd26c8eb621fb (diff) |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull VFS changes from Al Viro:
"First pile out of several (there _definitely_ will be more). Stuff in
this one:
- unification of d_splice_alias()/d_materialize_unique()
- iov_iter rewrite
- killing a bunch of ->f_path.dentry users (and f_dentry macro).
Getting that completed will make life much simpler for
unionmount/overlayfs, since then we'll be able to limit the places
sensitive to file _dentry_ to reasonably few. Which allows to have
file_inode(file) pointing to inode in a covered layer, with dentry
pointing to (negative) dentry in union one.
Still not complete, but much closer now.
- crapectomy in lustre (dead code removal, mostly)
- "let's make seq_printf return nothing" preparations
- assorted cleanups and fixes
There _definitely_ will be more piles"
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (63 commits)
copy_from_iter_nocache()
new helper: iov_iter_kvec()
csum_and_copy_..._iter()
iov_iter.c: handle ITER_KVEC directly
iov_iter.c: convert copy_to_iter() to iterate_and_advance
iov_iter.c: convert copy_from_iter() to iterate_and_advance
iov_iter.c: get rid of bvec_copy_page_{to,from}_iter()
iov_iter.c: convert iov_iter_zero() to iterate_and_advance
iov_iter.c: convert iov_iter_get_pages_alloc() to iterate_all_kinds
iov_iter.c: convert iov_iter_get_pages() to iterate_all_kinds
iov_iter.c: convert iov_iter_npages() to iterate_all_kinds
iov_iter.c: iterate_and_advance
iov_iter.c: macros for iterating over iov_iter
kill f_dentry macro
dcache: fix kmemcheck warning in switch_names
new helper: audit_file()
nfsd_vfs_write(): use file_inode()
ncpfs: use file_inode()
kill f_dentry uses
lockd: get rid of ->f_path.dentry->d_sb
...
Diffstat (limited to 'fs/nfsd')
-rw-r--r-- | fs/nfsd/nfs4recover.c | 7 | ||||
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 2 | ||||
-rw-r--r-- | fs/nfsd/nfsctl.c | 37 | ||||
-rw-r--r-- | fs/nfsd/vfs.c | 16 | ||||
-rw-r--r-- | fs/nfsd/vfs.h | 4 |
5 files changed, 31 insertions, 35 deletions
diff --git a/fs/nfsd/nfs4recover.c b/fs/nfsd/nfs4recover.c index a25490ae6c62..cc6a76072009 100644 --- a/fs/nfsd/nfs4recover.c +++ b/fs/nfsd/nfs4recover.c | |||
@@ -245,10 +245,11 @@ struct nfs4_dir_ctx { | |||
245 | }; | 245 | }; |
246 | 246 | ||
247 | static int | 247 | static int |
248 | nfsd4_build_namelist(void *arg, const char *name, int namlen, | 248 | nfsd4_build_namelist(struct dir_context *__ctx, const char *name, int namlen, |
249 | loff_t offset, u64 ino, unsigned int d_type) | 249 | loff_t offset, u64 ino, unsigned int d_type) |
250 | { | 250 | { |
251 | struct nfs4_dir_ctx *ctx = arg; | 251 | struct nfs4_dir_ctx *ctx = |
252 | container_of(__ctx, struct nfs4_dir_ctx, ctx); | ||
252 | struct name_list *entry; | 253 | struct name_list *entry; |
253 | 254 | ||
254 | if (namlen != HEXDIR_LEN - 1) | 255 | if (namlen != HEXDIR_LEN - 1) |
@@ -704,7 +705,7 @@ cld_pipe_downcall(struct file *filp, const char __user *src, size_t mlen) | |||
704 | struct cld_upcall *tmp, *cup; | 705 | struct cld_upcall *tmp, *cup; |
705 | struct cld_msg __user *cmsg = (struct cld_msg __user *)src; | 706 | struct cld_msg __user *cmsg = (struct cld_msg __user *)src; |
706 | uint32_t xid; | 707 | uint32_t xid; |
707 | struct nfsd_net *nn = net_generic(filp->f_dentry->d_sb->s_fs_info, | 708 | struct nfsd_net *nn = net_generic(file_inode(filp)->i_sb->s_fs_info, |
708 | nfsd_net_id); | 709 | nfsd_net_id); |
709 | struct cld_net *cn = nn->cld_net; | 710 | struct cld_net *cn = nn->cld_net; |
710 | 711 | ||
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index eeea7a90eb87..b1eed4dd2eab 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -1886,7 +1886,7 @@ static __be32 nfsd4_encode_path(struct xdr_stream *xdr, | |||
1886 | goto out_free; | 1886 | goto out_free; |
1887 | } | 1887 | } |
1888 | p = xdr_encode_opaque(p, dentry->d_name.name, len); | 1888 | p = xdr_encode_opaque(p, dentry->d_name.name, len); |
1889 | dprintk("/%s", dentry->d_name.name); | 1889 | dprintk("/%pd", dentry); |
1890 | spin_unlock(&dentry->d_lock); | 1890 | spin_unlock(&dentry->d_lock); |
1891 | dput(dentry); | 1891 | dput(dentry); |
1892 | ncomponents--; | 1892 | ncomponents--; |
diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index ca73ca79a0ee..9506ea565610 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c | |||
@@ -231,6 +231,10 @@ static struct file_operations reply_cache_stats_operations = { | |||
231 | * payload - write methods | 231 | * payload - write methods |
232 | */ | 232 | */ |
233 | 233 | ||
234 | static inline struct net *netns(struct file *file) | ||
235 | { | ||
236 | return file_inode(file)->i_sb->s_fs_info; | ||
237 | } | ||
234 | 238 | ||
235 | /** | 239 | /** |
236 | * write_unlock_ip - Release all locks used by a client | 240 | * write_unlock_ip - Release all locks used by a client |
@@ -252,7 +256,7 @@ static ssize_t write_unlock_ip(struct file *file, char *buf, size_t size) | |||
252 | struct sockaddr *sap = (struct sockaddr *)&address; | 256 | struct sockaddr *sap = (struct sockaddr *)&address; |
253 | size_t salen = sizeof(address); | 257 | size_t salen = sizeof(address); |
254 | char *fo_path; | 258 | char *fo_path; |
255 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 259 | struct net *net = netns(file); |
256 | 260 | ||
257 | /* sanity check */ | 261 | /* sanity check */ |
258 | if (size == 0) | 262 | if (size == 0) |
@@ -350,7 +354,6 @@ static ssize_t write_filehandle(struct file *file, char *buf, size_t size) | |||
350 | int len; | 354 | int len; |
351 | struct auth_domain *dom; | 355 | struct auth_domain *dom; |
352 | struct knfsd_fh fh; | 356 | struct knfsd_fh fh; |
353 | struct net *net = file->f_dentry->d_sb->s_fs_info; | ||
354 | 357 | ||
355 | if (size == 0) | 358 | if (size == 0) |
356 | return -EINVAL; | 359 | return -EINVAL; |
@@ -385,7 +388,7 @@ static ssize_t write_filehandle(struct file *file, char *buf, size_t size) | |||
385 | if (!dom) | 388 | if (!dom) |
386 | return -ENOMEM; | 389 | return -ENOMEM; |
387 | 390 | ||
388 | len = exp_rootfh(net, dom, path, &fh, maxsize); | 391 | len = exp_rootfh(netns(file), dom, path, &fh, maxsize); |
389 | auth_domain_put(dom); | 392 | auth_domain_put(dom); |
390 | if (len) | 393 | if (len) |
391 | return len; | 394 | return len; |
@@ -429,7 +432,7 @@ static ssize_t write_threads(struct file *file, char *buf, size_t size) | |||
429 | { | 432 | { |
430 | char *mesg = buf; | 433 | char *mesg = buf; |
431 | int rv; | 434 | int rv; |
432 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 435 | struct net *net = netns(file); |
433 | 436 | ||
434 | if (size > 0) { | 437 | if (size > 0) { |
435 | int newthreads; | 438 | int newthreads; |
@@ -480,7 +483,7 @@ static ssize_t write_pool_threads(struct file *file, char *buf, size_t size) | |||
480 | int len; | 483 | int len; |
481 | int npools; | 484 | int npools; |
482 | int *nthreads; | 485 | int *nthreads; |
483 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 486 | struct net *net = netns(file); |
484 | 487 | ||
485 | mutex_lock(&nfsd_mutex); | 488 | mutex_lock(&nfsd_mutex); |
486 | npools = nfsd_nrpools(net); | 489 | npools = nfsd_nrpools(net); |
@@ -543,8 +546,7 @@ static ssize_t __write_versions(struct file *file, char *buf, size_t size) | |||
543 | unsigned minor; | 546 | unsigned minor; |
544 | ssize_t tlen = 0; | 547 | ssize_t tlen = 0; |
545 | char *sep; | 548 | char *sep; |
546 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 549 | struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); |
547 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
548 | 550 | ||
549 | if (size>0) { | 551 | if (size>0) { |
550 | if (nn->nfsd_serv) | 552 | if (nn->nfsd_serv) |
@@ -830,10 +832,9 @@ static ssize_t __write_ports(struct file *file, char *buf, size_t size, | |||
830 | static ssize_t write_ports(struct file *file, char *buf, size_t size) | 832 | static ssize_t write_ports(struct file *file, char *buf, size_t size) |
831 | { | 833 | { |
832 | ssize_t rv; | 834 | ssize_t rv; |
833 | struct net *net = file->f_dentry->d_sb->s_fs_info; | ||
834 | 835 | ||
835 | mutex_lock(&nfsd_mutex); | 836 | mutex_lock(&nfsd_mutex); |
836 | rv = __write_ports(file, buf, size, net); | 837 | rv = __write_ports(file, buf, size, netns(file)); |
837 | mutex_unlock(&nfsd_mutex); | 838 | mutex_unlock(&nfsd_mutex); |
838 | return rv; | 839 | return rv; |
839 | } | 840 | } |
@@ -865,8 +866,7 @@ int nfsd_max_blksize; | |||
865 | static ssize_t write_maxblksize(struct file *file, char *buf, size_t size) | 866 | static ssize_t write_maxblksize(struct file *file, char *buf, size_t size) |
866 | { | 867 | { |
867 | char *mesg = buf; | 868 | char *mesg = buf; |
868 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 869 | struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); |
869 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
870 | 870 | ||
871 | if (size > 0) { | 871 | if (size > 0) { |
872 | int bsize; | 872 | int bsize; |
@@ -915,8 +915,7 @@ static ssize_t write_maxblksize(struct file *file, char *buf, size_t size) | |||
915 | static ssize_t write_maxconn(struct file *file, char *buf, size_t size) | 915 | static ssize_t write_maxconn(struct file *file, char *buf, size_t size) |
916 | { | 916 | { |
917 | char *mesg = buf; | 917 | char *mesg = buf; |
918 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 918 | struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); |
919 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
920 | unsigned int maxconn = nn->max_connections; | 919 | unsigned int maxconn = nn->max_connections; |
921 | 920 | ||
922 | if (size > 0) { | 921 | if (size > 0) { |
@@ -997,8 +996,7 @@ static ssize_t nfsd4_write_time(struct file *file, char *buf, size_t size, | |||
997 | */ | 996 | */ |
998 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size) | 997 | static ssize_t write_leasetime(struct file *file, char *buf, size_t size) |
999 | { | 998 | { |
1000 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 999 | struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); |
1001 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
1002 | return nfsd4_write_time(file, buf, size, &nn->nfsd4_lease, nn); | 1000 | return nfsd4_write_time(file, buf, size, &nn->nfsd4_lease, nn); |
1003 | } | 1001 | } |
1004 | 1002 | ||
@@ -1014,8 +1012,7 @@ static ssize_t write_leasetime(struct file *file, char *buf, size_t size) | |||
1014 | */ | 1012 | */ |
1015 | static ssize_t write_gracetime(struct file *file, char *buf, size_t size) | 1013 | static ssize_t write_gracetime(struct file *file, char *buf, size_t size) |
1016 | { | 1014 | { |
1017 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 1015 | struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); |
1018 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
1019 | return nfsd4_write_time(file, buf, size, &nn->nfsd4_grace, nn); | 1016 | return nfsd4_write_time(file, buf, size, &nn->nfsd4_grace, nn); |
1020 | } | 1017 | } |
1021 | 1018 | ||
@@ -1071,8 +1068,7 @@ static ssize_t __write_recoverydir(struct file *file, char *buf, size_t size, | |||
1071 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) | 1068 | static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) |
1072 | { | 1069 | { |
1073 | ssize_t rv; | 1070 | ssize_t rv; |
1074 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 1071 | struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); |
1075 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
1076 | 1072 | ||
1077 | mutex_lock(&nfsd_mutex); | 1073 | mutex_lock(&nfsd_mutex); |
1078 | rv = __write_recoverydir(file, buf, size, nn); | 1074 | rv = __write_recoverydir(file, buf, size, nn); |
@@ -1102,8 +1098,7 @@ static ssize_t write_recoverydir(struct file *file, char *buf, size_t size) | |||
1102 | */ | 1098 | */ |
1103 | static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) | 1099 | static ssize_t write_v4_end_grace(struct file *file, char *buf, size_t size) |
1104 | { | 1100 | { |
1105 | struct net *net = file->f_dentry->d_sb->s_fs_info; | 1101 | struct nfsd_net *nn = net_generic(netns(file), nfsd_net_id); |
1106 | struct nfsd_net *nn = net_generic(net, nfsd_net_id); | ||
1107 | 1102 | ||
1108 | if (size > 0) { | 1103 | if (size > 0) { |
1109 | switch(buf[0]) { | 1104 | switch(buf[0]) { |
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 989129e2d6ea..0a82e3c033ee 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c | |||
@@ -930,7 +930,6 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
930 | unsigned long *cnt, int *stablep) | 930 | unsigned long *cnt, int *stablep) |
931 | { | 931 | { |
932 | struct svc_export *exp; | 932 | struct svc_export *exp; |
933 | struct dentry *dentry; | ||
934 | struct inode *inode; | 933 | struct inode *inode; |
935 | mm_segment_t oldfs; | 934 | mm_segment_t oldfs; |
936 | __be32 err = 0; | 935 | __be32 err = 0; |
@@ -949,8 +948,7 @@ nfsd_vfs_write(struct svc_rqst *rqstp, struct svc_fh *fhp, struct file *file, | |||
949 | */ | 948 | */ |
950 | current->flags |= PF_LESS_THROTTLE; | 949 | current->flags |= PF_LESS_THROTTLE; |
951 | 950 | ||
952 | dentry = file->f_path.dentry; | 951 | inode = file_inode(file); |
953 | inode = dentry->d_inode; | ||
954 | exp = fhp->fh_export; | 952 | exp = fhp->fh_export; |
955 | 953 | ||
956 | use_wgather = (rqstp->rq_vers == 2) && EX_WGATHER(exp); | 954 | use_wgather = (rqstp->rq_vers == 2) && EX_WGATHER(exp); |
@@ -1819,10 +1817,12 @@ struct readdir_data { | |||
1819 | int full; | 1817 | int full; |
1820 | }; | 1818 | }; |
1821 | 1819 | ||
1822 | static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | 1820 | static int nfsd_buffered_filldir(struct dir_context *ctx, const char *name, |
1823 | loff_t offset, u64 ino, unsigned int d_type) | 1821 | int namlen, loff_t offset, u64 ino, |
1822 | unsigned int d_type) | ||
1824 | { | 1823 | { |
1825 | struct readdir_data *buf = __buf; | 1824 | struct readdir_data *buf = |
1825 | container_of(ctx, struct readdir_data, ctx); | ||
1826 | struct buffered_dirent *de = (void *)(buf->dirent + buf->used); | 1826 | struct buffered_dirent *de = (void *)(buf->dirent + buf->used); |
1827 | unsigned int reclen; | 1827 | unsigned int reclen; |
1828 | 1828 | ||
@@ -1842,7 +1842,7 @@ static int nfsd_buffered_filldir(void *__buf, const char *name, int namlen, | |||
1842 | return 0; | 1842 | return 0; |
1843 | } | 1843 | } |
1844 | 1844 | ||
1845 | static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, | 1845 | static __be32 nfsd_buffered_readdir(struct file *file, nfsd_filldir_t func, |
1846 | struct readdir_cd *cdp, loff_t *offsetp) | 1846 | struct readdir_cd *cdp, loff_t *offsetp) |
1847 | { | 1847 | { |
1848 | struct buffered_dirent *de; | 1848 | struct buffered_dirent *de; |
@@ -1926,7 +1926,7 @@ static __be32 nfsd_buffered_readdir(struct file *file, filldir_t func, | |||
1926 | */ | 1926 | */ |
1927 | __be32 | 1927 | __be32 |
1928 | nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, | 1928 | nfsd_readdir(struct svc_rqst *rqstp, struct svc_fh *fhp, loff_t *offsetp, |
1929 | struct readdir_cd *cdp, filldir_t func) | 1929 | struct readdir_cd *cdp, nfsd_filldir_t func) |
1930 | { | 1930 | { |
1931 | __be32 err; | 1931 | __be32 err; |
1932 | struct file *file; | 1932 | struct file *file; |
diff --git a/fs/nfsd/vfs.h b/fs/nfsd/vfs.h index c2ff3f14e5f6..b1796d6ee538 100644 --- a/fs/nfsd/vfs.h +++ b/fs/nfsd/vfs.h | |||
@@ -36,7 +36,7 @@ | |||
36 | /* | 36 | /* |
37 | * Callback function for readdir | 37 | * Callback function for readdir |
38 | */ | 38 | */ |
39 | typedef int (*nfsd_dirop_t)(struct inode *, struct dentry *, int, int); | 39 | typedef int (*nfsd_filldir_t)(void *, const char *, int, loff_t, u64, unsigned); |
40 | 40 | ||
41 | /* nfsd/vfs.c */ | 41 | /* nfsd/vfs.c */ |
42 | int nfsd_racache_init(int); | 42 | int nfsd_racache_init(int); |
@@ -95,7 +95,7 @@ __be32 nfsd_rename(struct svc_rqst *, | |||
95 | __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, | 95 | __be32 nfsd_unlink(struct svc_rqst *, struct svc_fh *, int type, |
96 | char *name, int len); | 96 | char *name, int len); |
97 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, | 97 | __be32 nfsd_readdir(struct svc_rqst *, struct svc_fh *, |
98 | loff_t *, struct readdir_cd *, filldir_t); | 98 | loff_t *, struct readdir_cd *, nfsd_filldir_t); |
99 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, | 99 | __be32 nfsd_statfs(struct svc_rqst *, struct svc_fh *, |
100 | struct kstatfs *, int access); | 100 | struct kstatfs *, int access); |
101 | 101 | ||