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 <cbodley@citi.umich.edu>
This commit is contained in:
Casey Bodley 2010-12-17 14:20:58 -05:00 committed by unknown
parent 6331621924
commit 4ea730c881

View file

@ -29,6 +29,8 @@
#include "util.h" #include "util.h"
#define NFSD_VERSION_MISMATCH 116
extern const nfs41_upcall_op nfs41_op_mount; extern const nfs41_upcall_op nfs41_op_mount;
extern const nfs41_upcall_op nfs41_op_unmount; extern const nfs41_upcall_op nfs41_op_unmount;
extern const nfs41_upcall_op nfs41_op_open; extern const nfs41_upcall_op nfs41_op_open;
@ -96,7 +98,7 @@ int upcall_parse(
opcode2string(upcall->opcode)); opcode2string(upcall->opcode));
if (version != NFS41D_VERSION) { if (version != NFS41D_VERSION) {
eprintf("received version %d expecting version %d\n", 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; goto out;
} }
@ -187,7 +189,7 @@ void upcall_cleanup(
IN nfs41_upcall *upcall) IN nfs41_upcall *upcall)
{ {
const nfs41_upcall_op *op = g_upcall_op_table[upcall->opcode]; 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); op->cleanup(upcall);
if (upcall->state_ref) { if (upcall->state_ref) {