提交 4e590803 编写于 作者: T Trond Myklebust

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: NTrond Myklebust <trond.myklebust@primarydata.com>
上级 fb1458f4
...@@ -7944,6 +7944,8 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, ...@@ -7944,6 +7944,8 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server,
{ {
struct nfs4_getdeviceinfo_args args = { struct nfs4_getdeviceinfo_args args = {
.pdev = pdev, .pdev = pdev,
.notify_types = NOTIFY_DEVICEID4_CHANGE |
NOTIFY_DEVICEID4_DELETE,
}; };
struct nfs4_getdeviceinfo_res res = { struct nfs4_getdeviceinfo_res res = {
.pdev = pdev, .pdev = pdev,
...@@ -7958,6 +7960,9 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server, ...@@ -7958,6 +7960,9 @@ _nfs4_proc_getdeviceinfo(struct nfs_server *server,
dprintk("--> %s\n", __func__); dprintk("--> %s\n", __func__);
status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); status = nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0);
if (res.notification & ~args.notify_types)
dprintk("%s: unsupported notification\n", __func__);
dprintk("<-- %s status=%d\n", __func__, status); dprintk("<-- %s status=%d\n", __func__, status);
return status; return status;
......
...@@ -1920,7 +1920,7 @@ encode_getdeviceinfo(struct xdr_stream *xdr, ...@@ -1920,7 +1920,7 @@ encode_getdeviceinfo(struct xdr_stream *xdr,
p = reserve_space(xdr, 4 + 4); p = reserve_space(xdr, 4 + 4);
*p++ = cpu_to_be32(1); /* bitmap length */ *p++ = cpu_to_be32(1); /* bitmap length */
*p++ = cpu_to_be32(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE); *p++ = cpu_to_be32(args->notify_types);
} }
static void static void
...@@ -5753,8 +5753,9 @@ static int decode_sequence(struct xdr_stream *xdr, ...@@ -5753,8 +5753,9 @@ static int decode_sequence(struct xdr_stream *xdr,
#if defined(CONFIG_NFS_V4_1) #if defined(CONFIG_NFS_V4_1)
static int decode_getdeviceinfo(struct xdr_stream *xdr, static int decode_getdeviceinfo(struct xdr_stream *xdr,
struct pnfs_device *pdev) struct nfs4_getdeviceinfo_res *res)
{ {
struct pnfs_device *pdev = res->pdev;
__be32 *p; __be32 *p;
uint32_t len, type; uint32_t len, type;
int status; int status;
...@@ -5802,12 +5803,7 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr, ...@@ -5802,12 +5803,7 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
if (unlikely(!p)) if (unlikely(!p))
goto out_overflow; goto out_overflow;
if (be32_to_cpup(p++) & res->notification = be32_to_cpup(p++);
~(NOTIFY_DEVICEID4_CHANGE | NOTIFY_DEVICEID4_DELETE)) {
dprintk("%s: unsupported notification\n",
__func__);
}
for (i = 1; i < len; i++) { for (i = 1; i < len; i++) {
if (be32_to_cpup(p++)) { if (be32_to_cpup(p++)) {
dprintk("%s: unsupported notification\n", dprintk("%s: unsupported notification\n",
...@@ -7061,7 +7057,7 @@ static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp, ...@@ -7061,7 +7057,7 @@ static int nfs4_xdr_dec_getdeviceinfo(struct rpc_rqst *rqstp,
status = decode_sequence(xdr, &res->seq_res, rqstp); status = decode_sequence(xdr, &res->seq_res, rqstp);
if (status != 0) if (status != 0)
goto out; goto out;
status = decode_getdeviceinfo(xdr, res->pdev); status = decode_getdeviceinfo(xdr, res);
out: out:
return status; return status;
} }
......
...@@ -255,11 +255,13 @@ struct nfs4_layoutget { ...@@ -255,11 +255,13 @@ struct nfs4_layoutget {
struct nfs4_getdeviceinfo_args { struct nfs4_getdeviceinfo_args {
struct nfs4_sequence_args seq_args; struct nfs4_sequence_args seq_args;
struct pnfs_device *pdev; struct pnfs_device *pdev;
__u32 notify_types;
}; };
struct nfs4_getdeviceinfo_res { struct nfs4_getdeviceinfo_res {
struct nfs4_sequence_res seq_res; struct nfs4_sequence_res seq_res;
struct pnfs_device *pdev; struct pnfs_device *pdev;
__u32 notification;
}; };
struct nfs4_layoutcommit_args { struct nfs4_layoutcommit_args {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册