aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/nfs/blocklayout/blocklayout.c2
-rw-r--r--fs/nfs/nfs4proc.c48
-rw-r--r--fs/nfs/nfs4xdr.c130
-rw-r--r--fs/nfs/pnfs.h5
-rw-r--r--fs/nfs/pnfs_dev.c30
-rw-r--r--include/linux/nfs_xdr.h11
6 files changed, 1 insertions, 225 deletions
diff --git a/fs/nfs/blocklayout/blocklayout.c b/fs/nfs/blocklayout/blocklayout.c
index 25ba9e0e6fff..3e1f1afc6db4 100644
--- a/fs/nfs/blocklayout/blocklayout.c
+++ b/fs/nfs/blocklayout/blocklayout.c
@@ -532,7 +532,7 @@ bl_set_layoutdriver(struct nfs_server *server, const struct nfs_fh *fh)
532 return -EINVAL; 532 return -EINVAL;
533 } 533 }
534 534
535 return nfs4_deviceid_getdevicelist(server, fh); 535 return 0;
536} 536}
537 537
538static bool 538static bool
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 47fa67a3a8cf..0b711227cfa5 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7808,54 +7808,6 @@ int nfs4_proc_layoutreturn(struct nfs4_layoutreturn *lrp)
7808 return status; 7808 return status;
7809} 7809}
7810 7810
7811/*
7812 * Retrieve the list of Data Server devices from the MDS.
7813 */
7814static int _nfs4_getdevicelist(struct nfs_server *server,
7815 const struct nfs_fh *fh,
7816 struct pnfs_devicelist *devlist)
7817{
7818 struct nfs4_getdevicelist_args args = {
7819 .fh = fh,
7820 .layoutclass = server->pnfs_curr_ld->id,
7821 };
7822 struct nfs4_getdevicelist_res res = {
7823 .devlist = devlist,
7824 };
7825 struct rpc_message msg = {
7826 .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETDEVICELIST],
7827 .rpc_argp = &args,
7828 .rpc_resp = &res,
7829 };
7830 int status;
7831
7832 dprintk("--> %s\n", __func__);
7833 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args,
7834 &res.seq_res, 0);
7835 dprintk("<-- %s status=%d\n", __func__, status);
7836 return status;
7837}
7838
7839int nfs4_proc_getdevicelist(struct nfs_server *server,
7840 const struct nfs_fh *fh,
7841 struct pnfs_devicelist *devlist)
7842{
7843 struct nfs4_exception exception = { };
7844 int err;
7845
7846 do {
7847 err = nfs4_handle_exception(server,
7848 _nfs4_getdevicelist(server, fh, devlist),
7849 &exception);
7850 } while (exception.retry);
7851
7852 dprintk("%s: err=%d, num_devs=%u\n", __func__,
7853 err, devlist->num_devs);
7854
7855 return err;
7856}
7857EXPORT_SYMBOL_GPL(nfs4_proc_getdevicelist);
7858
7859static int 7811static int
7860_nfs4_proc_getdeviceinfo(struct nfs_server *server, 7812_nfs4_proc_getdeviceinfo(struct nfs_server *server,
7861 struct pnfs_device *pdev, 7813 struct pnfs_device *pdev,
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index f2cd957adb90..b8165eab0a32 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -362,17 +362,6 @@ static int nfs4_stat_to_errno(int);
362 XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5) 362 XDR_QUADLEN(NFS4_MAX_SESSIONID_LEN) + 5)
363#define encode_reclaim_complete_maxsz (op_encode_hdr_maxsz + 4) 363#define encode_reclaim_complete_maxsz (op_encode_hdr_maxsz + 4)
364#define decode_reclaim_complete_maxsz (op_decode_hdr_maxsz + 4) 364#define decode_reclaim_complete_maxsz (op_decode_hdr_maxsz + 4)
365#define encode_getdevicelist_maxsz (op_encode_hdr_maxsz + 4 + \
366 encode_verifier_maxsz)
367#define decode_getdevicelist_maxsz (op_decode_hdr_maxsz + \
368 2 /* nfs_cookie4 gdlr_cookie */ + \
369 decode_verifier_maxsz \
370 /* verifier4 gdlr_verifier */ + \
371 1 /* gdlr_deviceid_list count */ + \
372 XDR_QUADLEN(NFS4_PNFS_GETDEVLIST_MAXNUM * \
373 NFS4_DEVICEID4_SIZE) \
374 /* gdlr_deviceid_list */ + \
375 1 /* bool gdlr_eof */)
376#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 4 + \ 365#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 4 + \
377 XDR_QUADLEN(NFS4_DEVICEID4_SIZE)) 366 XDR_QUADLEN(NFS4_DEVICEID4_SIZE))
378#define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + \ 367#define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + \
@@ -812,14 +801,6 @@ static int nfs4_stat_to_errno(int);
812#define NFS4_dec_reclaim_complete_sz (compound_decode_hdr_maxsz + \ 801#define NFS4_dec_reclaim_complete_sz (compound_decode_hdr_maxsz + \
813 decode_sequence_maxsz + \ 802 decode_sequence_maxsz + \
814 decode_reclaim_complete_maxsz) 803 decode_reclaim_complete_maxsz)
815#define NFS4_enc_getdevicelist_sz (compound_encode_hdr_maxsz + \
816 encode_sequence_maxsz + \
817 encode_putfh_maxsz + \
818 encode_getdevicelist_maxsz)
819#define NFS4_dec_getdevicelist_sz (compound_decode_hdr_maxsz + \
820 decode_sequence_maxsz + \
821 decode_putfh_maxsz + \
822 decode_getdevicelist_maxsz)
823#define NFS4_enc_getdeviceinfo_sz (compound_encode_hdr_maxsz + \ 804#define NFS4_enc_getdeviceinfo_sz (compound_encode_hdr_maxsz + \
824 encode_sequence_maxsz +\ 805 encode_sequence_maxsz +\
825 encode_getdeviceinfo_maxsz) 806 encode_getdeviceinfo_maxsz)
@@ -1930,24 +1911,6 @@ static void encode_sequence(struct xdr_stream *xdr,
1930 1911
1931#ifdef CONFIG_NFS_V4_1 1912#ifdef CONFIG_NFS_V4_1
1932static void 1913static void
1933encode_getdevicelist(struct xdr_stream *xdr,
1934 const struct nfs4_getdevicelist_args *args,
1935 struct compound_hdr *hdr)
1936{
1937 __be32 *p;
1938 nfs4_verifier dummy = {
1939 .data = "dummmmmy",
1940 };
1941
1942 encode_op_hdr(xdr, OP_GETDEVICELIST, decode_getdevicelist_maxsz, hdr);
1943 p = reserve_space(xdr, 16);
1944 *p++ = cpu_to_be32(args->layoutclass);
1945 *p++ = cpu_to_be32(NFS4_PNFS_GETDEVLIST_MAXNUM);
1946 xdr_encode_hyper(p, 0ULL); /* cookie */
1947 encode_nfs4_verifier(xdr, &dummy);
1948}
1949
1950static void
1951encode_getdeviceinfo(struct xdr_stream *xdr, 1914encode_getdeviceinfo(struct xdr_stream *xdr,
1952 const struct nfs4_getdeviceinfo_args *args, 1915 const struct nfs4_getdeviceinfo_args *args,
1953 struct compound_hdr *hdr) 1916 struct compound_hdr *hdr)
@@ -2901,24 +2864,6 @@ static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req,
2901} 2864}
2902 2865
2903/* 2866/*
2904 * Encode GETDEVICELIST request
2905 */
2906static void nfs4_xdr_enc_getdevicelist(struct rpc_rqst *req,
2907 struct xdr_stream *xdr,
2908 struct nfs4_getdevicelist_args *args)
2909{
2910 struct compound_hdr hdr = {
2911 .minorversion = nfs4_xdr_minorversion(&args->seq_args),
2912 };
2913
2914 encode_compound_hdr(xdr, req, &hdr);
2915 encode_sequence(xdr, &args->seq_args, &hdr);
2916 encode_putfh(xdr, args->fh, &hdr);
2917 encode_getdevicelist(xdr, args, &hdr);
2918 encode_nops(&hdr);
2919}
2920
2921/*
2922 * Encode GETDEVICEINFO request 2867 * Encode GETDEVICEINFO request
2923 */ 2868 */
2924static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req, 2869static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req,
@@ -5773,54 +5718,6 @@ out_overflow:
5773} 5718}
5774 5719
5775#if defined(CONFIG_NFS_V4_1) 5720#if defined(CONFIG_NFS_V4_1)
5776/*
5777 * TODO: Need to handle case when EOF != true;
5778 */
5779static int decode_getdevicelist(struct xdr_stream *xdr,
5780 struct pnfs_devicelist *res)
5781{
5782 __be32 *p;
5783 int status, i;
5784 nfs4_verifier verftemp;
5785
5786 status = decode_op_hdr(xdr, OP_GETDEVICELIST);
5787 if (status)
5788 return status;
5789
5790 p = xdr_inline_decode(xdr, 8 + 8 + 4);
5791 if (unlikely(!p))
5792 goto out_overflow;
5793
5794 /* TODO: Skip cookie for now */
5795 p += 2;
5796
5797 /* Read verifier */
5798 p = xdr_decode_opaque_fixed(p, verftemp.data, NFS4_VERIFIER_SIZE);
5799
5800 res->num_devs = be32_to_cpup(p);
5801
5802 dprintk("%s: num_dev %d\n", __func__, res->num_devs);
5803
5804 if (res->num_devs > NFS4_PNFS_GETDEVLIST_MAXNUM) {
5805 printk(KERN_ERR "NFS: %s too many result dev_num %u\n",
5806 __func__, res->num_devs);
5807 return -EIO;
5808 }
5809
5810 p = xdr_inline_decode(xdr,
5811 res->num_devs * NFS4_DEVICEID4_SIZE + 4);
5812 if (unlikely(!p))
5813 goto out_overflow;
5814 for (i = 0; i < res->num_devs; i++)
5815 p = xdr_decode_opaque_fixed(p, res->dev_id[i].data,
5816 NFS4_DEVICEID4_SIZE);
5817 res->eof = be32_to_cpup(p);
5818 return 0;
5819out_overflow:
5820 print_overflow_msg(__func__, xdr);
5821 return -EIO;
5822}
5823
5824static int decode_getdeviceinfo(struct xdr_stream *xdr, 5721static int decode_getdeviceinfo(struct xdr_stream *xdr,
5825 struct pnfs_device *pdev) 5722 struct pnfs_device *pdev)
5826{ 5723{
@@ -7105,32 +7002,6 @@ static int nfs4_xdr_dec_reclaim_complete(struct rpc_rqst *rqstp,
7105} 7002}
7106 7003
7107/* 7004/*
7108 * Decode GETDEVICELIST response
7109 */
7110static int nfs4_xdr_dec_getdevicelist(struct rpc_rqst *rqstp,
7111 struct xdr_stream *xdr,
7112 struct nfs4_getdevicelist_res *res)
7113{
7114 struct compound_hdr hdr;
7115 int status;
7116
7117 dprintk("encoding getdevicelist!\n");
7118
7119 status = decode_compound_hdr(xdr, &hdr);
7120 if (status != 0)
7121 goto out;
7122 status = decode_sequence(xdr, &res->seq_res, rqstp);
7123 if (status != 0)
7124 goto out;
7125 status = decode_putfh(xdr);
7126 if (status != 0)
7127 goto out;
7128 status = decode_getdevicelist(xdr, res->devlist);
7129out:
7130 return status;
7131}
7132
7133/*
7134 * Decode GETDEVINFO response 7005 * Decode GETDEVINFO response
7135 */ 7006 */
7136static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp, 7007static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp,
@@ -7498,7 +7369,6 @@ struct rpc_procinfo nfs4_procedures[] = {
7498 PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name), 7369 PROC(SECINFO_NO_NAME, enc_secinfo_no_name, dec_secinfo_no_name),
7499 PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid), 7370 PROC(TEST_STATEID, enc_test_stateid, dec_test_stateid),
7500 PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid), 7371 PROC(FREE_STATEID, enc_free_stateid, dec_free_stateid),
7501 PROC(GETDEVICELIST, enc_getdevicelist, dec_getdevicelist),
7502 PROC(BIND_CONN_TO_SESSION, 7372 PROC(BIND_CONN_TO_SESSION,
7503 enc_bind_conn_to_session, dec_bind_conn_to_session), 7373 enc_bind_conn_to_session, dec_bind_conn_to_session),
7504 PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid), 7374 PROC(DESTROY_CLIENTID, enc_destroy_clientid, dec_destroy_clientid),
diff --git a/fs/nfs/pnfs.h b/fs/nfs/pnfs.h
index d84fe29fc88b..b10f12fc6818 100644
--- a/fs/nfs/pnfs.h
+++ b/fs/nfs/pnfs.h
@@ -180,9 +180,6 @@ extern int pnfs_register_layoutdriver(struct pnfs_layoutdriver_type *);
180extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *); 180extern void pnfs_unregister_layoutdriver(struct pnfs_layoutdriver_type *);
181 181
182/* nfs4proc.c */ 182/* nfs4proc.c */
183extern int nfs4_proc_getdevicelist(struct nfs_server *server,
184 const struct nfs_fh *fh,
185 struct pnfs_devicelist *devlist);
186extern int nfs4_proc_getdeviceinfo(struct nfs_server *server, 183extern int nfs4_proc_getdeviceinfo(struct nfs_server *server,
187 struct pnfs_device *dev, 184 struct pnfs_device *dev,
188 struct rpc_cred *cred); 185 struct rpc_cred *cred);
@@ -277,8 +274,6 @@ bool nfs4_put_deviceid_node(struct nfs4_deviceid_node *);
277void nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node); 274void nfs4_mark_deviceid_unavailable(struct nfs4_deviceid_node *node);
278bool nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node); 275bool nfs4_test_deviceid_unavailable(struct nfs4_deviceid_node *node);
279void nfs4_deviceid_purge_client(const struct nfs_client *); 276void nfs4_deviceid_purge_client(const struct nfs_client *);
280int nfs4_deviceid_getdevicelist(struct nfs_server *server,
281 const struct nfs_fh *fh);
282 277
283static inline struct nfs4_deviceid_node * 278static inline struct nfs4_deviceid_node *
284nfs4_get_deviceid(struct nfs4_deviceid_node *d) 279nfs4_get_deviceid(struct nfs4_deviceid_node *d)
diff --git a/fs/nfs/pnfs_dev.c b/fs/nfs/pnfs_dev.c
index 82c2836fdb38..aa2ec0015183 100644
--- a/fs/nfs/pnfs_dev.c
+++ b/fs/nfs/pnfs_dev.c
@@ -358,33 +358,3 @@ nfs4_deviceid_mark_client_invalid(struct nfs_client *clp)
358 } 358 }
359 rcu_read_unlock(); 359 rcu_read_unlock();
360} 360}
361
362int
363nfs4_deviceid_getdevicelist(struct nfs_server *server,
364 const struct nfs_fh *fh)
365{
366 struct pnfs_devicelist *dlist;
367 struct nfs4_deviceid_node *d;
368 int error = 0, i;
369
370 dlist = kzalloc(sizeof(struct pnfs_devicelist), GFP_NOFS);
371 if (!dlist)
372 return -ENOMEM;
373
374 while (!dlist->eof) {
375 error = nfs4_proc_getdevicelist(server, fh, dlist);
376 if (error)
377 break;
378
379 for (i = 0; i < dlist->num_devs; i++) {
380 d = nfs4_find_get_deviceid(server, &dlist->dev_id[i],
381 NULL, GFP_NOFS);
382 if (d)
383 nfs4_put_deviceid_node(d);
384 }
385 }
386
387 kfree(dlist);
388 return error;
389}
390EXPORT_SYMBOL_GPL(nfs4_deviceid_getdevicelist);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index f4092c6b90fb..7ae249ccb78d 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -252,17 +252,6 @@ struct nfs4_layoutget {
252 gfp_t gfp_flags; 252 gfp_t gfp_flags;
253}; 253};
254 254
255struct nfs4_getdevicelist_args {
256 struct nfs4_sequence_args seq_args;
257 const struct nfs_fh *fh;
258 u32 layoutclass;
259};
260
261struct nfs4_getdevicelist_res {
262 struct nfs4_sequence_res seq_res;
263 struct pnfs_devicelist *devlist;
264};
265
266struct nfs4_getdeviceinfo_args { 255struct nfs4_getdeviceinfo_args {
267 struct nfs4_sequence_args seq_args; 256 struct nfs4_sequence_args seq_args;
268 struct pnfs_device *pdev; 257 struct pnfs_device *pdev;