aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2014-09-10 20:37:28 -0400
committerTrond Myklebust <trond.myklebust@primarydata.com>2014-09-12 13:33:50 -0400
commit84c9dee3adc2bc49a52af74f18378a4887448288 (patch)
treea997debdaedf553ad8e6612c477938ca720099d0
parent5c83746a0cf2831d4b59f5cf99ef5fbf138564e4 (diff)
pnfs: enable CB_NOTIFY_DEVICEID support
This code has been around for a while, but never was enabled, although it is in a working shape. Note that we implement NOTIFY_DEVICEID4_CHANGE identical to NOTIFY_DEVICEID4_DELETE. Given that in either case we can't do anything but preventing further lookups of a given device ID there isn't much difference in semantics for the two. For the delete case the server MUST ensure that there are no outstanding layouts, while for the change case it doesn't, but that has little relevance to the client. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r--fs/nfs/callback_proc.c3
-rw-r--r--fs/nfs/nfs4xdr.c31
2 files changed, 23 insertions, 11 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index 56bd0eaf645e..73466b934090 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -289,9 +289,6 @@ __be32 nfs4_callback_devicenotify(struct cb_devicenotifyargs *args,
289 } 289 }
290 290
291 found: 291 found:
292 if (dev->cbd_notify_type == NOTIFY_DEVICEID4_CHANGE)
293 dprintk("%s: NOTIFY_DEVICEID4_CHANGE not supported, "
294 "deleting instead\n", __func__);
295 nfs4_delete_deviceid(server->pnfs_curr_ld, clp, &dev->cbd_dev_id); 292 nfs4_delete_deviceid(server->pnfs_curr_ld, clp, &dev->cbd_dev_id);
296 } 293 }
297 294
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index b8165eab0a32..005d03c5d274 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -362,14 +362,19 @@ 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_getdeviceinfo_maxsz (op_encode_hdr_maxsz + 4 + \ 365#define encode_getdeviceinfo_maxsz (op_encode_hdr_maxsz + \
366 XDR_QUADLEN(NFS4_DEVICEID4_SIZE)) 366 XDR_QUADLEN(NFS4_DEVICEID4_SIZE) + \
367 1 /* layout type */ + \
368 1 /* maxcount */ + \
369 1 /* bitmap size */ + \
370 1 /* notification bitmap length */ + \
371 1 /* notification bitmap, word 0 */)
367#define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + \ 372#define decode_getdeviceinfo_maxsz (op_decode_hdr_maxsz + \
368 1 /* layout type */ + \ 373 1 /* layout type */ + \
369 1 /* opaque devaddr4 length */ + \ 374 1 /* opaque devaddr4 length */ + \
370 /* devaddr4 payload is read into page */ \ 375 /* devaddr4 payload is read into page */ \
371 1 /* notification bitmap length */ + \ 376 1 /* notification bitmap length */ + \
372 1 /* notification bitmap */) 377 1 /* notification bitmap, word 0 */)
373#define encode_layoutget_maxsz (op_encode_hdr_maxsz + 10 + \ 378#define encode_layoutget_maxsz (op_encode_hdr_maxsz + 10 + \
374 encode_stateid_maxsz) 379 encode_stateid_maxsz)
375#define decode_layoutget_maxsz (op_decode_hdr_maxsz + 8 + \ 380#define decode_layoutget_maxsz (op_decode_hdr_maxsz + 8 + \
@@ -1918,12 +1923,15 @@ encode_getdeviceinfo(struct xdr_stream *xdr,
1918 __be32 *p; 1923 __be32 *p;
1919 1924
1920 encode_op_hdr(xdr, OP_GETDEVICEINFO, decode_getdeviceinfo_maxsz, hdr); 1925 encode_op_hdr(xdr, OP_GETDEVICEINFO, decode_getdeviceinfo_maxsz, hdr);
1921 p = reserve_space(xdr, 12 + NFS4_DEVICEID4_SIZE); 1926 p = reserve_space(xdr, NFS4_DEVICEID4_SIZE + 4 + 4);
1922 p = xdr_encode_opaque_fixed(p, args->pdev->dev_id.data, 1927 p = xdr_encode_opaque_fixed(p, args->pdev->dev_id.data,
1923 NFS4_DEVICEID4_SIZE); 1928 NFS4_DEVICEID4_SIZE);
1924 *p++ = cpu_to_be32(args->pdev->layout_type); 1929 *p++ = cpu_to_be32(args->pdev->layout_type);
1925 *p++ = cpu_to_be32(args->pdev->maxcount); /* gdia_maxcount */ 1930 *p++ = cpu_to_be32(args->pdev->maxcount); /* gdia_maxcount */
1926 *p++ = cpu_to_be32(0); /* bitmap length 0 */ 1931
1932 p = reserve_space(xdr, 4 + 4);
1933 *p++ = cpu_to_be32(1); /* bitmap length */
1934 *p++ = cpu_to_be32(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE);
1927} 1935}
1928 1936
1929static void 1937static void
@@ -5767,9 +5775,16 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
5767 p = xdr_inline_decode(xdr, 4 * len); 5775 p = xdr_inline_decode(xdr, 4 * len);
5768 if (unlikely(!p)) 5776 if (unlikely(!p))
5769 goto out_overflow; 5777 goto out_overflow;
5770 for (i = 0; i < len; i++, p++) { 5778
5771 if (be32_to_cpup(p)) { 5779 if (be32_to_cpup(p++) &
5772 dprintk("%s: notifications not supported\n", 5780 ~(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE)) {
5781 dprintk("%s: unsupported notification\n",
5782 __func__);
5783 }
5784
5785 for (i = 1; i < len; i++) {
5786 if (be32_to_cpup(p++)) {
5787 dprintk("%s: unsupported notification\n",
5773 __func__); 5788 __func__);
5774 return -EIO; 5789 return -EIO;
5775 } 5790 }