Skip to content

ceph: add support for snapshot names encryption

Luís Henriques ceph-devel lkml 5 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest5 patches 1 replyIn review
  2. v44 patches 2 repliesSuperseded
  3. v3 RFC4 patches 8 repliesSuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v2 RFC3 patches17 repliesSuperseded
v1 RFC2 patches10 repliesSuperseded

Changes in v5 from the cover letter

- Explicitly added the encoding base for kstrtou64() as we do know that the inode numbers are in decimal.

- New patch to prevent the creation of snapshots in encrypted directories that do not have the key loaded.

Patches in v5 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5ceph: add support for encrypted snapshot namesfs/ceph/inode.c+27 -40 replies
2/5ceph: add support for handling encrypted snapshot namesfs/ceph/crypto.c fs/ceph/crypto.h+170 -310 replies
3/5ceph: update documentation regarding snapshot naming limitationsDocumentation/filesystems/ceph.rst+10 -00 replies
4/5ceph: replace base64url by the encoding used for mailbox namesfs/ceph/crypto.c fs/ceph/crypto.h fs/ceph/dir.c +1 more+67 -40 replies
5/5ceph: prevent snapshots to be created in encrypted locked directoriesfs/ceph/dir.c+5 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v5 yet.

Read the v5 thread

Cover letter [PATCH v5 0/5] ceph: add support for snapshot names encryption

Hi!

And here's yet another revision. The main difference from v4 is the addition of a patch to prevent the creation of snapshots in directories that are encrypted but that are not unlocked (i.e. no key available).

As before, the following ceph PRs are required:

mds: add protection from clients without fscrypt support #45073
mds: use the whole string as the snapshot long name #45192
mds: support alternate names for snapshots #45224
mds: limit the snapshot names to 240 characters #45312

Changes since v4:

- Explicitly added the encoding base for kstrtou64() as we do know that the inode numbers are in decimal.

- New patch to prevent the creation of snapshots in encrypted directories that do not have the key loaded.

Changes since v3:

- Fixed WARN_ON() in ceph_encode_encrypted_dname()

- Updated documentation and copyright notice for the base64 encoding/decoding implementaiton which was taken from the fscrypt base.

Changes since v2:

- Use ceph_find_inode() instead of ceph_get_inode() for finding a snapshot parent in function parse_longname(). I've also added a fallback to ceph_get_inode() in case we fail to find the inode. This may happen if, for example, the mount root doesn't include that inode. The iput() was also complemented by a discard_new_inode() if the inode is in the I_NEW state. (patch 0002)

- Move the check for '_' snapshots further up in the ceph_fname_to_usr() and ceph_encode_encrypted_dname(). This fixes the case pointed out by Xiubo in v2. (patch 0002)

- Use NAME_MAX for tmp arrays (patch 0002)

- Added an extra patch for replacing the base64url encoding by a different encoding standard, the one used for IMAP mailboxes (which uses '+' and ',' instead of '-' and '_'). This should fix the issue with snapshot names starting with '_'. (patch 0003)

Changes since v1:

- Dropped the dentry->d_flags change in ceph_mkdir(). Thanks to Xiubo suggestion, patch 0001 now skips calling ceph_fscrypt_prepare_context() if we're handling a snapshot.

- Added error handling to ceph_get_snapdir() in patch 0001 (Jeff had already pointed that out but I forgot to include that change in previous revision).

- Rebased patch 0002 to the latest wip-fscrypt branch.

- Added some documentation regarding snapshots naming restrictions.

Luís Henriques (5):
ceph: add support for encrypted snapshot names
ceph: add support for handling encrypted snapshot names
ceph: update documentation regarding snapshot naming limitations
ceph: replace base64url by the encoding used for mailbox names
ceph: prevent snapshots to be created in encrypted locked directories

 Documentation/filesystems/ceph.rst |  10 ++
 fs/ceph/crypto.c                   | 252 +++++++++++++++++++++++++----
 fs/ceph/crypto.h                   |  14 +-
 fs/ceph/dir.c                      |   7 +-
 fs/ceph/inode.c                    |  33 +++-
 5 files changed, 278 insertions(+), 38 deletions(-)