sys/vfs/hammer: Temporary fix for kernel panic on volume-del
authorTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Sun, 20 Mar 2016 20:46:53 +0000 (05:46 +0900)
committerTomohiro Kusumi <kusumi.tomohiro@gmail.com>
Mon, 21 Mar 2016 18:46:55 +0000 (03:46 +0900)
This is a temporary fix for a known race issue mentioned in
http://lists.dragonflybsd.org/pipermail/kernel/2015-August/175027.html

It may be replaced with a better alternative in the future.

The next commit also needs this, otherwise it's not guaranteed
that ondisk buffers are written back to the backing storage.

sys/vfs/hammer/hammer_volume.c

index 7fba34f..ab2b342 100644 (file)
@@ -250,6 +250,18 @@ hammer_ioc_volume_del(hammer_transaction_t trans, hammer_inode_t ip,
        }
        hammer_rel_volume(volume, 0);
 
+       /*
+        * XXX: Temporary solution for
+        * http://lists.dragonflybsd.org/pipermail/kernel/2015-August/175027.html
+        */
+       hammer_unlock(&hmp->blkmap_lock);
+       hammer_sync_unlock(trans);
+       hammer_flusher_sync(hmp); /* 1 */
+       hammer_flusher_sync(hmp); /* 2 */
+       hammer_flusher_sync(hmp); /* 3 */
+       hammer_sync_lock_sh(trans);
+       hammer_lock_ex(&hmp->blkmap_lock);
+
        /*
         * Unload buffers
         */