Bug 14217 - vfs_ceph_snapshots can't resolve deleted paths
Summary: vfs_ceph_snapshots can't resolve deleted paths
Status: NEW
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules (show other bugs)
Version: 4.11.3
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: David Disseldorp
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-12-13 12:03 UTC by David Disseldorp
Modified: 2019-12-13 12:03 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Disseldorp 2019-12-13 12:03:45 UTC
Consider the following...

Base share contents (.snap is hidden by CephFS):
  /mnt/cephfs

Snapshot contents:
  /mnt/cephfs/.snap/mysnapshot/dir_created_b4_deleted_after

traffic:
  enum_snaps("/mnt/cephfs/") -> returns gmt_tok("/mnt/cephfs/.snap/mysnapshot/")

  twrp=gmt_tok("/mnt/cephfs/.snap/mysnapshot/")
  find(twrp, "/mnt/cephfs/") -> returns "dir_created_b4_deleted_after"
  create(twrp, "/mnt/cephfs/dir_created_b4_deleted_after") -> returns NOT_FOUND

This is because of the way vfs_ceph_snapshots resolves snapshot paths. Ceph propagates snapshots from parent directories to all children, and vfs_ceph_snapshots currently relies upon this to avoid walking up the directory tree looking for snapshots which match a given timewarp token. This logic breaks if any of the timewarped path components correspond to deleted directories, where in the example above, vfs_ceph_snapshots looks for the timewarp token via:

  readdir("/mnt/cephfs/dir_created_b4_deleted_after/.snap")

where instead is should be looking under "/mnt/cephfs/.snap".