diff options
Diffstat (limited to 'fs/nfs/client.c')
-rw-r--r-- | fs/nfs/client.c | 82 |
1 files changed, 7 insertions, 75 deletions
diff --git a/fs/nfs/client.c b/fs/nfs/client.c index 881fa4900923..a49f9feff776 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c | |||
@@ -102,19 +102,10 @@ static struct nfs_client *nfs_alloc_client(const char *hostname, | |||
102 | int nfsversion) | 102 | int nfsversion) |
103 | { | 103 | { |
104 | struct nfs_client *clp; | 104 | struct nfs_client *clp; |
105 | int error; | ||
106 | 105 | ||
107 | if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) | 106 | if ((clp = kzalloc(sizeof(*clp), GFP_KERNEL)) == NULL) |
108 | goto error_0; | 107 | goto error_0; |
109 | 108 | ||
110 | error = rpciod_up(); | ||
111 | if (error < 0) { | ||
112 | dprintk("%s: couldn't start rpciod! Error = %d\n", | ||
113 | __FUNCTION__, error); | ||
114 | goto error_1; | ||
115 | } | ||
116 | __set_bit(NFS_CS_RPCIOD, &clp->cl_res_state); | ||
117 | |||
118 | if (nfsversion == 4) { | 109 | if (nfsversion == 4) { |
119 | if (nfs_callback_up() < 0) | 110 | if (nfs_callback_up() < 0) |
120 | goto error_2; | 111 | goto error_2; |
@@ -139,8 +130,6 @@ static struct nfs_client *nfs_alloc_client(const char *hostname, | |||
139 | #ifdef CONFIG_NFS_V4 | 130 | #ifdef CONFIG_NFS_V4 |
140 | init_rwsem(&clp->cl_sem); | 131 | init_rwsem(&clp->cl_sem); |
141 | INIT_LIST_HEAD(&clp->cl_delegations); | 132 | INIT_LIST_HEAD(&clp->cl_delegations); |
142 | INIT_LIST_HEAD(&clp->cl_state_owners); | ||
143 | INIT_LIST_HEAD(&clp->cl_unused); | ||
144 | spin_lock_init(&clp->cl_lock); | 133 | spin_lock_init(&clp->cl_lock); |
145 | INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state); | 134 | INIT_DELAYED_WORK(&clp->cl_renewd, nfs4_renew_state); |
146 | rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); | 135 | rpc_init_wait_queue(&clp->cl_rpcwaitq, "NFS client"); |
@@ -154,9 +143,6 @@ error_3: | |||
154 | if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) | 143 | if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) |
155 | nfs_callback_down(); | 144 | nfs_callback_down(); |
156 | error_2: | 145 | error_2: |
157 | rpciod_down(); | ||
158 | __clear_bit(NFS_CS_RPCIOD, &clp->cl_res_state); | ||
159 | error_1: | ||
160 | kfree(clp); | 146 | kfree(clp); |
161 | error_0: | 147 | error_0: |
162 | return NULL; | 148 | return NULL; |
@@ -167,16 +153,7 @@ static void nfs4_shutdown_client(struct nfs_client *clp) | |||
167 | #ifdef CONFIG_NFS_V4 | 153 | #ifdef CONFIG_NFS_V4 |
168 | if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state)) | 154 | if (__test_and_clear_bit(NFS_CS_RENEWD, &clp->cl_res_state)) |
169 | nfs4_kill_renewd(clp); | 155 | nfs4_kill_renewd(clp); |
170 | while (!list_empty(&clp->cl_unused)) { | 156 | BUG_ON(!RB_EMPTY_ROOT(&clp->cl_state_owners)); |
171 | struct nfs4_state_owner *sp; | ||
172 | |||
173 | sp = list_entry(clp->cl_unused.next, | ||
174 | struct nfs4_state_owner, | ||
175 | so_list); | ||
176 | list_del(&sp->so_list); | ||
177 | kfree(sp); | ||
178 | } | ||
179 | BUG_ON(!list_empty(&clp->cl_state_owners)); | ||
180 | if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state)) | 157 | if (__test_and_clear_bit(NFS_CS_IDMAP, &clp->cl_res_state)) |
181 | nfs_idmap_delete(clp); | 158 | nfs_idmap_delete(clp); |
182 | #endif | 159 | #endif |
@@ -198,9 +175,6 @@ static void nfs_free_client(struct nfs_client *clp) | |||
198 | if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) | 175 | if (__test_and_clear_bit(NFS_CS_CALLBACK, &clp->cl_res_state)) |
199 | nfs_callback_down(); | 176 | nfs_callback_down(); |
200 | 177 | ||
201 | if (__test_and_clear_bit(NFS_CS_RPCIOD, &clp->cl_res_state)) | ||
202 | rpciod_down(); | ||
203 | |||
204 | kfree(clp->cl_hostname); | 178 | kfree(clp->cl_hostname); |
205 | kfree(clp); | 179 | kfree(clp); |
206 | 180 | ||
@@ -1232,23 +1206,9 @@ static int nfs_server_list_open(struct inode *inode, struct file *file) | |||
1232 | */ | 1206 | */ |
1233 | static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos) | 1207 | static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos) |
1234 | { | 1208 | { |
1235 | struct list_head *_p; | ||
1236 | loff_t pos = *_pos; | ||
1237 | |||
1238 | /* lock the list against modification */ | 1209 | /* lock the list against modification */ |
1239 | spin_lock(&nfs_client_lock); | 1210 | spin_lock(&nfs_client_lock); |
1240 | 1211 | return seq_list_start_head(&nfs_client_list, *_pos); | |
1241 | /* allow for the header line */ | ||
1242 | if (!pos) | ||
1243 | return SEQ_START_TOKEN; | ||
1244 | pos--; | ||
1245 | |||
1246 | /* find the n'th element in the list */ | ||
1247 | list_for_each(_p, &nfs_client_list) | ||
1248 | if (!pos--) | ||
1249 | break; | ||
1250 | |||
1251 | return _p != &nfs_client_list ? _p : NULL; | ||
1252 | } | 1212 | } |
1253 | 1213 | ||
1254 | /* | 1214 | /* |
@@ -1256,14 +1216,7 @@ static void *nfs_server_list_start(struct seq_file *m, loff_t *_pos) | |||
1256 | */ | 1216 | */ |
1257 | static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos) | 1217 | static void *nfs_server_list_next(struct seq_file *p, void *v, loff_t *pos) |
1258 | { | 1218 | { |
1259 | struct list_head *_p; | 1219 | return seq_list_next(v, &nfs_client_list, pos); |
1260 | |||
1261 | (*pos)++; | ||
1262 | |||
1263 | _p = v; | ||
1264 | _p = (v == SEQ_START_TOKEN) ? nfs_client_list.next : _p->next; | ||
1265 | |||
1266 | return _p != &nfs_client_list ? _p : NULL; | ||
1267 | } | 1220 | } |
1268 | 1221 | ||
1269 | /* | 1222 | /* |
@@ -1282,7 +1235,7 @@ static int nfs_server_list_show(struct seq_file *m, void *v) | |||
1282 | struct nfs_client *clp; | 1235 | struct nfs_client *clp; |
1283 | 1236 | ||
1284 | /* display header on line 1 */ | 1237 | /* display header on line 1 */ |
1285 | if (v == SEQ_START_TOKEN) { | 1238 | if (v == &nfs_client_list) { |
1286 | seq_puts(m, "NV SERVER PORT USE HOSTNAME\n"); | 1239 | seq_puts(m, "NV SERVER PORT USE HOSTNAME\n"); |
1287 | return 0; | 1240 | return 0; |
1288 | } | 1241 | } |
@@ -1323,23 +1276,9 @@ static int nfs_volume_list_open(struct inode *inode, struct file *file) | |||
1323 | */ | 1276 | */ |
1324 | static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) | 1277 | static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) |
1325 | { | 1278 | { |
1326 | struct list_head *_p; | ||
1327 | loff_t pos = *_pos; | ||
1328 | |||
1329 | /* lock the list against modification */ | 1279 | /* lock the list against modification */ |
1330 | spin_lock(&nfs_client_lock); | 1280 | spin_lock(&nfs_client_lock); |
1331 | 1281 | return seq_list_start_head(&nfs_volume_list, *_pos); | |
1332 | /* allow for the header line */ | ||
1333 | if (!pos) | ||
1334 | return SEQ_START_TOKEN; | ||
1335 | pos--; | ||
1336 | |||
1337 | /* find the n'th element in the list */ | ||
1338 | list_for_each(_p, &nfs_volume_list) | ||
1339 | if (!pos--) | ||
1340 | break; | ||
1341 | |||
1342 | return _p != &nfs_volume_list ? _p : NULL; | ||
1343 | } | 1282 | } |
1344 | 1283 | ||
1345 | /* | 1284 | /* |
@@ -1347,14 +1286,7 @@ static void *nfs_volume_list_start(struct seq_file *m, loff_t *_pos) | |||
1347 | */ | 1286 | */ |
1348 | static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos) | 1287 | static void *nfs_volume_list_next(struct seq_file *p, void *v, loff_t *pos) |
1349 | { | 1288 | { |
1350 | struct list_head *_p; | 1289 | return seq_list_next(v, &nfs_volume_list, pos); |
1351 | |||
1352 | (*pos)++; | ||
1353 | |||
1354 | _p = v; | ||
1355 | _p = (v == SEQ_START_TOKEN) ? nfs_volume_list.next : _p->next; | ||
1356 | |||
1357 | return _p != &nfs_volume_list ? _p : NULL; | ||
1358 | } | 1290 | } |
1359 | 1291 | ||
1360 | /* | 1292 | /* |
@@ -1375,7 +1307,7 @@ static int nfs_volume_list_show(struct seq_file *m, void *v) | |||
1375 | char dev[8], fsid[17]; | 1307 | char dev[8], fsid[17]; |
1376 | 1308 | ||
1377 | /* display header on line 1 */ | 1309 | /* display header on line 1 */ |
1378 | if (v == SEQ_START_TOKEN) { | 1310 | if (v == &nfs_volume_list) { |
1379 | seq_puts(m, "NV SERVER PORT DEV FSID\n"); | 1311 | seq_puts(m, "NV SERVER PORT DEV FSID\n"); |
1380 | return 0; | 1312 | return 0; |
1381 | } | 1313 | } |