Project

General

Profile

Feature #20971

Set new parent datasets to readonly after child datasets are created so child datasets get mount points during replication

Added by Philip Spigelmire over 4 years ago. Updated about 4 years ago.

Status:
Resolved
Priority:
Expected
Assignee:
William Grzybowski
Category:
Middleware
Target version:
Estimated time:
0.50 h
Severity:
New
Reason for Closing:
Reason for Blocked:
Needs QA:
Yes
Needs Doc:
Yes
Needs Merging:
Yes
Needs Automation:
No
Support Suite Ticket:
n/a
Hardware Configuration:

Description

When replicating a child dataset and the parent dataset does not exist on the receiving host, the parent dataset is created with the readonly property set. This prevents the creation of a mount point for the child dataset. This occurs when the parent dataset is not part of replication itself (since the mount point would be replicated on the parent in that case)

Steps to reproduce this:

Create parent dataset and child dataset on PUSH (I created tank/test and tank/test/subtest and placed a file in subtest called testfile)
Do not create parent dataset on PULL
Create a periodic snapshot on the child dataset
Create replication task on the child dataset
After replication, the child dataset will not be mounted on PULL
Error: failed: cannot mount '/mnt/tank/test/subtest': failed to create mountpoint

Build: FreeNAS-9.10.2-U1 (86c7ef5)

Solution:

Modify autorepl.py script to set the parent dataset readonly property to on after creating child datasets.

Diff for FreeNAS-9.10.2-U1 (86c7ef5) autoreply.py:

325c325
<     rzfscmd = "zfs create " 
---
>     rzfscmd = "zfs create -o readonly=on " 
331d330
<     setro = []
337,340d335
<             if ds == dir:
<                 #Store parent dataset so it can be set readonly after creation of any child datasets
<                 #This allows child datasets mount points to be created
<                 setro.append(dir)
351,365d345
<     # Set created parent datasets to readonly, child datasets will inherit
<     rzfscmd = "zfs set readonly=on " 
<     for ds in setro:
<
<         log.debug("Set readonly %s/%s" % (remotefs, ds))
<         sshproc = pipeopen('%s %s %s/%s' % (sshcmd, rzfscmd, remotefs, ds), quiet=True)
<         output, error = sshproc.communicate()
<         error = error.strip('\n').strip('\r').replace('WARNING: ENABLED NONE CIPHER', '')
<         # Debugging code
<         if sshproc.returncode:
<             log.debug("Unable to set remote dataset readonly %s/%s: %s" % (
<                 remotefs,
<                 ds,
<                 error
<             ))

History

#1 Updated by Bonnie Follweiler over 4 years ago

  • Assignee set to William Grzybowski

#2 Updated by Philip Spigelmire over 4 years ago

Didn't realize that the create runs even if the remote dataset exists. That could cause a remote dataset that was desired readonly=off to be changed to readonly=on. I modified the script to see if the create was successful and that is the dataset that gets set to readonly=on

Updated the diff below.

325c325
<     rzfscmd = "zfs create " 
---
>     rzfscmd = "zfs create -o readonly=on " 
331d330
<     setro = ''
347,364d345
<             else:
<                 #create was succesful, store dataset to set readonly property when done with creates
<                 if setro == '':
<                     setro = "%s/%s" % (remotefs, ds)
<
<     # Set created parent datasets to readonly, child datasets will inherit
<     if setro != '':
<         rzfscmd = "zfs set readonly=on " 
<         log.debug("Set readonly %s" % setro)
<         sshproc = pipeopen('%s %s %s' % (sshcmd, rzfscmd, setro), quiet=True)
<         output, error = sshproc.communicate()
<         error = error.strip('\n').strip('\r').replace('WARNING: ENABLED NONE CIPHER', '')
<         # Debugging code
<         if sshproc.returncode:
<             log.debug("Unable to set remote dataset readonly %s: %s" % (
<                 setro,
<                 error
<             ))

#3 Updated by William Grzybowski over 4 years ago

  • Status changed from Unscreened to Screened
  • Target version set to 9.10.3

#4 Updated by William Grzybowski over 4 years ago

  • Status changed from Screened to Resolved

fb0e658a1e921f3107d2e8bbd32fbd5669829d12

We are not going to set readonly for datasets that already exist since it should be a user action.

#5 Avatar?id=14398&size=24x24 Updated by Kris Moore over 4 years ago

  • Target version changed from 9.10.3 to 11.0

#8 Updated by Vaibhav Chauhan about 4 years ago

  • Target version changed from 11.0 to 11.0-RC

Also available in: Atom PDF