Project

General

Profile

Actions

Bug #58645

open
AB JC

Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1

Bug #58645: Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1

Added by Alex Boonstra almost 4 years ago. Updated 6 months ago.

Status:
Fix Under Review
Priority:
Normal
Assignee:
Category:
Correctness/Safety
Target version:
Due date:
% Done:

0%

Source:
Community (user)
Backport:
tentacle,squid
Regression:
No
Severity:
3 - minor
Reviewed:
ceph-qa-suite:
Component(FS):
mgr/volumes
Labels (FS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:

Description

When an empty name is given while creating a subvolume, this will turn the subvolumegroup into a subvolume instead of giving a proper error or warning.

Example below uses a subvolumegroup argument for clarity (note that if omitted, the default "_nogroup" subbvolumegroup will be used).

ceph fs subvolumegroup create ceph-filesystem examplegroup
ceph fs subvolume create ceph-filesystem example1 --group_name examplegroup
ceph fs subvolume create ceph-filesystem "" --group_name examplegroup  # note the empty name
ceph fs subvolume create ceph-filesystem example2 --group_name examplegroup

This last command shows the following error:

Error EINVAL: invalid value specified for ceph.dir.subvolume

The error is correct, but not really helpful:
- the "invalid value specified" seems to be meant for the subvolumegroup, not the subvolume we try to create, which is confusing and misleading
- it is unclear which value is invalid, in this case a 1 needs to be a 0, but it requires thorough investigation to come to this conclusion

And to make it even more confusing; this extended attribute can't be read with getfattr, although it is used by Ceph:

# getfattr -n ceph.dir.subvolume /mnt/cephfs/volumes/examplegroup
/mnt/cephfs/volumes/examplegroup: ceph.dir.subvolume: No such attribute

Eventhough this extended attribute can't be read, it can be set with setfattr, to resolve the issue you need to change the "ceph.dir.subvolume" attribute on the filesystem to "0"

mount -t ceph 10.10.10.100:6789,10.10.10.101:6789,10.10.10.102:6789:/ /mnt/cephfs/ -o name=admin,secret=admin_secret
setfattr -n ceph.dir.subvolume -v 0 /mnt/cephfs/volumes/examplegroup

Tested on versions:
- quincy (17) shows error only as shown in example
- octopus (15) and pacific (16) show multiple stacktraces, result (unusable subbvolumegroup) is the same.

Stacktrace octopus|pacific:

Error EINVAL: Traceback (most recent call last):
  File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_base.py", line 271, in discover
    self.fs.stat(self.base_path)
  File "cephfs.pyx", line 1338, in cephfs.LibCephFS.stat
cephfs.ObjectNotFound: error in stat: /volumes/examplegroup/example2: No such file or directory [Errno 2]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/share/ceph/mgr/volumes/fs/volume.py", line 164, in create_subvolume
    with open_subvol(self.mgr, fs_handle, self.volspec, group, subvolname, SubvolumeOpType.CREATE) as subvolume:
  File "/usr/lib64/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/usr/share/ceph/mgr/volumes/fs/operations/subvolume.py", line 72, in open_subvol
    subvolume = loaded_subvolumes.get_subvolume_object(mgr, fs, vol_spec, group, subvolname)
  File "/usr/share/ceph/mgr/volumes/fs/operations/versions/__init__.py", line 95, in get_subvolume_object
    subvolume.discover()
  File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_base.py", line 283, in discover
    raise VolumeException(-errno.ENOENT, "subvolume '{0}' does not exist".format(self.subvolname))
volumes.fs.exception.VolumeException: -2 (subvolume 'example2' does not exist)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_v2.py", line 101, in mark_subvolume
        self.fs.setxattr(self.base_path, 'ceph.dir.subvolume', b'1', 0)
      File "cephfs.pyx", line 1264, in cephfs.LibCephFS.setxattr
    cephfs.InvalidValue: error in setxattr: Invalid argument [Errno 22]

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_v2.py", line 171, in create
        self.mark_subvolume()
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_v2.py", line 103, in mark_subvolume
        raise VolumeException(-errno.EINVAL, "invalid value specified for ceph.dir.subvolume")
    volumes.fs.exception.VolumeException: -22 (invalid value specified for ceph.dir.subvolume)

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/share/ceph/mgr/volumes/fs/operations/trash.py", line 99, in dump
        self.fs.rename(path, self.unique_trash_path)
      File "cephfs.pyx", line 1545, in cephfs.LibCephFS.rename
    cephfs.Error: error in rename /volumes/examplegroup/example2 to /volumes/_deleting/4dd2069d-7cf9-44fe-b1c9-1c3c8e80ae28: Invalid cross-device link [Errno 18]

    During handling of the above exception, another exception occurred:

    Traceback (most recent call last):
      File "/usr/share/ceph/mgr/mgr_module.py", line 1212, in _handle_command
        return self.handle_command(inbuf, cmd)
      File "/usr/share/ceph/mgr/volumes/module.py", line 466, in handle_command
        return handler(inbuf, cmd)
      File "/usr/share/ceph/mgr/volumes/module.py", line 34, in wrap
        return f(self, inbuf, cmd)
      File "/usr/share/ceph/mgr/volumes/module.py", line 520, in _cmd_fs_subvolume_create
        namespace_isolated=cmd.get('namespace_isolated', False))
      File "/usr/share/ceph/mgr/volumes/fs/volume.py", line 176, in create_subvolume
        self._create_subvolume(fs_handle, volname, group, subvolname, **kwargs)
      File "/usr/share/ceph/mgr/volumes/fs/volume.py", line 142, in _create_subvolume
        self.mgr, fs_handle, self.volspec, group, subvolname, size, isolate_nspace, pool, oct_mode, uid, gid)
      File "/usr/share/ceph/mgr/volumes/fs/operations/subvolume.py", line 26, in create_subvol
        subvolume.create(size, isolate_nspace, pool, mode, uid, gid)
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_v2.py", line 193, in create
        self._remove_on_failure(subvol_path, retained)
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_v2.py", line 151, in _remove_on_failure
        self.remove()
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_v2.py", line 346, in remove
        self.trash_base_dir()
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_base.py", line 301, in trash_base_dir
        self._trash_dir(self.base_path)
      File "/usr/share/ceph/mgr/volumes/fs/operations/versions/subvolume_base.py", line 289, in _trash_dir
        trashcan.dump(path)
      File "/usr/share/ceph/mgr/volumes/fs/operations/trash.py", line 101, in dump
        raise VolumeException(-e.args[0], e.args[1])
    TypeError: bad operand type for unary -: 'str'

