fs/nfs/nfs4proc.c | 59 ++++++++----------------------------------------- fs/nfs/nfs4renewd.c | 2 - fs/nfs/nfs4xdr.c | 46 +++++++++++++++++++++++++++++++++----- include/linux/nfs4.h | 1 include/linux/nfs_fs.h | 2 - 5 files changed, 53 insertions(+), 57 deletions(-) diff -u --recursive --new-file linux-2.6.0-11.5-rpc_clone2/fs/nfs/nfs4proc.c linux-2.6.0-12-renew_xdr/fs/nfs/nfs4proc.c --- linux-2.6.0-11.5-rpc_clone2/fs/nfs/nfs4proc.c 2003-11-03 17:22:26.000000000 -0500 +++ linux-2.6.0-12-renew_xdr/fs/nfs/nfs4proc.c 2003-11-03 17:26:40.000000000 -0500 @@ -429,18 +429,6 @@ } static void -nfs4_setup_renew(struct nfs4_compound *cp) -{ - struct nfs4_client **client_state = GET_OP(cp, renew); - - *client_state = cp->server->nfs4_state; - - OPNUM(cp) = OP_RENEW; - cp->req_nops++; - cp->renew_index = cp->req_nops; -} - -static void nfs4_setup_restorefh(struct nfs4_compound *cp) { OPNUM(cp) = OP_RESTOREFH; @@ -1648,55 +1636,28 @@ } /* - * nfs4_proc_renew(): This is not one of the nfs_rpc_ops; it is a special + * nfs4_proc_async_renew(): This is not one of the nfs_rpc_ops; it is a special * standalone procedure for queueing an asynchronous RENEW. */ -struct renew_desc { - struct rpc_task task; - struct nfs4_compound compound; - struct nfs4_op ops[1]; -}; - static void renew_done(struct rpc_task *task) { - struct nfs4_compound *cp = (struct nfs4_compound *) task->tk_msg.rpc_argp; - process_lease(cp); -} - -static void -renew_release(struct rpc_task *task) -{ - kfree(task->tk_calldata); + struct nfs_server *server = (struct nfs_server *)task->tk_msg.rpc_resp; + unsigned long timestamp = (unsigned long)task->tk_calldata; + renew_lease(server, timestamp); } int -nfs4_proc_renew(struct nfs_server *server) +nfs4_proc_async_renew(struct nfs_server *server, struct rpc_cred *cred) { - struct renew_desc *rp; - struct rpc_task *task; - struct nfs4_compound *cp; struct rpc_message msg = { - .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMPOUND], + .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENEW], + .rpc_argp = server->nfs4_state, + .rpc_resp = server, + .rpc_cred = cred, }; - rp = (struct renew_desc *) kmalloc(sizeof(*rp), GFP_KERNEL); - if (!rp) - return -ENOMEM; - cp = &rp->compound; - task = &rp->task; - - nfs4_setup_compound(cp, rp->ops, server, "renew"); - nfs4_setup_renew(cp); - - msg.rpc_argp = cp; - msg.rpc_resp = cp; - rpc_init_task(task, server->client, renew_done, RPC_TASK_ASYNC); - rpc_call_setup(task, &msg, 0); - task->tk_calldata = rp; - task->tk_release = renew_release; - - return rpc_execute(task); + return rpc_call_async(server->client, &msg, 0, renew_done, (void *)jiffies); } /* diff -u --recursive --new-file linux-2.6.0-11.5-rpc_clone2/fs/nfs/nfs4renewd.c linux-2.6.0-12-renew_xdr/fs/nfs/nfs4renewd.c --- linux-2.6.0-11.5-rpc_clone2/fs/nfs/nfs4renewd.c 2003-11-03 15:59:16.000000000 -0500 +++ linux-2.6.0-12-renew_xdr/fs/nfs/nfs4renewd.c 2003-11-03 16:31:34.000000000 -0500 @@ -70,7 +70,7 @@ timeout = (2 * lease) / 3 + last - jiffies; else { /* Queue an asynchronous RENEW. */ - nfs4_proc_renew(server); + nfs4_proc_async_renew(server, NULL); timeout = (2 * lease) / 3; } diff -u --recursive --new-file linux-2.6.0-11.5-rpc_clone2/fs/nfs/nfs4xdr.c linux-2.6.0-12-renew_xdr/fs/nfs/nfs4xdr.c --- linux-2.6.0-11.5-rpc_clone2/fs/nfs/nfs4xdr.c 2003-11-03 16:30:06.000000000 -0500 +++ linux-2.6.0-12-renew_xdr/fs/nfs/nfs4xdr.c 2003-11-03 16:31:34.000000000 -0500 @@ -90,6 +90,8 @@ #define decode_pre_write_getattr_maxsz op_decode_hdr_maxsz + 5 #define encode_post_write_getattr_maxsz op_encode_hdr_maxsz + 2 #define decode_post_write_getattr_maxsz op_decode_hdr_maxsz + 13 +#define encode_renew_maxsz op_encode_hdr_maxsz + 3 +#define decode_renew_maxsz op_decode_hdr_maxsz #define NFS4_enc_compound_sz 1024 /* XXX: large enough? */ #define NFS4_dec_compound_sz 1024 /* XXX: large enough? */ @@ -159,6 +161,10 @@ #define NFS4_dec_setattr_sz compound_decode_hdr_maxsz + \ decode_putfh_maxsz + \ op_decode_hdr_maxsz + 3 +#define NFS4_enc_renew_sz compound_encode_hdr_maxsz + \ + encode_renew_maxsz +#define NFS4_dec_renew_sz compound_decode_hdr_maxsz + \ + decode_renew_maxsz static struct { @@ -891,9 +897,6 @@ case OP_RENAME: status = encode_rename(xdr, &cp->ops[i].u.rename); break; - case OP_RENEW: - status = encode_renew(xdr, cp->ops[i].u.renew); - break; case OP_RESTOREFH: status = encode_restorefh(xdr); break; @@ -1134,6 +1137,22 @@ } /* + * a RENEW request + */ +static int +nfs4_xdr_enc_renew(struct rpc_rqst *req, uint32_t *p, struct nfs4_client *clp) +{ + struct xdr_stream xdr; + struct compound_hdr hdr = { + .nops = 1, + }; + + xdr_init_encode(&xdr, &req->rq_snd_buf, p); + encode_compound_hdr(&xdr, &hdr); + return encode_renew(&xdr, clp); +} + +/* * START OF "GENERIC" DECODE ROUTINES. * These may look a little ugly since they are imported from a "generic" * set of XDR encode/decode routines which are intended to be shared by @@ -2141,9 +2160,6 @@ case OP_RENAME: status = decode_rename(xdr, &op->u.rename); break; - case OP_RENEW: - status = decode_renew(xdr); - break; case OP_SAVEFH: status = decode_savefh(xdr); break; @@ -2391,6 +2407,23 @@ return status; } +/* + * Decode RENEW response + */ +static int +nfs4_xdr_dec_renew(struct rpc_rqst *rqstp, uint32_t *p, void *dummy) +{ + struct xdr_stream xdr; + struct compound_hdr hdr; + int status; + + xdr_init_decode(&xdr, &rqstp->rq_rcv_buf, p); + status = decode_compound_hdr(&xdr, &hdr); + if (!status) + status = decode_renew(&xdr); + return status; +} + uint32_t * nfs4_decode_dirent(uint32_t *p, struct nfs_entry *entry, int plus) { @@ -2447,6 +2480,7 @@ PROC(OPEN_CONFIRM, enc_open_confirm, dec_open_confirm), PROC(CLOSE, enc_close, dec_close), PROC(SETATTR, enc_setattr, dec_setattr), + PROC(RENEW, enc_renew, dec_renew), }; struct rpc_version nfs_version4 = { diff -u --recursive --new-file linux-2.6.0-11.5-rpc_clone2/include/linux/nfs4.h linux-2.6.0-12-renew_xdr/include/linux/nfs4.h --- linux-2.6.0-11.5-rpc_clone2/include/linux/nfs4.h 2003-11-03 15:57:14.000000000 -0500 +++ linux-2.6.0-12-renew_xdr/include/linux/nfs4.h 2003-11-03 16:31:34.000000000 -0500 @@ -221,6 +221,7 @@ NFSPROC4_CLNT_OPEN_CONFIRM, NFSPROC4_CLNT_CLOSE, NFSPROC4_CLNT_SETATTR, + NFSPROC4_CLNT_RENEW, }; #endif diff -u --recursive --new-file linux-2.6.0-11.5-rpc_clone2/include/linux/nfs_fs.h linux-2.6.0-12-renew_xdr/include/linux/nfs_fs.h --- linux-2.6.0-11.5-rpc_clone2/include/linux/nfs_fs.h 2003-11-03 17:56:34.000000000 -0500 +++ linux-2.6.0-12-renew_xdr/include/linux/nfs_fs.h 2003-11-03 17:56:48.000000000 -0500 @@ -546,7 +546,7 @@ /* nfs4proc.c */ -extern int nfs4_proc_renew(struct nfs_server *server); +extern int nfs4_proc_async_renew(struct nfs_server *server, struct rpc_cred *); extern int nfs4_do_close(struct inode *, struct nfs4_state *); /* nfs4renewd.c */