svn commit: r341611 - head/sys/ufs/ffs

Kirk McKusick mckusick at FreeBSD.org
Thu Dec 6 01:04:57 UTC 2018


Author: mckusick
Date: Thu Dec  6 01:04:56 2018
New Revision: 341611
URL: https://svnweb.freebsd.org/changeset/base/341611

Log:
  If the vfs.ffs.dotrimcons sysctl option is enabled while a file
  deletion is active, specifically after a call to ffs_blkrelease_start()
  but before the call to ffs_blkrelease_finish(), ffs_blkrelease_start()
  will have handed out SINGLETON_KEY rather than starting a collection
  sequence. Thus if we get a SINGLETON_KEY passed to ffs_blkrelease_finish(),
  we just return rather than trying to finish the nonexistent sequence.
  
  Reported by:  Warner Losh (imp@)
  Sponsored by: Netflix

Modified:
  head/sys/ufs/ffs/ffs_alloc.c

Modified: head/sys/ufs/ffs/ffs_alloc.c
==============================================================================
--- head/sys/ufs/ffs/ffs_alloc.c	Thu Dec  6 00:13:51 2018	(r341610)
+++ head/sys/ufs/ffs/ffs_alloc.c	Thu Dec  6 01:04:56 2018	(r341611)
@@ -2537,6 +2537,23 @@ ffs_blkrelease_finish(ump, key)
 	if (((ump->um_flags & UM_CANDELETE) == 0) || dotrimcons == 0)
 		return;
 	/*
+	 * If the vfs.ffs.dotrimcons sysctl option is enabled while
+	 * a file deletion is active, specifically after a call
+	 * to ffs_blkrelease_start() but before the call to
+	 * ffs_blkrelease_finish(), ffs_blkrelease_start() will
+	 * have handed out SINGLETON_KEY rather than starting a
+	 * collection sequence. Thus if we get a SINGLETON_KEY
+	 * passed to ffs_blkrelease_finish(), we just return rather
+	 * than trying to finish the nonexistent sequence.
+	 */
+	if (key == SINGLETON_KEY) {
+#ifdef INVARIANTS
+		printf("%s: vfs.ffs.dotrimcons enabled on active filesystem\n",
+		    ump->um_mountp->mnt_stat.f_mntonname);
+#endif
+		return;
+	}
+	/*
 	 * We are done with sending blocks using this key. Look up the key
 	 * using the DONE alloctype (in tp) to request that it be unhashed
 	 * as we will not be adding to it. If the key has never been used,


More information about the svn-src-all mailing list