From 19d813da6a60a357abccfad520228fd5564c0344 Mon Sep 17 00:00:00 2001 From: Olga Kornievskaia Date: Mon, 11 Jun 2012 12:21:07 -0400 Subject: [PATCH] handle err_file_open on delete if we get this error when we are trying to remove the file before closing (ie windows doesn't allow removal of opened files), we first send the close and then re-try the remove --- daemon/open.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/daemon/open.c b/daemon/open.c index de3850e..c7bd412 100644 --- a/daemon/open.c +++ b/daemon/open.c @@ -895,10 +895,18 @@ static int handle_close(nfs41_upcall *upcall) nfs41_delegation_return(state->session, &state->file, OPEN_DELEGATE_WRITE, TRUE); - dprintf(1, "calling nfs41_remove for %s\n", name->name); + dprintf(1, "calling nfs41_remove for %s\n", name->name); +retry_delete: rm_status = nfs41_remove(state->session, &state->parent, name, state->file.fh.fileid); if (rm_status) { + if (rm_status == NFS4ERR_FILE_OPEN) { + status = do_nfs41_close(state); + if (!status) { + state->do_close = 0; + goto retry_delete; + } else goto out; + } dprintf(1, "nfs41_remove() failed with error %s.\n", nfs_error_string(rm_status)); rm_status = nfs_to_windows_error(rm_status, ERROR_INTERNAL_ERROR);