Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 21 Jul 2018 19:48:32 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r336587 - head/libexec/tftpd
Message-ID:  <201807211948.w6LJmWOv003449@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Sat Jul 21 19:48:31 2018
New Revision: 336587
URL: https://svnweb.freebsd.org/changeset/base/336587

Log:
  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
  MFC after:	2 weeks

Modified:
  head/libexec/tftpd/tftp-transfer.c

Modified: head/libexec/tftpd/tftp-transfer.c
==============================================================================
--- head/libexec/tftpd/tftp-transfer.c	Sat Jul 21 19:28:07 2018	(r336586)
+++ head/libexec/tftpd/tftp-transfer.c	Sat Jul 21 19:48:31 2018	(r336587)
@@ -279,6 +279,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:
@@ -303,8 +305,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?201807211948.w6LJmWOv003449>