Related issues 4 (2 open — 2 closed)

Has duplicate CephFS - Bug #68687: another ceph.dir.subvolume attribute bugDuplicateRishabh Dave

Actions
Copied to CephFS - Backport #71216: tentacle: Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1DeferredMahesh Mohan

Actions
Copied to CephFS - Backport #71217: reef: Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1RejectedMahesh Mohan

Actions
Copied to CephFS - Backport #71218: squid: Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1DeferredMahesh Mohan

Actions

VS Updated by Venky Shankar almost 4 years ago Actions #1

  • Status changed from New to Triaged
  • Assignee set to Milind Changire
  • Target version set to v18.0.0
  • Backport set to pacific,quincy
  • Component(FS) deleted (cephfs.pyx)

VS Updated by Venky Shankar almost 4 years ago Actions #2

  • Status changed from Triaged to Fix Under Review
  • Pull request ID set to 50028

PD Updated by Patrick Donnelly about 3 years ago Actions #3

  • Target version changed from v18.0.0 to v19.0.0
  • Backport changed from pacific,quincy to reef,quincy

MC Updated by Milind Changire about 3 years ago Actions #4

  • Pull request ID changed from 50028 to 53989

KS Updated by Konstantin Shalygin almost 2 years ago Actions #5

  • Backport changed from reef,quincy to reef

RD Updated by Rishabh Dave over 1 year ago Actions #6

  • Status changed from Fix Under Review to Pending Backport

RD Updated by Rishabh Dave over 1 year ago Actions #7

  • Backport changed from reef to tentacle,squid,reef

UB Updated by Upkeep Bot over 1 year ago Actions #8

  • Copied to Backport #71216: tentacle: Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1 added

UB Updated by Upkeep Bot over 1 year ago Actions #9

  • Copied to Backport #71217: reef: Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1 added

UB Updated by Upkeep Bot over 1 year ago Actions #10

  • Copied to Backport #71218: squid: Unclear error when creating new subvolume when subvolumegroup has ceph.dir.subvolume attribute set to 1 added

UB Updated by Upkeep Bot over 1 year ago Actions #11

  • Tags (freeform) set to backport_processed

KH Updated by Kotresh Hiremath Ravishankar over 1 year ago Actions #12

  • Status changed from Pending Backport to New
  • Pull request ID deleted (53989)

The original PR for this in main is reverted for this and needs rework.

- Original PR - https://github.com/ceph/ceph/pull/53989 (main)
- Reverted PR - https://github.com/ceph/ceph/pull/63281 (main)

Since the PR will be reworked, I am clearing the 'Pull request ID' from the tracker and moving the status to 'New'
The reworked PR id needs to be updated this tracker. This is done because the backport trackers were already created
and we can use the same once the new fix is available.

KH Updated by Kotresh Hiremath Ravishankar over 1 year ago Actions #13

When the new fix gets merged, please move the status to 'Pending Backport' and the backport tracker's status from "Deferred" to "New"

VS Updated by Venky Shankar 10 months ago Actions #14

  • Assignee changed from Milind Changire to Mahesh Mohan
  • Tags (freeform) changed from backport_processed to temp-assign

KS Updated by Konstantin Shalygin 8 months ago Actions #15

  • Backport changed from tentacle,squid,reef to tentacle,squid

MM Updated by Mahesh Mohan 6 months ago Actions #16

  • Assignee changed from Mahesh Mohan to Jos Collin

JC Updated by Jos Collin 6 months ago Actions #17

  • Status changed from New to In Progress

JC Updated by Jos Collin 6 months ago Actions #18

  • Pull request ID set to 69386

JC Updated by Jos Collin 6 months ago Actions #19

  • Tags (freeform) deleted (temp-assign)

JC Updated by Jos Collin 6 months ago Actions #20

  • Status changed from In Progress to Fix Under Review

JC Updated by Jos Collin 6 months ago Actions #21

Fixed by implementing strict input string validation at the ceph_argparse layer to intercept empty strings and sorted invalid characters, along with applying goodchars regex mapping to subvolume group creations. Added unit tests and teuthology integration validations.

VS Updated by Venky Shankar 3 months ago Actions #22

  • Has duplicate Bug #68687: another ceph.dir.subvolume attribute bug added
Actions

Also available in: PDF Atom