From owner-svn-src-all@freebsd.org Sat Jul 21 19:48:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 181D3102AA99; Sat, 21 Jul 2018 19:48:33 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A8F8D756B1; Sat, 21 Jul 2018 19:48:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DCD323683; Sat, 21 Jul 2018 19:48:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w6LJmW3Q003450; Sat, 21 Jul 2018 19:48:32 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w6LJmWOv003449; Sat, 21 Jul 2018 19:48:32 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201807211948.w6LJmWOv003449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 21 Jul 2018 19:48:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r336587 - head/libexec/tftpd X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/libexec/tftpd X-SVN-Commit-Revision: 336587 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 21 Jul 2018 19:48:33 -0000 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)