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)
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to