]> granicus.if.org Git - zfs/commit
Race condition between spa async threads and export
authorSerapheim Dimitropoulos <serapheim@delphix.com>
Thu, 18 Jul 2019 20:02:33 +0000 (13:02 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 18 Jul 2019 20:02:33 +0000 (13:02 -0700)
commit43a8536260e76dab4a615164f9e6d6397c6b7778
treeb5a8ab080464448090b92fc3b1eb1b86ce092366
parent1c44a5c97fabc669885df84c3e9b6b5e16f0cd35
Race condition between spa async threads and export

In the past we've seen multiple race conditions that have
to do with open-context threads async threads and concurrent
calls to spa_export()/spa_destroy() (including the one
referenced in issue #9015).

This patch ensures that only one thread can execute the
main body of spa_export_common() at a time, with subsequent
threads returning with a new error code created just for
this situation, eliminating this way any race condition
bugs introduced by concurrent calls to this function.

Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Serapheim Dimitropoulos <serapheim@delphix.com>
Closes #9015
Closes #9044
cmd/ztest/ztest.c
include/libzfs.h
include/sys/fs/zfs.h
include/sys/spa_impl.h
lib/libzfs/libzfs_util.c
module/zfs/spa.c