Project

General

Profile

Bug #48700

client: Client::rmdir() may fail to remove a snapshot

Added by Venky Shankar 5 months ago. Updated 4 months ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Correctness/Safety
Target version:
% Done:

0%

Source:
Community (dev)
Tags:
Backport:
pacific,octopus,nautilus
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
Client
Labels (FS):
Pull request ID:
Crash signature (v1):
Crash signature (v2):

Description

Call to Client::may_delete() from Client::rmdir() is done here https://github.com/ceph/ceph/blob/master/src/client/Client.cc#L7104

  if (cct->_conf->client_permissions) {
    int r = may_delete(dir.get(), name.c_str(), perms);
    if (r < 0)
      return r;
  }

However, Client::may_delete() expects `name` param as NULL/nullptr for snapshot context: https://github.com/ceph/ceph/blob/eea9a41e7d3339d2a6763268e5eae816c9225a37/src/client/Client.cc#L5719

  /* 'name == NULL' means rmsnap */
  if (perms.uid() != 0 && name && (dir->mode & S_ISVTX)) {
    InodeRef otherin;
    r = _lookup(dir, name, CEPH_CAP_AUTH_SHARED, &otherin, perms);
    if (r < 0)
      goto out;
    if (dir->uid != perms.uid() && otherin->uid != perms.uid())
      r = -EPERM;
  }

Failures here: https://pulpito.ceph.com/vshankar-2020-12-22_07:06:25-fs-wip-snap-rm-fail-distro-basic-smithi/5729878/

The above branch contains changes to remove snapshots in libcephfs tests.

2020-12-22T07:33:02.295 INFO:tasks.workunit.client.0.smithi073.stdout:[ RUN      ] LibCephFS.SnapXattrs
2020-12-22T07:33:02.330 INFO:tasks.workunit.client.0.smithi073.stdout:/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos8/DIST/centos8/MACHINE_SIZE/gigantic/release/16.0.0-8517-g5b0c7133/rpm/el8/BUILD/ceph-16.0.0-8517-g5b0c7133/src/test/libcephfs/test.cc:2276: Failure
2020-12-22T07:33:02.330 INFO:tasks.workunit.client.0.smithi073.stdout:Expected equality of these values:
2020-12-22T07:33:02.330 INFO:tasks.workunit.client.0.smithi073.stdout:  0
2020-12-22T07:33:02.331 INFO:tasks.workunit.client.0.smithi073.stdout:  ceph_rmdir(cmount, c_snap)
2020-12-22T07:33:02.331 INFO:tasks.workunit.client.0.smithi073.stdout:    Which is: -1
2020-12-22T07:33:02.331 INFO:tasks.workunit.client.0.smithi073.stdout:[  FAILED  ] LibCephFS.SnapXattrs (35 ms)
2020-12-22T07:33:02.331 INFO:tasks.workunit.client.0.smithi073.stdout:[ RUN      ] LibCephFS.SnapQuota
2020-12-22T07:33:02.384 INFO:tasks.workunit.client.0.smithi073.stdout:/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos8/DIST/centos8/MACHINE_SIZE/gigantic/release/16.0.0-8517-g5b0c7133/rpm/el8/BUILD/ceph-16.0.0-8517-g5b0c7133/src/test/libcephfs/test.cc:2390: Failure
2020-12-22T07:33:02.385 INFO:tasks.workunit.client.0.smithi073.stdout:Expected equality of these values:
2020-12-22T07:33:02.385 INFO:tasks.workunit.client.0.smithi073.stdout:  0
2020-12-22T07:33:02.385 INFO:tasks.workunit.client.0.smithi073.stdout:  ceph_rmdir(cmount, c_snap)
2020-12-22T07:33:02.386 INFO:tasks.workunit.client.0.smithi073.stdout:    Which is: -1
2020-12-22T07:33:02.386 INFO:tasks.workunit.client.0.smithi073.stdout:[  FAILED  ] LibCephFS.SnapQuota (55 ms)
2020-12-22T07:33:02.386 INFO:tasks.workunit.client.0.smithi073.stdout:[ RUN      ] LibCephFS.Lseek
2020-12-22T07:33:02.486 INFO:tasks.workunit.client.0.smithi073.stdout:[       OK ] LibCephFS.Lseek (102 ms)
2020-12-22T07:33:02.487 INFO:tasks.workunit.client.0.smithi073.stdout:[ RUN      ] LibCephFS.TestSnapCreateAndDelete
2020-12-22T07:33:02.514 INFO:tasks.workunit.client.0.smithi073.stdout:/home/jenkins-build/build/workspace/ceph-dev-new-build/ARCH/x86_64/AVAILABLE_ARCH/x86_64/AVAILABLE_DIST/centos8/DIST/centos8/MACHINE_SIZE/gigantic/release/16.0.0-8517-g5b0c7133/rpm/el8/BUILD/ceph-16.0.0-8517-g5b0c7133/src/test/libcephfs/test.cc:2443: Failure
2020-12-22T07:33:02.514 INFO:tasks.workunit.client.0.smithi073.stdout:Expected equality of these values:
2020-12-22T07:33:02.514 INFO:tasks.workunit.client.0.smithi073.stdout:  0
2020-12-22T07:33:02.515 INFO:tasks.workunit.client.0.smithi073.stdout:  ceph_rmdir(cmount, c_path)
2020-12-22T07:33:02.515 INFO:tasks.workunit.client.0.smithi073.stdout:    Which is: -1
2020-12-22T07:33:02.515 INFO:tasks.workunit.client.0.smithi073.stdout:[  FAILED  ] LibCephFS.TestSnapCreateAndDelete (27 ms)

(NOTE: `TestSnapCreateAndDelete` was added as an extra test in the branch)

History

#1 Updated by Patrick Donnelly 4 months ago

  • Target version changed from v16.0.0 to v17.0.0
  • Backport changed from octopus to pacific,octopus,nautilus

#2 Updated by Venky Shankar 4 months ago

  • Status changed from In Progress to Closed

This is not really a bug and was related to sticky bit on the root directory in a teuthology test. The fix has been merged as part of test fix (commit f6ddc690980aaafb4f89c89614f0b23de2e0e858)

#3 Updated by Venky Shankar 4 months ago

Venky Shankar wrote:

This is not really a bug and was related to sticky bit on the root directory in a teuthology test. The workaround fix has been merged as part of test fix (commit f6ddc690980aaafb4f89c89614f0b23de2e0e858)

Also available in: Atom PDF