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
F138047014: D22306.id64511.diff
Fri, Nov 28, 11:47 AM
F138044121: D22306.diff
Fri, Nov 28, 11:19 AM
F138043142: D22306.diff
Fri, Nov 28, 11:09 AM
F137990286: D22306.id64148.diff
Thu, Nov 27, 10:47 PM
Unknown Object (File)
Thu, Nov 27, 3:07 AM
Unknown Object (File)
Mon, Nov 24, 7:07 AM
Unknown Object (File)
Sun, Nov 23, 10:53 PM
Unknown Object (File)
Fri, Nov 21, 10:41 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 27431
Build 25669: 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