Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 6 Dec 2018 01:04:57 +0000 (UTC)
From:      Kirk McKusick <mckusick@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r341611 - head/sys/ufs/ffs
Message-ID:  <201812060104.wB614vKv042090@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201812060104.wB614vKv042090>