Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Oct 2018 16:07:32 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r339058 - stable/10/libexec/tftpd
Message-ID:  <201810011607.w91G7Wub014212@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Mon Oct  1 16:07:32 2018
New Revision: 339058
URL: https://svnweb.freebsd.org/changeset/base/339058

Log:
  MFC r336587:
  
  tftpd(8): when completing an WRQ, flush the file before acknowleding receipt
  
  tftpd(8) should flush a newly written file to disk before ACKing the final DATA
  packet.  Otherwise there is a narrow race window when a subsequent read may not
  see the file.  This is somewhat related to r330710, but the race window is much
  smaller.  Hopefully this will fix the intermittent tests in Jenkins.
  
  Reported by:	Jenkins

Modified:
  stable/10/libexec/tftpd/tftp-transfer.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/tftpd/tftp-transfer.c
==============================================================================
--- stable/10/libexec/tftpd/tftp-transfer.c	Mon Oct  1 16:04:07 2018	(r339057)
+++ stable/10/libexec/tftpd/tftp-transfer.c	Mon Oct  1 16:07:32 2018	(r339058)
@@ -277,6 +277,8 @@ tftp_receive(int peer, uint16_t *block, struct tftp_st
 					send_error(peer, ENOSPACE);
 				goto abort;
 			}
+			if (n_data != segsize)
+				write_close();
 		}
 
 send_ack:
@@ -301,8 +303,6 @@ send_ack:
 		}
 		gettimeofday(&(ts->tstop), NULL);
 	} while (n_data == segsize);
-
-	write_close();
 
 	/* Don't do late packet management for the client implementation */
 	if (acting_as_client)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201810011607.w91G7Wub014212>