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

Add support for zfs mount -R <filesystem> #16015

Merged
merged 1 commit into from
Apr 11, 2024

Conversation

usaleem-ix
Copy link
Contributor

@usaleem-ix usaleem-ix commented Mar 20, 2024

Motivation and Context

There can be scenarios where we want to mount all datasets under one hierarchy instead of mounting all datasets present on system with -a flag.

Description

This commit adds support for mounting a dataset along with all of it's children with -R flag for zfs mount.

-R flag should work on all root and non-root datasets. Usage information and man page has been updated for zfs mount. A test for verifying the behavior for -R flag is also added.

How Has This Been Tested?

Manual testing and added a test in ZTS.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv)
  • Documentation (a change to man pages or other documentation)

Checklist:

man/man8/zfs-mount.8 Outdated Show resolved Hide resolved
@amotin amotin added the Status: Code Review Needed Ready for review and testing label Mar 20, 2024
@tuffnatty
Copy link

As mount -r means somewhat different, the choice of -r can be confusing. What about -R?

@usaleem-ix usaleem-ix changed the title Add support for zfs mount -r <filesystem> Add support for zfs mount -R <filesystem> Apr 6, 2024
@usaleem-ix
Copy link
Contributor Author

As mount -r means somewhat different, the choice of -r can be confusing. What about -R?

Thanks. I have updated to use -R instead of -r.

@usaleem-ix
Copy link
Contributor Author

Rebased to latest master.

# STRATEGY:
# 1. Create nested datasets
# 2. Unmount all datasets
# 3. Recusrive mount root datasets, this should mount all datasets
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 3. Recusrive mount root datasets, this should mount all datasets
# 3. Recursively mount root datasets, this should mount all datasets

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, thanks.

This commit adds support for mounting a dataset along with all of
it's children with '-R' flag for zfs mount. There can be scenarios
where we want to mount all datasets under one hierarchy instead of
mounting all datasets present on system with '-a' flag.

'-R' flag should work on all root and non-root datasets. Usage
information and man page has been updated for zfs mount. A test
for verifying the behavior for '-R' flag is also added.

Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Apr 11, 2024
@behlendorf behlendorf merged commit a100a19 into openzfs:master Apr 11, 2024
25 checks passed
usaleem-ix added a commit to truenas/zfs that referenced this pull request Apr 15, 2024
This commit adds support for mounting a dataset along with all of
it's children with '-R' flag for zfs mount. There can be scenarios
where we want to mount all datasets under one hierarchy instead of
mounting all datasets present on system with '-a' flag.

'-R' flag should work on all root and non-root datasets. Usage
information and man page has been updated for zfs mount. A test
for verifying the behavior for '-R' flag is also added.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes openzfs#16015
usaleem-ix added a commit to truenas/zfs that referenced this pull request Apr 15, 2024
This commit adds support for mounting a dataset along with all of
it's children with '-R' flag for zfs mount. There can be scenarios
where we want to mount all datasets under one hierarchy instead of
mounting all datasets present on system with '-a' flag.

'-R' flag should work on all root and non-root datasets. Usage
information and man page has been updated for zfs mount. A test
for verifying the behavior for '-R' flag is also added.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes openzfs#16015
usaleem-ix added a commit to truenas/zfs that referenced this pull request Apr 15, 2024
This commit adds support for mounting a dataset along with all of
it's children with '-R' flag for zfs mount. There can be scenarios
where we want to mount all datasets under one hierarchy instead of
mounting all datasets present on system with '-a' flag.

'-R' flag should work on all root and non-root datasets. Usage
information and man page has been updated for zfs mount. A test
for verifying the behavior for '-R' flag is also added.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes openzfs#16015
@usaleem-ix usaleem-ix deleted the NAS-127702-1 branch April 15, 2024 09:38
usaleem-ix added a commit to truenas/zfs that referenced this pull request Apr 15, 2024
This commit adds support for mounting a dataset along with all of
it's children with '-R' flag for zfs mount. There can be scenarios
where we want to mount all datasets under one hierarchy instead of
mounting all datasets present on system with '-a' flag.

'-R' flag should work on all root and non-root datasets. Usage
information and man page has been updated for zfs mount. A test
for verifying the behavior for '-R' flag is also added.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes openzfs#16015
tonyhutter pushed a commit that referenced this pull request May 2, 2024
This commit adds support for mounting a dataset along with all of
it's children with '-R' flag for zfs mount. There can be scenarios
where we want to mount all datasets under one hierarchy instead of
mounting all datasets present on system with '-a' flag.

'-R' flag should work on all root and non-root datasets. Usage
information and man page has been updated for zfs mount. A test
for verifying the behavior for '-R' flag is also added.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes #16015
@mabra
Copy link

mabra commented May 30, 2024

At least with that I can read here, it left me in confusion.
What happens, if I have the follwoing strruncture:

pool/base
 pool/base/sub1  
 pool/base/sub1/subA		canmount=off  
pool/base/sub1/subA/subA1	canmount=on  
pool/base/sub1/subA/subA2	canmount=on  
pool/base/sub1/subB		canmount=on  
pool/base/sub1/subB/subB1	canmount=off  
pool/base/sub1/subB/subB2	canmount=on  

`
If I mount 'pool/base/sub1 -R' ??
Which mountstate does ...subA/subA1, ...subA/subA2
and ...subB/subB1 have then?
Writing "mounting a dataset along with ALL of it's children"
is unspecific and what about "noauto"???
Thanks!

@usaleem-ix
Copy link
Contributor Author

@mabra The behavior of canmount property does not change. If a dataset's canmount property is off, and it has children with canmount property set to on, the child datasets will be mounted if -R flag is used to mount the parent dataset (with canmount off) or any dataset that present upward in the hierarchy.

If canmount property is set to noauto, and any of the parents is mounted with -R flag, the dataset with canmount set to noauto will not be mounted. The behavior remain unchanged here as well.

To answer you question in given scenario, ...subA/subA1 and ...subA/subA2 will be mounted, while ...subA and ...subB/subB1 will not be mounted.

@mabra
Copy link

mabra commented Jun 6, 2024

@mabra The behavior of canmount property does not change. If a dataset's canmount property is off, and it has children with canmount property set to on, the child datasets will be mounted if -R flag is used to mount the parent dataset (with canmount off) or any dataset that present upward in the hierarchy.

If canmount property is set to noauto, and any of the parents is mounted with -R flag, the dataset with canmount set to noauto will not be mounted. The behavior remain unchanged here as well.

To answer you question in given scenario, ...subA/subA1 and ...subA/subA2 will be mounted, while ...subA and ...subB/subB1 will not be mounted.

Thank you very much!
Then, it is exactly what I wanted for a long time!

lundman pushed a commit to openzfsonwindows/openzfs that referenced this pull request Sep 4, 2024
This commit adds support for mounting a dataset along with all of
it's children with '-R' flag for zfs mount. There can be scenarios
where we want to mount all datasets under one hierarchy instead of
mounting all datasets present on system with '-a' flag.

'-R' flag should work on all root and non-root datasets. Usage
information and man page has been updated for zfs mount. A test
for verifying the behavior for '-R' flag is also added.

Reviewed-by: Ameer Hamza <ahamza@ixsystems.com>
Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Umer Saleem <usaleem@ixsystems.com>
Closes openzfs#16015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants