Project

General

Profile

Actions

Bug #58432

open

mgr/volumes: Idempotent `ceph fs subvolume create` changes file mode back to `755`

Added by Enrico Bocchi over 1 year ago. Updated over 1 year ago.

Status:
New
Priority:
High
Assignee:
-
Category:
-
Target version:
-
% Done:

0%

Source:
Tags:
Backport:
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

The `ceph fs subvolume create` command is expected to be idempotent but it changes the mode on existing subvolumes to `755` every time it is called.

This behavior was introduced with the GitHub PR https://github.com/ceph/ceph/pull/45290 (Ceph tracker https://tracker.ceph.com/issues/54375).
The PR adds 'mode' to the list of attributes passed to `subvolume.set_attrs`, for which the default value of `755` is set in https://github.com/ceph/ceph/blob/main/src/pybind/mgr/volumes/module.py#L612. As a result, `ceph fs subvolume create` always re-sets the mode to `755` even if the `--mode` parameter is not passed when calling the command.

We hit this bug on a cluster running Pacific v16.2.9 and seems to be still there in the `main` branch.

Steps to reproduce (the following commands are executed on a test cluster where the ceph filesystem root is mounted at `/cephfs`):
1. Create a new subvolume

$ ceph fs subvolume create cephfs mode_test
$ ceph fs subvolume getpath cephfs mode_test
/volumes/_nogroup/mode_test/56daabf4-e576-49a2-b81e-5224b5c8b09d

2. Permissions are set to `755` -- Expected

$ stat --format %a /cephfs/volumes/_nogroup/mode_test/56daabf4-e576-49a2-b81e-5224b5c8b09d
755

3. Manually change the permissions to `600` via local mount:

$ chmod 600 /cephfs/volumes/_nogroup/mode_test/56daabf4-e576-49a2-b81e-5224b5c8b09d
$ stat --format %a /cephfs/volumes/_nogroup/mode_test/56daabf4-e576-49a2-b81e-5224b5c8b09d
600
$ ceph fs subvolume info cephfs mode_test | jq .mode
16768 (to octal: 40600)

4. Create the same subvolume again -- Should be idempotent and not change mode

$ ceph fs subvolume create cephfs mode_test

5. Permissions are re-set to `755` -- NOT expected

$ stat --format %a /cephfs/volumes/_nogroup/mode_test/56daabf4-e576-49a2-b81e-5224b5c8b09d
755
$ ceph fs subvolume info cephfs mode_test | jq .mode
16877 (to octal: 40755)

Actions #1

Updated by Greg Farnum over 1 year ago

  • Priority changed from Normal to High
Actions

Also available in: Atom PDF