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
F86175159: D22306.diff
Sun, Jun 16, 1:30 PM
Unknown Object (File)
Tue, Jun 4, 10:14 AM
Unknown Object (File)
Tue, Jun 4, 3:35 AM
Unknown Object (File)
Mon, Jun 3, 2:04 AM
Unknown Object (File)
Wed, May 29, 8:30 PM
Unknown Object (File)
Mon, May 27, 12:42 PM
Unknown Object (File)
Sat, May 25, 12:40 AM
Unknown Object (File)
Thu, May 23, 8:34 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

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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

cddl/contrib/opensolaris/cmd/zfs/zfs.8
3005 ↗(On Diff #64149)

s/receiving snapshot/receiving a snapshot/

cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
4165 ↗(On Diff #64149)

This is debug output, right? ;)

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
3831 ↗(On Diff #64149)

Another debug output here and below?

pjd added inline comments.
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897 ↗(On Diff #64511)

flags->forceunmount?

3846 ↗(On Diff #64511)

I think mflags is never used.

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897 ↗(On Diff #64511)

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

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
2897 ↗(On Diff #64511)

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