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

Reply via email to