aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@primarydata.com>2015-03-09 14:01:25 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2015-03-27 12:32:24 -0400
commit4e59080397faadee59d39ffa2116dc8607adc9c9 (patch)
treecbf455eb14536ccab378215e85257ebfa9c5790a
parentfb1458f4578c8dc78dc124de2a58950a6d4e3492 (diff)
NFSv4.1: Allow getdeviceinfo to return notification info back to caller
We are only allowed to cache deviceinfo if the server supports notifications and actually promises to call us back when changes occur. Right now, we request those notifications, but then we don't check the server's reply. Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/nfs4proc.c5
-rw-r--r--fs/nfs/nfs4xdr.c14
-rw-r--r--include/linux/nfs_xdr.h2
3 files changed, 12 insertions, 9 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 627f37c44456..ba8b2b5e98a1 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -7944,6 +7944,8 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server,
7944{ 7944{
7945 struct nfs4_getdeviceinfo_args args = { 7945 struct nfs4_getdeviceinfo_args args = {
7946 .pdev = pdev, 7946 .pdev = pdev,
7947 .notify_types = NOTIFY_DEVICEID4_CHANGE |
7948 NOTIFY_DEVICEID4_DELETE,
7947 }; 7949 };
7948 struct nfs4_getdeviceinfo_res res = { 7950 struct nfs4_getdeviceinfo_res res = {
7949 .pdev = pdev, 7951 .pdev = pdev,
@@ -7958,6 +7960,9 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server,
7958 7960
7959 dprintk("--> %s\n", __func__); 7961 dprintk("--> %s\n", __func__);
7960 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); 7962 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
7963 if (res.notification & ~args.notify_types)
7964 dprintk("%s: unsupported notification\n", __func__);
7965
7961 dprintk("<-- %s status=%d\n", __func__, status); 7966 dprintk("<-- %s status=%d\n", __func__, status);
7962 7967
7963 return status; 7968 return status;
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 5c399ec41079..6b28a605c697 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -1920,7 +1920,7 @@ encode_getdeviceinfo(struct xdr_stream *xdr,
1920 1920
1921 p = reserve_space(xdr, 4 + 4); 1921 p = reserve_space(xdr, 4 + 4);
1922 *p++ = cpu_to_be32(1); /* bitmap length */ 1922 *p++ = cpu_to_be32(1); /* bitmap length */
1923 *p++ = cpu_to_be32(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE); 1923 *p++ = cpu_to_be32(args->notify_types);
1924} 1924}
1925 1925
1926static void 1926static void
@@ -5753,8 +5753,9 @@ out_overflow:
5753 5753
5754#if defined(CONFIG_NFS_V4_1) 5754#if defined(CONFIG_NFS_V4_1)
5755static int decode_getdeviceinfo(struct xdr_stream *xdr, 5755static int decode_getdeviceinfo(struct xdr_stream *xdr,
5756 struct pnfs_device *pdev) 5756 struct nfs4_getdeviceinfo_res *res)
5757{ 5757{
5758 struct pnfs_device *pdev = res->pdev;
5758 __be32 *p; 5759 __be32 *p;
5759 uint32_t len, type; 5760 uint32_t len, type;
5760 int status; 5761 int status;
@@ -5802,12 +5803,7 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
5802 if (unlikely(!p)) 5803 if (unlikely(!p))
5803 goto out_overflow; 5804 goto out_overflow;
5804 5805
5805 if (be32_to_cpup(p++) & 5806 res->notification = be32_to_cpup(p++);
5806 ~(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE)) {
5807 dprintk("%s: unsupported notification\n",
5808 __func__);
5809 }
5810
5811 for (i = 1; i < len; i++) { 5807 for (i = 1; i < len; i++) {
5812 if (be32_to_cpup(p++)) { 5808 if (be32_to_cpup(p++)) {
5813 dprintk("%s: unsupported notification\n", 5809 dprintk("%s: unsupported notification\n",
@@ -7061,7 +7057,7 @@ static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp,
7061 status = decode_sequence(xdr, &res->seq_res, rqstp); 7057 status = decode_sequence(xdr, &res->seq_res, rqstp);
7062 if (status != 0) 7058 if (status != 0)
7063 goto out; 7059 goto out;
7064 status = decode_getdeviceinfo(xdr, res->pdev); 7060 status = decode_getdeviceinfo(xdr, res);
7065out: 7061out:
7066 return status; 7062 return status;
7067} 7063}
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 4cb3eaa89cf7..3d88908fd140 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -255,11 +255,13 @@ struct nfs4_layoutget {
255struct nfs4_getdeviceinfo_args { 255struct nfs4_getdeviceinfo_args {
256 struct nfs4_sequence_args seq_args; 256 struct nfs4_sequence_args seq_args;
257 struct pnfs_device *pdev; 257 struct pnfs_device *pdev;
258 __u32 notify_types;
258}; 259};
259 260
260struct nfs4_getdeviceinfo_res { 261struct nfs4_getdeviceinfo_res {
261 struct nfs4_sequence_res seq_res; 262 struct nfs4_sequence_res seq_res;
262 struct pnfs_device *pdev; 263 struct pnfs_device *pdev;
264 __u32 notification;
263}; 265};
264 266
265struct nfs4_layoutcommit_args { 267struct nfs4_layoutcommit_args {