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)
Tue, Mar 26, 1:42 PM
Unknown Object (File)
Thu, Mar 14, 1:01 PM
Unknown Object (File)
Thu, Mar 14, 1:01 PM
Unknown Object (File)
Thu, Mar 14, 1:01 PM
Unknown Object (File)
Feb 14 2024, 11:26 PM
Unknown Object (File)
Dec 23 2023, 6:36 AM
Unknown Object (File)
Dec 20 2023, 1:50 AM
Unknown Object (File)
Dec 16 2023, 11:59 AM
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 27633
Build 25840: 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?

3845

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