Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+12 -9
+5
fs/nfs/nfs4proc.c
··· 7944 7944 { 7945 7945 struct nfs4_getdeviceinfo_args args = { 7946 7946 .pdev = pdev, 7947 + .notify_types = NOTIFY_DEVICEID4_CHANGE | 7948 + NOTIFY_DEVICEID4_DELETE, 7947 7949 }; 7948 7950 struct nfs4_getdeviceinfo_res res = { 7949 7951 .pdev = pdev, ··· 7960 7958 7961 7959 dprintk("--> %s\n", __func__); 7962 7960 status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); 7961 + if (res.notification & ~args.notify_types) 7962 + dprintk("%s: unsupported notification\n", __func__); 7963 + 7963 7964 dprintk("<-- %s status=%d\n", __func__, status); 7964 7965 7965 7966 return status;
+5 -9
fs/nfs/nfs4xdr.c
··· 1920 1920 1921 1921 p = reserve_space(xdr, 4 + 4); 1922 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 1926 1926 static void ··· 5753 5753 5754 5754 #if defined(CONFIG_NFS_V4_1) 5755 5755 static 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 5759 __be32 *p; 5759 5760 uint32_t len, type; 5760 5761 int status; ··· 5803 5802 if (unlikely(!p)) 5804 5803 goto out_overflow; 5805 5804 5806 - if (be32_to_cpup(p++) & 5807 - ~(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE)) { 5808 - dprintk("%s: unsupported notification\n", 5809 - __func__); 5810 - } 5811 - 5805 + res->notification = be32_to_cpup(p++); 5812 5806 for (i = 1; i < len; i++) { 5813 5807 if (be32_to_cpup(p++)) { 5814 5808 dprintk("%s: unsupported notification\n", ··· 7057 7061 status = decode_sequence(xdr, &res->seq_res, rqstp); 7058 7062 if (status != 0) 7059 7063 goto out; 7060 - status = decode_getdeviceinfo(xdr, res->pdev); 7064 + status = decode_getdeviceinfo(xdr, res); 7061 7065 out: 7062 7066 return status; 7063 7067 }
+2
include/linux/nfs_xdr.h
··· 255 255 struct nfs4_getdeviceinfo_args { 256 256 struct nfs4_sequence_args seq_args; 257 257 struct pnfs_device *pdev; 258 + __u32 notify_types; 258 259 }; 259 260 260 261 struct nfs4_getdeviceinfo_res { 261 262 struct nfs4_sequence_res seq_res; 262 263 struct pnfs_device *pdev; 264 + __u32 notification; 263 265 }; 264 266 265 267 struct nfs4_layoutcommit_args {