HomeFreeBSD

MFV r302640: 6874 rollback and receive need to reset ZPL state to what's on disk

Description

MFV r302640: 6874 rollback and receive need to reset ZPL state to what's on disk

illumos/illumos-gate@1fdcbd00c9cbac286b5f92e08877e8cb3c448420
https://github.com/illumos/illumos-gate/commit/1fdcbd00c9cbac286b5f92e08877e8cb3c448420

https://www.illumos.org/issues/6874

When we do a clone swap (caused by "zfs rollback" or "zfs receive"), the ZPL
doesn't completely reload the state from the DMU; some values remain cached in
the zfsvfs_t.
steps to reproduce:
```
#!/bin/bash -x
zfs destroy -R test/fs
zfs destroy -R test/recvd
zfs create test/fs
zfs snapshot test/fs@a
zfs set userquota@$USER=1m test/fs
zfs snapshot test/fs@b
zfs send test/fs@a | zfs recv test/recvd
zfs send -i @a test/fs@b | zfs recv test/recvd
zfs userspace test/recvd
   1. should show 1m quota
      dd if=/dev/urandom of=/test/recvd/file bs=1k count=1024
      sync
      dd if=/dev/urandom of=/test/recvd/file2 bs=1k count=1024
   2. should fail with ENOSPC
      sync
      zfs unmount test/recvd
      zfs mount test/recvd
      zfs userspace test/recvd
   3. if bug above, now shows 1m quota
      dd if=/dev/urandom of=/test/recvd/file3 bs=1k count=1024
   4. if bug above, now fails with ENOSPC
```

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Matthew Ahrens <mahrens@delphix.com>
MFC after: 3 weeks

Details

Provenance
avgAuthored on
Reviewer
matthew
Parents
rS302835: remove a stray change from r302834
Branches
Unknown
Tags
Unknown