Page MenuHomeFreeBSD

zfs: add option for forcible unmounting dataset while receiving snapshot.
ClosedPublic

Authored by oshogbo on Nov 10 2019, 11:52 AM.
Tags
None
Referenced Files
Unknown Object (File)
Wed, May 8, 12:13 PM
Unknown Object (File)
Wed, May 8, 12:13 PM
Unknown Object (File)
Mon, May 6, 12:25 AM
Unknown Object (File)
Sun, May 5, 1:31 PM
Unknown Object (File)
Mon, Apr 29, 7:57 PM
Unknown Object (File)
Mon, Apr 15, 4:14 AM
Unknown Object (File)
Apr 9 2024, 7:45 AM
Unknown Object (File)
Apr 8 2024, 9:15 PM
Subscribers

Details

Summary

zfs: add option for forcible unmounting dataset while receiving snapshot.

Currently when the dataset is in use we can't receive snapshot.
zfs send test/1@asd | zfs recv -FM test/2
cannot unmount '/test/2': Device busy

This commits add option 'M' which forcible unmounting the dataset.
Thanks to to that we can enforce receiving snapshot in single step.

Discussed with: pjd

If we think that this is a good idea I can submit pull request to
the OpenZFS as well.

Diff Detail

Lint
No Lint Coverage
Unit
No Test Coverage
Build Status
Buildable 27432
Build 25670: arc lint + arc unit

Event Timeline

Minor correction to the man page and (this is new to me) the code.

cddl/contrib/opensolaris/cmd/zfs/zfs.8
3005

s/receiving snapshot/receiving a snapshot/

cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
4165

This is debug output, right? ;)

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
3831

Another debug output here and below?

pjd added inline comments.
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897

flags->forceunmount?

3848

I think mflags is never used.

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897

is this meant to be flags->force or flags->forceunmount ?

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897

flags->forceunmount. Fixed.

Like Matt suggested I checked the behavior on Linux as well.

oshogbo@u-wing:/test$ sudo sudo zfs send test/1@b | sudo zfs recv -F test/2
umount: /test/2: target is busy.
cannot unmount '/test/2': umount failed
oshogbo@u-wing:/test$ uname -a
Linux u-wing 4.18.0-25-generic #26-Ubuntu SMP Mon Jun 24 09:32:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
oshogbo@u-wing:/test$

After closing file descriptor in test/2:

oshogbo@u-wing:/test$ sudo sudo zfs send test/1@b | sudo zfs recv -F test/2
oshogbo@u-wing:/test$
This revision is now accepted and ready to land.Jan 14 2020, 5:59 PM