Page MenuHomeFreeBSD

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

Authored by oshogbo on Nov 10 2019, 11:52 AM.

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 Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 27633
Build 25840: arc lint + arc unit

Event Timeline

oshogbo created this revision.Nov 10 2019, 11:52 AM
oshogbo updated this revision to Diff 64149.Nov 10 2019, 11:54 AM

Update description

oshogbo edited the summary of this revision. (Show Details)Nov 10 2019, 11:55 AM
oshogbo added reviewers: allanjude, delphij, mahrens.
oshogbo edited the summary of this revision. (Show Details)Nov 10 2019, 11:57 AM
bcr added a subscriber: bcr.Nov 11 2019, 8:47 PM

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?

oshogbo updated this revision to Diff 64511.Sun, Nov 17, 11:46 PM

Thx bcr@ !

pjd added a subscriber: pjd.Tue, Nov 19, 6:54 AM
pjd added inline comments.
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897

flags->forceunmount?

3845

I think mflags is never used.

oshogbo updated this revision to Diff 64567.Tue, Nov 19, 9:39 AM

Thank you @pjd.

allanjude added inline comments.Tue, Nov 19, 4:00 PM
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897

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

oshogbo added inline comments.Tue, Nov 19, 5:22 PM
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897

flags->forceunmount. Fixed.