From 4ea730c881880fb3486ac1dad1fa9d625499769c Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Fri, 17 Dec 2010 14:20:58 -0500 Subject: [PATCH] fix for daemon version checking crash on close upcall_cleanup() is called after every upcall regardless of errors. if we get a CLOSE upcall after a daemon restart, we still call cleanup_close() and crash attempting to access the invalid open state pointer. avoid calling upcall-specific cancel routines for these version mismatch errors Signed-off-by: Casey Bodley --- daemon/upcall.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/daemon/upcall.c b/daemon/upcall.c index 4072cf0..662d30c 100644 --- a/daemon/upcall.c +++ b/daemon/upcall.c @@ -29,6 +29,8 @@ #include "util.h" +#define NFSD_VERSION_MISMATCH 116 + extern const nfs41_upcall_op nfs41_op_mount; extern const nfs41_upcall_op nfs41_op_unmount; extern const nfs41_upcall_op nfs41_op_open; @@ -96,7 +98,7 @@ int upcall_parse( opcode2string(upcall->opcode)); if (version != NFS41D_VERSION) { eprintf("received version %d expecting version %d\n", version, NFS41D_VERSION); - upcall->status = status = 116; + upcall->status = status = NFSD_VERSION_MISMATCH; goto out; } @@ -187,7 +189,7 @@ void upcall_cleanup( IN nfs41_upcall *upcall) { const nfs41_upcall_op *op = g_upcall_op_table[upcall->opcode]; - if (op && op->cleanup) + if (op && op->cleanup && upcall->status != NFSD_VERSION_MISMATCH) op->cleanup(upcall); if (upcall->state_ref) {