Index: src/sys/uvm/uvm_swap.c =================================================================== --- src/sys/uvm/uvm_swap.c 23 Aug 2021 13:08:18 -0000 1.206 +++ src/sys/uvm/uvm_swap.c 11 Jul 2022 17:05:56 -0000 @@ -1190,6 +1190,22 @@ again: */ /* + * swopen: allow the initial open from uvm_swap_init() and reject all others. + */ + +static int +swopen(dev_t dev, int flag, int mode, struct lwp *l) +{ + static bool inited = false; + + if (!inited) { + inited = true; + return 0; + } + return ENODEV; +} + +/* * swstrategy: perform I/O on the drum * * => we must map the i/o request from the drum to the correct swapdev. @@ -1308,8 +1324,8 @@ swwrite(dev_t dev, struct uio *uio, int } const struct bdevsw swap_bdevsw = { - .d_open = nullopen, - .d_close = nullclose, + .d_open = swopen, + .d_close = noclose, .d_strategy = swstrategy, .d_ioctl = noioctl, .d_dump = nodump,