svn commit: r354050 - head/sys/ufs/ufs

Kirk McKusick mckusick at FreeBSD.org
Thu Oct 24 21:28:37 UTC 2019


Author: mckusick
Date: Thu Oct 24 21:28:37 2019
New Revision: 354050
URL: https://svnweb.freebsd.org/changeset/base/354050

Log:
  After the unlink() of one name of a file with multiple links, a
  stat() of one of the remaining names of the file does not show an
  updated ctime (inode modification time) until several seconds after
  the unlink() completes. The problem only occurs when the filesystem
  is running with soft updates enabled. When running with soft updates,
  the ctime is not updated until the soft updates background process
  has settled all the needed I/O operations.
  
  This commit causes the ctime to be updated immediately during the
  unlink(). A side effect of this change is that the ctime is updated
  again when soft updates has finished its processing because that
  is the time that is correct from the perspective of programs that
  look at the disk (like dump). This change does not cause any extra
  I/O to be done, it just ensures that stat() updates the ctime before
  handing it back.
  
  PR:           241373
  Reported by:  Alan Somers
  Tested by:    Alan Somers
  MFC after:    3 days
  Sponsored by: Netflix

Modified:
  head/sys/ufs/ufs/ufs_lookup.c

Modified: head/sys/ufs/ufs/ufs_lookup.c
==============================================================================
--- head/sys/ufs/ufs/ufs_lookup.c	Thu Oct 24 21:10:09 2019	(r354049)
+++ head/sys/ufs/ufs/ufs_lookup.c	Thu Oct 24 21:28:37 2019	(r354050)
@@ -1178,6 +1178,7 @@ ufs_dirremove(dvp, ip, flags, isrmdir)
 	 */
 	if (ip) {
 		ip->i_effnlink--;
+		ip->i_flag |= IN_CHANGE;
 		if (DOINGSOFTDEP(dvp)) {
 			softdep_setup_unlink(dp, ip);
 		} else {
@@ -1291,6 +1292,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir)
 	 * necessary.
 	 */
 	oip->i_effnlink--;
+	oip->i_flag |= IN_CHANGE;
 	if (DOINGSOFTDEP(vdp)) {
 		softdep_setup_unlink(dp, oip);
 	} else {


More information about the svn-src-head mailing list