tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: wapbl + discard panic



   Date: Mon, 10 Aug 2015 21:31:07 -0700
   From: Jeff Rizzo <riz%tastylime.net@localhost>

   I'm guessing at the moment the answer is "don't do that," but it looks 
   like wapbl and discard aren't playing nice together:

   panic: kernel diagnostic assertion "rw_lock_held(&wl->wl_rwlock)" 

Try attached patch?
Index: sys/ufs/ffs/ffs_alloc.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ffs/ffs_alloc.c,v
retrieving revision 1.149
diff -p -u -r1.149 ffs_alloc.c
--- sys/ufs/ffs/ffs_alloc.c	28 Mar 2015 19:24:04 -0000	1.149
+++ sys/ufs/ffs/ffs_alloc.c	11 Aug 2015 04:55:37 -0000
@@ -1553,12 +1553,21 @@ struct discarddata {
 static void
 ffs_blkfree_td(struct fs *fs, struct discardopdata *td)
 {
+	struct mount *mp = spec_node_getmountedfs(td->devvp);
 	long todo;
+	int error;
 
 	while (td->size) {
 		todo = min(td->size,
 		  ffs_lfragtosize(fs, (fs->fs_frag - ffs_fragnum(fs, td->bno))));
+		error = UFS_WAPBL_BEGIN(mp);
+		if (error) {
+			printf("ffs: failed to begin wapbl transaction"
+			    " for discard: %d\n", error);
+			break;
+		}
 		ffs_blkfree_cg(fs, td->devvp, td->bno, todo);
+		UFS_WAPBL_END(mp);
 		td->bno += ffs_numfrags(fs, todo);
 		td->size -= todo;
 	}


Home | Main Index | Thread Index | Old Index