Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please allow zfs receive -x mountpoint for volumes #11840

Closed
Bronek opened this issue Apr 4, 2021 · 10 comments
Closed

Please allow zfs receive -x mountpoint for volumes #11840

Bronek opened this issue Apr 4, 2021 · 10 comments
Labels
Type: Feature Feature request or new feature

Comments

@Bronek
Copy link

Bronek commented Apr 4, 2021

Describe the feature would like to see added to OpenZFS

Allow the -x parameter of the zfs receive to strip properties which are not applicable to the object being received, e.g. mountpoint for a volume. By definition, it's a no-op which would allow generic uses of zfs receive.

How will this feature improve OpenZFS?

Enable more generic use of zfs receive

Additional context

I have a bunch of scripts which, after careful validation of supplied parameters, enable ordinary users to perform certain ZFS sub-commands, within their respective filesystems. For example, to list objects, a user would do the following:

$ sudo zfs-list
NAME                  USED  AVAIL     REFER  MOUNTPOINT
zback/remote/gdansk    96K  11.8T       96K  /data/remote/gdansk
$ cat `which zfs-send`
#!/usr/bin/bash -e
exec zfs list -t filesystem,volume,snapshot -r zback/remote/"${SUDO_USER}"

(I removed the validation part, hopefully you get the idea)

The intended use case is to provide users with a zfs-receive which they can use like this:

zfs send -R zdata/my/data@a-snapshot | ssh myid@repository 'sudo zfs-receive data'

To that end I have created a zfs-receive script which looks something like this:

$ cat `which zfs-receive`
#!/usr/bin/bash -e
exec zfs receive -v -u zback/remote/"${SUDO_USER}"/"$1"

(again, omitted the validation part). In this script I would like to strip the mountpoint property of the received filesystem, using -x mountpoint. However this does not work if the user is sending a volume:

cannot receive new filesystem stream: property 'mountpoint' does not apply to datasets of this type

Since mountpoint does not apply to volume, this should be a no-op instead of an error.

@Bronek Bronek added the Type: Feature Feature request or new feature label Apr 4, 2021
@Bronek Bronek changed the title Please allow zfs send -x mountpoint for volumes Please allow zfs receive -x mountpoint for volumes Apr 4, 2021
@bghira
Copy link

bghira commented Apr 4, 2021

you can just set -o mountpoint on recv instead.

edit: missed that this is about zvol.. but i don't think this should happen, the checks are good to have.

my replication infrastructure handles this on its own, why can't yours?

@Bronek
Copy link
Author

Bronek commented Apr 4, 2021

my replication infrastructure handles this on its own, why can't yours?

not sure - how do you do that? In my case I have users who are trusted to a certain degree and this zfs-receive script works for them to store the data for backup purposes. However I would like to also allow them to access the filesystems they send, in which case I need to place restriction on mountpoints.

Come to think of it, I might provide an alternative script e.g. named zfs-receive-local doing:

exec zfs receive -v -x mountpoint zback/remote/"${SUDO_USER}"/"$1"

... and if that script fails (because they tried to send a volume) than no useful functionality is lost, they should have used the one with -u option anyway.

@InsanePrawn
Copy link
Contributor

I am very much in favour of treating -x mountpoint as nonfatal for volumes. FWIW this has been mentioned in #11416 and #6371.

We've hit the same thing in zrepl and considered an intrincate workaround, but I see no good reason why this shouldn't be allowed by zfs receive. Since volumes don't use the mountpoint anyway AND can't have child datasets, why shouldn't we just quietly handle the -x mountpoint?
I can see that handling -o mountpoint=/something would be worth a discussion, but with -x (inherit) the user's intention is to 'get rid' of the dataset's specific property value anyway;
how is this an illegal operation for a zvol? Or more importantly: how is it a dangerous one that we need to error out on?

@bghira
Copy link

bghira commented Apr 7, 2021

it's the same with recordsize or volblocksize. there's several properties that can't be manipulated without a hard error being returned to the caller.

@Bronek
Copy link
Author

Bronek commented Apr 7, 2021

Conceptually, -x does not manipulate a property; it blocks it from being set in a newly received dataset.

@bghira
Copy link

bghira commented Apr 7, 2021

however, it is technically running inherit.. which fails because it's not a supported operation for the volume type.

@bghira
Copy link

bghira commented Apr 7, 2021

for the record 6371 was only a problem because zfs send -R didn't work correctly when some datasets are 'missing' snapshots from the parent, but that has been resolved with #11710

"inelegant workarounds" are a problem with zrepl design, not with the command line arguments in ZFS utilities.

@IvanVolosyuk
Copy link

IvanVolosyuk commented Apr 8, 2021

I remember someone mentioned on the mailing list(?) that the zfs recv without -x mountpoint can be a security hazard for systems which deal with untrusted send streams (backup servers) and it will be much nicer if -x mountpoint can be specified regardless of the type of the stream (don't fail if that specified for zvol).

@InsanePrawn
Copy link
Contributor

Dear @bghira,

it's the same with recordsize or volblocksize. there's several properties that can't be manipulated without a hard error being returned to the caller.

you're arguing for keeping up an arbitrary limitation on grounds of this limitation existing. Please reevaluate your position.

Why are you spending time defending this anti-feature? What's it to you? What is it protecting anyone from? Who is profiting from your objections?

As it stands, I still see no good reason we can't just handle this in the receive code.
In fact, I've opened #11864, so you can voice your concerns there, if you have any factual ones.

@bghira
Copy link

bghira commented Apr 11, 2021

we should just remove all of the error conditions and let anything happen, then. what are they protecting anyone from?

InsanePrawn added a commit to InsanePrawn/zfs that referenced this issue Apr 15, 2021
Closes openzfs#11416
Closes openzfs#11840

Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
ghost pushed a commit to truenas/zfs that referenced this issue May 6, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 6, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 6, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 7, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 10, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 10, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 10, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
behlendorf pushed a commit to behlendorf/zfs that referenced this issue May 10, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 13, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
ghost pushed a commit to truenas/zfs that referenced this issue May 17, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
behlendorf pushed a commit that referenced this issue May 20, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes #11416
Closes #11840
Closes #11864
sempervictus pushed a commit to sempervictus/zfs that referenced this issue May 31, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes openzfs#11416
Closes openzfs#11840
Closes openzfs#11864
tonyhutter pushed a commit that referenced this issue Jun 23, 2021
Receiving datasets while blanket inheriting properties like zfs 
receive -x mountpoint can generally be desirable, e.g. to avoid 
unexpected mounts on backup hosts.

Currently this will fail to receive zvols due to the mountpoint 
property being applicable to filesystems only.  This limitation 
currently requires operators to special-case their minds and tools 
for zvols.

This change gets rid of this limitation for inherit (-x) by
Spiting up the dataset type handling: Warnings for inheriting (-x), 
errors for overriding (-o).

Reviewed-by: Paul Dagnelie <pcd@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: InsanePrawn <insane.prawny@gmail.com>
Closes #11416
Closes #11840
Closes #11864
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Feature Feature request or new feature
Projects
None yet
Development

No branches or pull requests

4 participants