From: Venkatesh Srinivas Date: Mon, 2 Apr 2012 17:02:25 +0000 (-0700) Subject: kernel -- FFS: Take softdep lock in softdep_disk_io_initiation. X-Git-Tag: v3.4.0rc~1147^2 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/24624a1562837ae797e4c1b05689f6f5b56006d9 kernel -- FFS: Take softdep lock in softdep_disk_io_initiation. softdep_disk_io_initiation was using the mplock rather than the softdep lock to protect the softdep work queue and items on it. Take the softdep lock and allow it to be taken recursively, so that io_start bioops can call into other parts of softdep. Prevents softdep completion callback from racing softdep_disk_io_initiation, remaining panics of 2291. Eventually the MPLOCK in the bio_ops callback can go away, but that will require more testing. Closes-bug: 2291 --- diff --git a/sys/vfs/ufs/ffs_softdep.c b/sys/vfs/ufs/ffs_softdep.c index eda63fdde5..5995eaa2a2 100644 --- a/sys/vfs/ufs/ffs_softdep.c +++ b/sys/vfs/ufs/ffs_softdep.c @@ -1030,7 +1030,7 @@ softdep_initialize(void) M_INODEDEP->ks_limit / (2 * sizeof(struct inodedep))); pagedep_hashtbl = hashinit(desiredvnodes / 5, M_PAGEDEP, &pagedep_hash); - lockinit(&lk, "ffs_softdep", 0, 0); + lockinit(&lk, "ffs_softdep", 0, LK_CANRECURSE); sema_init(&pagedep_in_progress, "pagedep", 0, 0); inodedep_hashtbl = hashinit(desiredvnodes, M_INODEDEP, &inodedep_hash); sema_init(&inodedep_in_progress, "inodedep", 0, 0); @@ -3024,6 +3024,7 @@ softdep_disk_io_initiation(struct buf *bp) panic("softdep_disk_io_initiation: read"); get_mplock(); + ACQUIRE_LOCK(&lk); marker.wk_type = D_LAST + 1; /* Not a normal workitem */ /* @@ -3086,6 +3087,7 @@ softdep_disk_io_initiation(struct buf *bp) /* NOTREACHED */ } } + FREE_LOCK(&lk); rel_mplock(); }