From 04047a9b534e9d3545d02afd674b230f4a2d459d Mon Sep 17 00:00:00 2001 From: Casey Bodley Date: Tue, 12 Oct 2010 09:54:16 -0400 Subject: [PATCH] handling NFS4ERR_OPENMODE on read if read fails with NFS4ERR_OPENMODE, retry th read with a special stateid. --- daemon/readwrite.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/daemon/readwrite.c b/daemon/readwrite.c index 9b520cb..71cad66 100644 --- a/daemon/readwrite.c +++ b/daemon/readwrite.c @@ -30,6 +30,8 @@ #include "daemon_debug.h" #include "util.h" +stateid4 special_read_stateid = {0xffffffff, + {0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}}; int parse_rw(unsigned char *buffer, uint32_t length, nfs41_upcall *upcall) { @@ -81,10 +83,14 @@ static int read_from_mds( status = nfs41_read(session, file, stateid, offset + reloffset, chunk, p, &bytes_read, &eof); - if (status && !len) { + if (status == NFS4ERR_OPENMODE && !len) { + stateid = &special_read_stateid; + continue; + } else if (status && !len) { status = nfs_to_windows_error(status, ERROR_NET_WRITE_FAULT); goto out; } + p += bytes_read; to_rcv -= bytes_read; len += bytes_read;