Actions
Feature #6982
openzfs receive should allow receive properties to always be set
Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-05-18
Due date:
% Done:
0%
Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:
External Bug:
Description
When a zfs property is set, replicated, changed on the receiving dataset and sent back, the updated value is hidden by the original local value.
In the case where datasets are replicated for disaster recovery purposes if the DR copy is ever made live and zfs properties are updated the primary copy will not get the updated values when send via zfs send/receive.
zfs receive needs to be able to have an option to cause automatically do a 'zfs inherit -S' on any received properties.
This script demonstrates the programmatic problem of received properties hiding behind local properties:
#!/bin/bash -x pool="dozer" zfs create $pool/test1 # Set a standard property and a user property zfs set user:property="test1" $pool/test1 zfs set sharenfs="rw=@10.0.0.0/8" $pool/test1 zfs set user:property3="test1" $pool/test1 # Make a snapshot zfs snapshot $pool/test1@snap1 # Replicated to a new dataset zfs send -R $pool/test1@snap1 | zfs receive -F -v $pool/test2 # Show the properties on the replication zfs get sharenfs,user:property,user:property2,user:property3 $pool/test2 # Change the properties on the replicated copy zfs set user:property="test2" $pool/test2 zfs set user:property2="test2" $pool/test2 zfs set sharenfs="rw=@192.168.0.0/16" $pool/test2 # Make a new snapshot on the replication copy zfs snapshot $pool/test2@snap2 # Replicate back to the orginal dataset zfs send -R -I $pool/test2@snap1 $pool/test2@snap2 | zfs receive -F -v $pool/test1 # Show the properties on the original, notice the missing updates listed as local zfs get sharenfs,user:property,user:property2,user:property3 $pool/test1 # The properties sharenfs and user:property have no received values, only local zfs get -s received sharenfs,user:property,user:property2,user:property3 $pool/test1 # We can get them back by inheriting the received values. # However, this operation is risky because we cannot programtically tell if there are received values. zfs inherit -S sharenfs $pool/test1 zfs inherit -S user:property $pool/test1 zfs inherit -S user:property2 $pool/test1 zfs inherit -S user:property3 $pool/test1 zfs get sharenfs,user:property,user:property2,user:property3 $pool/test1 # On dataset test2 user:property2 was not received, but we don't always know this. # Running 'inherit' on it with -S makes it go away. zfs get sharenfs,user:property,user:property2,user:property3 $pool/test2 zfs inherit -S sharenfs $pool/test2 zfs inherit -S user:property $pool/test2 zfs inherit -S user:property2 $pool/test2 zfs inherit -S user:property3 $pool/test2 zfs get sharenfs,user:property,user:property2,user:property3 $pool/test2 echo "Press enter to destroy test datasets" read nothing zfs destroy -r $pool/test1 zfs destroy -r $pool/test2
No data to display
Actions