aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback.c34
-rw-r--r--fs/nfs/callback_xdr.c4
-rw-r--r--fs/nfs/client.c4
-rw-r--r--fs/nfs/dir.c6
-rw-r--r--fs/nfs/file.c4
-rw-r--r--fs/nfs/namespace.c4
-rw-r--r--fs/nfs/nfs4_fs.h2
-rw-r--r--fs/nfs/nfs4proc.c2
-rw-r--r--fs/nfs/super.c5
-rw-r--r--fs/nfs/symlink.c2
10 files changed, 36 insertions, 31 deletions
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c
index 7933e2e99dbc..75f309c8741a 100644
--- a/fs/nfs/callback.c
+++ b/fs/nfs/callback.c
@@ -71,6 +71,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
71 complete(&nfs_callback_info.started); 71 complete(&nfs_callback_info.started);
72 72
73 for(;;) { 73 for(;;) {
74 char buf[RPC_MAX_ADDRBUFLEN];
75
74 if (signalled()) { 76 if (signalled()) {
75 if (nfs_callback_info.users == 0) 77 if (nfs_callback_info.users == 0)
76 break; 78 break;
@@ -88,8 +90,8 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
88 __FUNCTION__, -err); 90 __FUNCTION__, -err);
89 break; 91 break;
90 } 92 }
91 dprintk("%s: request from %u.%u.%u.%u\n", __FUNCTION__, 93 dprintk("%s: request from %s\n", __FUNCTION__,
92 NIPQUAD(rqstp->rq_addr.sin_addr.s_addr)); 94 svc_print_addr(rqstp, buf, sizeof(buf)));
93 svc_process(rqstp); 95 svc_process(rqstp);
94 } 96 }
95 97
@@ -106,7 +108,6 @@ static void nfs_callback_svc(struct svc_rqst *rqstp)
106int nfs_callback_up(void) 108int nfs_callback_up(void)
107{ 109{
108 struct svc_serv *serv; 110 struct svc_serv *serv;
109 struct svc_sock *svsk;
110 int ret = 0; 111 int ret = 0;
111 112
112 lock_kernel(); 113 lock_kernel();
@@ -119,17 +120,14 @@ int nfs_callback_up(void)
119 ret = -ENOMEM; 120 ret = -ENOMEM;
120 if (!serv) 121 if (!serv)
121 goto out_err; 122 goto out_err;
122 /* FIXME: We don't want to register this socket with the portmapper */ 123
123 ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport); 124 ret = svc_makesock(serv, IPPROTO_TCP, nfs_callback_set_tcpport,
124 if (ret < 0) 125 SVC_SOCK_ANONYMOUS);
126 if (ret <= 0)
125 goto out_destroy; 127 goto out_destroy;
126 if (!list_empty(&serv->sv_permsocks)) { 128 nfs_callback_tcpport = ret;
127 svsk = list_entry(serv->sv_permsocks.next, 129 dprintk("Callback port = 0x%x\n", nfs_callback_tcpport);
128 struct svc_sock, sk_list); 130
129 nfs_callback_tcpport = ntohs(inet_sk(svsk->sk_sk)->sport);
130 dprintk ("Callback port = 0x%x\n", nfs_callback_tcpport);
131 } else
132 BUG();
133 ret = svc_create_thread(nfs_callback_svc, serv); 131 ret = svc_create_thread(nfs_callback_svc, serv);
134 if (ret < 0) 132 if (ret < 0)
135 goto out_destroy; 133 goto out_destroy;
@@ -140,6 +138,8 @@ out:
140 unlock_kernel(); 138 unlock_kernel();
141 return ret; 139 return ret;
142out_destroy: 140out_destroy:
141 dprintk("Couldn't create callback socket or server thread; err = %d\n",
142 ret);
143 svc_destroy(serv); 143 svc_destroy(serv);
144out_err: 144out_err:
145 nfs_callback_info.users--; 145 nfs_callback_info.users--;
@@ -166,15 +166,19 @@ void nfs_callback_down(void)
166 166
167static int nfs_callback_authenticate(struct svc_rqst *rqstp) 167static int nfs_callback_authenticate(struct svc_rqst *rqstp)
168{ 168{
169 struct sockaddr_in *addr = &rqstp->rq_addr; 169 struct sockaddr_in *addr = svc_addr_in(rqstp);
170 struct nfs_client *clp; 170 struct nfs_client *clp;
171 char buf[RPC_MAX_ADDRBUFLEN];
171 172
172 /* Don't talk to strangers */ 173 /* Don't talk to strangers */
173 clp = nfs_find_client(addr, 4); 174 clp = nfs_find_client(addr, 4);
174 if (clp == NULL) 175 if (clp == NULL)
175 return SVC_DROP; 176 return SVC_DROP;
176 dprintk("%s: %u.%u.%u.%u NFSv4 callback!\n", __FUNCTION__, NIPQUAD(addr->sin_addr)); 177
178 dprintk("%s: %s NFSv4 callback!\n", __FUNCTION__,
179 svc_print_addr(rqstp, buf, sizeof(buf)));
177 nfs_put_client(clp); 180 nfs_put_client(clp);
181
178 switch (rqstp->rq_authop->flavour) { 182 switch (rqstp->rq_authop->flavour) {
179 case RPC_AUTH_NULL: 183 case RPC_AUTH_NULL:
180 if (rqstp->rq_proc != CB_NULL) 184 if (rqstp->rq_proc != CB_NULL)
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index f8ea1f51f590..849a2029975d 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -176,7 +176,7 @@ static __be32 decode_getattr_args(struct svc_rqst *rqstp, struct xdr_stream *xdr
176 status = decode_fh(xdr, &args->fh); 176 status = decode_fh(xdr, &args->fh);
177 if (unlikely(status != 0)) 177 if (unlikely(status != 0))
178 goto out; 178 goto out;
179 args->addr = &rqstp->rq_addr; 179 args->addr = svc_addr_in(rqstp);
180 status = decode_bitmap(xdr, args->bitmap); 180 status = decode_bitmap(xdr, args->bitmap);
181out: 181out:
182 dprintk("%s: exit with status = %d\n", __FUNCTION__, status); 182 dprintk("%s: exit with status = %d\n", __FUNCTION__, status);
@@ -188,7 +188,7 @@ static __be32 decode_recall_args(struct svc_rqst *rqstp, struct xdr_stream *xdr,
188 __be32 *p; 188 __be32 *p;
189 __be32 status; 189 __be32 status;
190 190
191 args->addr = &rqstp->rq_addr; 191 args->addr = svc_addr_in(rqstp);
192 status = decode_stateid(xdr, &args->stateid); 192 status = decode_stateid(xdr, &args->stateid);
193 if (unlikely(status != 0)) 193 if (unlikely(status != 0))
194 goto out; 194 goto out;
diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index c46e94fed9eb..2190e6c2792e 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -1181,7 +1181,7 @@ static struct seq_operations nfs_server_list_ops = {
1181 .show = nfs_server_list_show, 1181 .show = nfs_server_list_show,
1182}; 1182};
1183 1183
1184static struct file_operations nfs_server_list_fops = { 1184static const struct file_operations nfs_server_list_fops = {
1185 .open = nfs_server_list_open, 1185 .open = nfs_server_list_open,
1186 .read = seq_read, 1186 .read = seq_read,
1187 .llseek = seq_lseek, 1187 .llseek = seq_lseek,
@@ -1201,7 +1201,7 @@ static struct seq_operations nfs_volume_list_ops = {
1201 .show = nfs_volume_list_show, 1201 .show = nfs_volume_list_show,
1202}; 1202};
1203 1203
1204static struct file_operations nfs_volume_list_fops = { 1204static const struct file_operations nfs_volume_list_fops = {
1205 .open = nfs_volume_list_open, 1205 .open = nfs_volume_list_open,
1206 .read = seq_read, 1206 .read = seq_read,
1207 .llseek = seq_lseek, 1207 .llseek = seq_lseek,
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 37c1dd642184..92d8ec859e22 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -65,7 +65,7 @@ const struct file_operations nfs_dir_operations = {
65 .fsync = nfs_fsync_dir, 65 .fsync = nfs_fsync_dir,
66}; 66};
67 67
68struct inode_operations nfs_dir_inode_operations = { 68const struct inode_operations nfs_dir_inode_operations = {
69 .create = nfs_create, 69 .create = nfs_create,
70 .lookup = nfs_lookup, 70 .lookup = nfs_lookup,
71 .link = nfs_link, 71 .link = nfs_link,
@@ -81,7 +81,7 @@ struct inode_operations nfs_dir_inode_operations = {
81}; 81};
82 82
83#ifdef CONFIG_NFS_V3 83#ifdef CONFIG_NFS_V3
84struct inode_operations nfs3_dir_inode_operations = { 84const struct inode_operations nfs3_dir_inode_operations = {
85 .create = nfs_create, 85 .create = nfs_create,
86 .lookup = nfs_lookup, 86 .lookup = nfs_lookup,
87 .link = nfs_link, 87 .link = nfs_link,
@@ -104,7 +104,7 @@ struct inode_operations nfs3_dir_inode_operations = {
104#ifdef CONFIG_NFS_V4 104#ifdef CONFIG_NFS_V4
105 105
106static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *); 106static struct dentry *nfs_atomic_lookup(struct inode *, struct dentry *, struct nameidata *);
107struct inode_operations nfs4_dir_inode_operations = { 107const struct inode_operations nfs4_dir_inode_operations = {
108 .create = nfs_create, 108 .create = nfs_create,
109 .lookup = nfs_atomic_lookup, 109 .lookup = nfs_atomic_lookup,
110 .link = nfs_link, 110 .link = nfs_link,
diff --git a/fs/nfs/file.c b/fs/nfs/file.c
index 9e4a2b70995a..8e66b5a2d490 100644
--- a/fs/nfs/file.c
+++ b/fs/nfs/file.c
@@ -68,14 +68,14 @@ const struct file_operations nfs_file_operations = {
68 .check_flags = nfs_check_flags, 68 .check_flags = nfs_check_flags,
69}; 69};
70 70
71struct inode_operations nfs_file_inode_operations = { 71const struct inode_operations nfs_file_inode_operations = {
72 .permission = nfs_permission, 72 .permission = nfs_permission,
73 .getattr = nfs_getattr, 73 .getattr = nfs_getattr,
74 .setattr = nfs_setattr, 74 .setattr = nfs_setattr,
75}; 75};
76 76
77#ifdef CONFIG_NFS_V3 77#ifdef CONFIG_NFS_V3
78struct inode_operations nfs3_file_inode_operations = { 78const struct inode_operations nfs3_file_inode_operations = {
79 .permission = nfs_permission, 79 .permission = nfs_permission,
80 .getattr = nfs_getattr, 80 .getattr = nfs_getattr,
81 .setattr = nfs_setattr, 81 .setattr = nfs_setattr,
diff --git a/fs/nfs/namespace.c b/fs/nfs/namespace.c
index 371b804e7cc8..7f86e65182e4 100644
--- a/fs/nfs/namespace.c
+++ b/fs/nfs/namespace.c
@@ -155,12 +155,12 @@ out_follow:
155 goto out; 155 goto out;
156} 156}
157 157
158struct inode_operations nfs_mountpoint_inode_operations = { 158const struct inode_operations nfs_mountpoint_inode_operations = {
159 .follow_link = nfs_follow_mountpoint, 159 .follow_link = nfs_follow_mountpoint,
160 .getattr = nfs_getattr, 160 .getattr = nfs_getattr,
161}; 161};
162 162
163struct inode_operations nfs_referral_inode_operations = { 163const struct inode_operations nfs_referral_inode_operations = {
164 .follow_link = nfs_follow_mountpoint, 164 .follow_link = nfs_follow_mountpoint,
165}; 165};
166 166
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index f2c88ffe41e0..cf3a17eb5c09 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -151,7 +151,7 @@ struct nfs4_state_recovery_ops {
151}; 151};
152 152
153extern struct dentry_operations nfs4_dentry_operations; 153extern struct dentry_operations nfs4_dentry_operations;
154extern struct inode_operations nfs4_dir_inode_operations; 154extern const struct inode_operations nfs4_dir_inode_operations;
155 155
156/* inode.c */ 156/* inode.c */
157extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t); 157extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1712d0360ee6..f52cf5c33c6c 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -3584,7 +3584,7 @@ struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops = {
3584 .recover_lock = nfs4_lock_expired, 3584 .recover_lock = nfs4_lock_expired,
3585}; 3585};
3586 3586
3587static struct inode_operations nfs4_file_inode_operations = { 3587static const struct inode_operations nfs4_file_inode_operations = {
3588 .permission = nfs_permission, 3588 .permission = nfs_permission,
3589 .getattr = nfs_getattr, 3589 .getattr = nfs_getattr,
3590 .setattr = nfs_setattr, 3590 .setattr = nfs_setattr,
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 89da0a38c12c..bb516a2cfbaf 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -44,6 +44,7 @@
44#include <linux/vfs.h> 44#include <linux/vfs.h>
45#include <linux/inet.h> 45#include <linux/inet.h>
46#include <linux/nfs_xdr.h> 46#include <linux/nfs_xdr.h>
47#include <linux/magic.h>
47 48
48#include <asm/system.h> 49#include <asm/system.h>
49#include <asm/uaccess.h> 50#include <asm/uaccess.h>
@@ -81,7 +82,7 @@ struct file_system_type nfs_xdev_fs_type = {
81 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 82 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
82}; 83};
83 84
84static struct super_operations nfs_sops = { 85static const struct super_operations nfs_sops = {
85 .alloc_inode = nfs_alloc_inode, 86 .alloc_inode = nfs_alloc_inode,
86 .destroy_inode = nfs_destroy_inode, 87 .destroy_inode = nfs_destroy_inode,
87 .write_inode = nfs_write_inode, 88 .write_inode = nfs_write_inode,
@@ -125,7 +126,7 @@ struct file_system_type nfs4_referral_fs_type = {
125 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA, 126 .fs_flags = FS_RENAME_DOES_D_MOVE|FS_REVAL_DOT|FS_BINARY_MOUNTDATA,
126}; 127};
127 128
128static struct super_operations nfs4_sops = { 129static const struct super_operations nfs4_sops = {
129 .alloc_inode = nfs_alloc_inode, 130 .alloc_inode = nfs_alloc_inode,
130 .destroy_inode = nfs_destroy_inode, 131 .destroy_inode = nfs_destroy_inode,
131 .write_inode = nfs_write_inode, 132 .write_inode = nfs_write_inode,
diff --git a/fs/nfs/symlink.c b/fs/nfs/symlink.c
index 525c136c7d8c..f4a0548b9ce8 100644
--- a/fs/nfs/symlink.c
+++ b/fs/nfs/symlink.c
@@ -78,7 +78,7 @@ read_failed:
78/* 78/*
79 * symlinks can't do much... 79 * symlinks can't do much...
80 */ 80 */
81struct inode_operations nfs_symlink_inode_operations = { 81const struct inode_operations nfs_symlink_inode_operations = {
82 .readlink = generic_readlink, 82 .readlink = generic_readlink,
83 .follow_link = nfs_follow_link, 83 .follow_link = nfs_follow_link,
84 .put_link = page_put_link, 84 .put_link = page_put_link,