svn commit: r339049 - stable/11/libexec/tftpd

Alan Somers asomers at FreeBSD.org
Mon Oct 1 15:43:57 UTC 2018


Author: asomers
Date: Mon Oct  1 15:43:56 2018
New Revision: 339049
URL: https://svnweb.freebsd.org/changeset/base/339049

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/11/libexec/tftpd/tftp-transfer.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/libexec/tftpd/tftp-transfer.c
==============================================================================
--- stable/11/libexec/tftpd/tftp-transfer.c	Mon Oct  1 15:40:06 2018	(r339048)
+++ stable/11/libexec/tftpd/tftp-transfer.c	Mon Oct  1 15:43:56 2018	(r339049)
@@ -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)


More information about the svn-src-all mailing list