]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/log
ceph-ci.git
2 days agodebug make-dist wip-choffman-fscrypt
Christopher Hoffman [Tue, 23 Sep 2025 16:45:08 +0000 (16:45 +0000)]
debug make-dist

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
2 days agoclient: clean up warnings in fscrypt choffman-fscrypt-922
Christopher Hoffman [Tue, 23 Sep 2025 14:58:32 +0000 (14:58 +0000)]
client: clean up warnings in fscrypt

Fix warnings/errors in ceph API tests that are present in FSCrypt.cc

src/client/FSCrypt.cc:90:6: error: variable 'olen' set but not used [-Werror,-Wunused-but-set-variable]
   90 |         int olen = 0;
      |             ^
src/client/FSCrypt.cc:91:6: error: variable 'line' set but not used [-Werror,-Wunused-but-set-variable]
   91 |         int line = 0;
      |             ^
src/client/FSCrypt.cc:945:2: error: is this the way to do it? [-Werror,-W#warnings]
  945 | #warning is this the way to do it?

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
2 days agoqa: Add fscrypt dummy encryption to fs workloads
Christopher Hoffman [Wed, 17 Sep 2025 16:48:48 +0000 (16:48 +0000)]
qa: Add fscrypt dummy encryption to fs workloads

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
2 days agotest: Add test for fscrypt dummy encryption
Christopher Hoffman [Wed, 17 Sep 2025 15:47:44 +0000 (15:47 +0000)]
test: Add test for fscrypt dummy encryption

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 days agoclient: Add fscrypt dummy encryption
Christopher Hoffman [Tue, 2 Sep 2025 14:31:52 +0000 (14:31 +0000)]
client: Add fscrypt dummy encryption

Add fscrypt dummy encryption to client. This will allow
for mounting a cephfs volume without providing any fscrypt
information. This will allow for more straightforward setup
for development and test suites.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 days agotest: Clean up after fscrypt unit tests
Christopher Hoffman [Fri, 29 Aug 2025 14:29:24 +0000 (14:29 +0000)]
test: Clean up after fscrypt unit tests

After each fscrypt unit test clean up after each
unit test.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 days agolibcephfs: ll_set_fscrypt_policy_v2 - use in->dirstat
Marcus Watts [Sat, 28 Jun 2025 00:56:05 +0000 (20:56 -0400)]
libcephfs: ll_set_fscrypt_policy_v2 - use in->dirstat

Better check for empty direcotry.
It turns out in->dirstat contains a count of files and subdirectories
from a directory, so all we have to do is make sure that's valid.

Resolves: rhbz#2376757
Signed-off-by: Marcus Watts <mwatts@redhat.com>
(cherry picked from commit ba233f2dda3cf30c67b653b065e9ed47d42cb9d6)

5 days agoclient: ll_set_fscrypt_policy_v2 separate "directory empty" logic
Marcus Watts [Sat, 28 Jun 2025 00:56:05 +0000 (20:56 -0400)]
client: ll_set_fscrypt_policy_v2 separate "directory empty" logic

Move "directory empty" logic to new method "_is_empty_directory".
Future logic will not be a one-liner, so let's keep it separate.

Resolves: rhbz#2376757
Signed-off-by: Marcus Watts <mwatts@redhat.com>
(cherry picked from commit f0cf85a595876165e2c0eb2ca584e97f44971f9d)

5 days agotest/pybind/cephfs: add tests for fcopyfile()
Rishabh Dave [Mon, 21 Jul 2025 11:34:56 +0000 (17:04 +0530)]
test/pybind/cephfs: add tests for fcopyfile()

Signed-off-by: Rishabh Dave <ridave@redhat.com>
5 days agoclient: in fcopyfile(), update len to read only leftover fragment
Rishabh Dave [Wed, 16 Jul 2025 16:04:18 +0000 (21:34 +0530)]
client: in fcopyfile(), update len to read only leftover fragment

fcopyfile() reads 1 MiB of data every time but when a fragment smaller
than 1 MiB is left, it still reads 1 MiB of data, causing to never meet
the condition of "off == size". This leads to an infinity loop which
continues to write until CephFS becomes full.

Resolves: rhbz#2379716
Fixes: https://tracker.ceph.com/issues/72238
Signed-off-by: Rishabh Dave <ridave@redhat.com>
5 days agotest: Test unsupported fscrypt policy
Christopher Hoffman [Thu, 21 Aug 2025 19:24:48 +0000 (19:24 +0000)]
test: Test unsupported fscrypt policy

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 days agoclient: Check for supported fscrypt policy
Christopher Hoffman [Thu, 21 Aug 2025 19:23:44 +0000 (19:23 +0000)]
client: Check for supported fscrypt policy

When setting a policy on a directory, check to make sure
policy is supported.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 days agoqa/cephfs: Add test case for enctag too long
Christopher Hoffman [Wed, 20 Aug 2025 19:57:39 +0000 (19:57 +0000)]
qa/cephfs: Add test case for enctag too long

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 days agomgr/volumes: Enforce enctag max size
Christopher Hoffman [Wed, 20 Aug 2025 19:36:14 +0000 (19:36 +0000)]
mgr/volumes: Enforce enctag max size

Introduce enctag max length. Include error messages when
outside of range.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoqa: Add interop testing between fscrypt fuse and kclient
Christopher Hoffman [Thu, 19 Jun 2025 13:01:46 +0000 (13:01 +0000)]
qa: Add interop testing between fscrypt fuse and kclient

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: make FSCryptDecryptedInodes std::shared_ptr
Christopher Hoffman [Mon, 18 Aug 2025 19:39:07 +0000 (19:39 +0000)]
client: make FSCryptDecryptedInodes std::shared_ptr

To help eliminate memory leaks, use std::shared_ptr
for keeping track of FSCryptDecryptedInodes instances.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agolibcephfs: Include libcephfs.h def for ceph_get_fscrypt_key_status
Christopher Hoffman [Wed, 13 Aug 2025 15:45:37 +0000 (15:45 +0000)]
libcephfs: Include libcephfs.h def for ceph_get_fscrypt_key_status

The libcephfs api header definition for call ceph_get_fscrypt_key_status
was not defined. Define this api call in libcephfs.h.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agodoc/cephfs, qa/cephfs: Reword some documentation.
Christopher Hoffman [Wed, 13 Aug 2025 16:10:12 +0000 (16:10 +0000)]
doc/cephfs, qa/cephfs: Reword some documentation.

Reword some documentation for enctag and mount.py
function descriptions.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: During fscrypt write skip unneeded reads
Christopher Hoffman [Tue, 12 Aug 2025 13:14:57 +0000 (13:14 +0000)]
client: During fscrypt write skip unneeded reads

During an fscrypt write a read may be needed to ensure changed
portion of file is merged with an existing data block. No need
to read unnecessarily when writes line up to fscrypt block and
span a whole block or more.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoqa/tasks/vstart_runner.py: remove write_file from LocalRemote
Christopher Hoffman [Fri, 8 Aug 2025 13:36:37 +0000 (13:36 +0000)]
qa/tasks/vstart_runner.py: remove write_file from LocalRemote

Instead of defining write_file in vstart_runner.py, use write_file
included in remote.py. That way we do not have to maintain two
different versions.

Fixes: https://tracker.ceph.com/issues/72463
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Address misc comments
Christopher Hoffman [Wed, 30 Jul 2025 16:57:12 +0000 (16:57 +0000)]
client: Address misc comments

Removed ifdef for a failure we encountered during rebase against
case sensitive feature
-https://github.com/ceph/ceph/pull/61137#discussion_r2006324762w

Add debug dout when entering WriteEncMgr::read
-https://github.com/ceph/ceph/pull/61137#discussion_r2008140457

Remove FILE_RD mark_caps_dirty
-https://github.com/ceph/ceph/pull/61137#discussion_r2008192250

Add comment to various lines
-https://github.com/ceph/ceph/pull/61137#discussion_r2006301120
-https://github.com/ceph/ceph/pull/61137#discussion_r2006247613
-https://github.com/ceph/ceph/pull/61137#discussion_r2006251232

During write_success mark FILE_WR as dirty
-https://github.com/ceph/ceph/pull/61137#discussion_r2008210365

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: turn is_encrypted into helper
Christopher Hoffman [Wed, 30 Jul 2025 15:17:32 +0000 (15:17 +0000)]
client: turn is_encrypted into helper

Turn is_encrypted into helper functions. Add test to
validate is_encrypted.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: skip fscrypt decrypt_bl if data bl is empty.
Christopher Hoffman [Wed, 23 Jul 2025 19:11:31 +0000 (19:11 +0000)]
client: skip fscrypt decrypt_bl if data bl is empty.

Fixes: https://tracker.ceph.com/issues/72237
Fixes: https://tracker.ceph.com/issues/72192
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Match functionality of nonblocking_read_sync read_sync
Christopher Hoffman [Wed, 23 Jul 2025 19:08:08 +0000 (19:08 +0000)]
client: Match functionality of nonblocking_read_sync read_sync

If ENOENT is returned from OSDs, set r = 0 to match read_sync
functionality.

Fixes: https://tracker.ceph.com/issues/72143
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: During fscrypt rmw (write) use correct read type
Christopher Hoffman [Thu, 17 Jul 2025 19:40:59 +0000 (19:40 +0000)]
client: During fscrypt rmw (write) use correct read type

During fscrypt rmw use internal Client::_read to utilize
correct buffered or non buffered reads based on client wide
options. For example, if client_oc = false, use only
non-buffered reads in rmw.

Fixes: https://tracker.ceph.com/issues/72143
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: During fscrypt set policy check null dentries
Christopher Hoffman [Wed, 2 Jul 2025 13:50:25 +0000 (13:50 +0000)]
client: During fscrypt set policy check null dentries

During the dir empty check in set policy check null dentries.

Fixes: https://tracker.ceph.com/issues/71926
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: During fscrypt set policy bail if policy exists
Christopher Hoffman [Mon, 30 Jun 2025 19:25:13 +0000 (19:25 +0000)]
client: During fscrypt set policy bail if policy exists

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient, libcephfs: Expose fscrypt apis as low level
Christopher Hoffman [Wed, 25 Jun 2025 13:14:45 +0000 (13:14 +0000)]
client, libcephfs: Expose fscrypt apis as low level

Add low level versions of fscrypt apis to support
protocols such as NFS.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Breakout fscrypt get policy into method
Christopher Hoffman [Tue, 24 Jun 2025 19:09:07 +0000 (19:09 +0000)]
client: Breakout fscrypt get policy into method

Breakout fscrypt get policy into a method. Add
ceph_get_fscrypt_policy_v2 support.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Rework fscrypt set policy to match fscrypt specification
Christopher Hoffman [Tue, 24 Jun 2025 17:47:17 +0000 (17:47 +0000)]
client: Rework fscrypt set policy to match fscrypt specification

When an fscrypt policy is set to an existing fscrypt directory
it should only return EEXIST if policy being applied differs

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Fix logic in fscrypt hole optimization
Christopher Hoffman [Tue, 17 Jun 2025 16:44:08 +0000 (16:44 +0000)]
client: Fix logic in fscrypt hole optimization

In fscrypt decryption code path, ensure if a data block
is hit when there are holes present in adjacent blocks,
that we exit hole traversal and continue on to decrypt the block.

Fixes: https://tracker.ceph.com/issues/71602
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoAddress misc comments
Christopher Hoffman [Tue, 3 Jun 2025 15:13:16 +0000 (15:13 +0000)]
Address misc comments

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Cache client_fscrypt_as config value
Christopher Hoffman [Tue, 3 Jun 2025 18:12:30 +0000 (18:12 +0000)]
client: Cache client_fscrypt_as config value

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient, test: Remove FS_IOC_GETFLAGS and STATX_ATTR_ENCRYPTED
Christopher Hoffman [Mon, 2 Jun 2025 18:13:32 +0000 (18:13 +0000)]
client, test: Remove FS_IOC_GETFLAGS and STATX_ATTR_ENCRYPTED

Remove previous work done to support FSCrypt encrypted in
FS_IOC_GETFLAGS which changes the structure of statx ABI.
This is due to backward compatibility issues.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Skip fscrypt_last_block if in non-fscrypt mode
Christopher Hoffman [Wed, 28 May 2025 17:23:12 +0000 (17:23 +0000)]
client: Skip fscrypt_last_block if in non-fscrypt mode

Skip reading and sending fscrypt_last_block if client_fscrypt_as
is false during do_setattr. Without the key, fscrypt truncate is
not possible on fscrypt block boundary.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Implement cloning fscrypt subvolume snaps
Christopher Hoffman [Mon, 19 May 2025 18:56:20 +0000 (18:56 +0000)]
client: Implement cloning fscrypt subvolume snaps

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient, libcephfs: Add fcopyfile bindings
Christopher Hoffman [Fri, 16 May 2025 13:19:25 +0000 (13:19 +0000)]
client, libcephfs: Add fcopyfile bindings

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agopybind/mgr/volumes/fs: Prepare mgr to clone fscrypt snaps
Christopher Hoffman [Wed, 7 May 2025 14:45:45 +0000 (14:45 +0000)]
pybind/mgr/volumes/fs: Prepare mgr to clone fscrypt snaps

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoqa: Add tests for fscrypt subvolume
Christopher Hoffman [Mon, 12 May 2025 16:32:52 +0000 (16:32 +0000)]
qa: Add tests for fscrypt subvolume

Add various tests for fscrypt subvolumes such as
snapshots and verifying clones.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Allow for reading raw written data.
Christopher Hoffman [Thu, 8 May 2025 18:33:36 +0000 (18:33 +0000)]
client: Allow for reading raw written data.

When looking up the effective_size and the client_fscrypt_as
option is false show the inode size value. This will allow for
reading raw encrypted data when no key is provided.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agofuse client: map ENOKEY return value to itself
Igor Golikov [Tue, 6 May 2025 10:30:33 +0000 (10:30 +0000)]
fuse client: map ENOKEY return value to itself

Signed-off-by: Igor Golikov <igolikov@ibm.com>
5 weeks agoclient: do not fscrypt encrypt snapshot names
Christopher Hoffman [Tue, 6 May 2025 19:02:29 +0000 (19:02 +0000)]
client: do not fscrypt encrypt snapshot names

Snapshot names are visible within the .snap directory
as dir entries. They can be created by a client that
has an fscrypt key present and also by the manager who
does not have any key. While the client with the key
can create an encrypted name the manager cannot.
Standardize functionality of these semantics to the
common of the two.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Simplify getting decrypted fname
Christopher Hoffman [Wed, 23 Apr 2025 16:33:46 +0000 (16:33 +0000)]
client: Simplify getting decrypted fname

During unwrap name, get_decrypted_fname parameters accepts
dname/b64 name and altname. If altname holds a value, this means
that a plaintext name will be built from altname. In this
case, dname/b64 name is irrelevant. In the case of empty altname,
build name from b64 name.

Fixes: https://tracker.ceph.com/issues/70995
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Rework vxattr_cb_fscrypt_file_set to assign properly
Christopher Hoffman [Mon, 21 Apr 2025 12:28:16 +0000 (12:28 +0000)]
client: Rework vxattr_cb_fscrypt_file_set to assign properly

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: provide fscrypt vxattrs in CapSnap
Christopher Hoffman [Fri, 18 Apr 2025 20:55:02 +0000 (20:55 +0000)]
client: provide fscrypt vxattrs in CapSnap

Fixes: https://tracker.ceph.com/issues/70979
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Only run complete in read_modify_write if finish provided
Christopher Hoffman [Mon, 7 Apr 2025 18:39:20 +0000 (18:39 +0000)]
client: Only run complete in read_modify_write if finish provided

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: correctly account for Client::WriteEncMgr() ref counts
Venky Shankar [Mon, 7 Apr 2025 04:50:58 +0000 (04:50 +0000)]
client: correctly account for Client::WriteEncMgr() ref counts

Signed-off-by: Venky Shankar <vshankar@redhat.com>
5 weeks agoclient: remove unneeded goto jump
Venky Shankar [Mon, 7 Apr 2025 04:48:07 +0000 (04:48 +0000)]
client: remove unneeded goto jump

Signed-off-by: Venky Shankar <vshankar@redhat.com>
5 weeks agotest: clean up some warnings
Christopher Hoffman [Fri, 4 Apr 2025 17:51:42 +0000 (17:51 +0000)]
test: clean up some warnings

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoqa: Add fscrypt unit tests to workunits
Christopher Hoffman [Fri, 4 Apr 2025 13:11:06 +0000 (13:11 +0000)]
qa: Add fscrypt unit tests to workunits

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Add additional case for fscrypt enabled setattr
Christopher Hoffman [Fri, 28 Mar 2025 18:57:40 +0000 (18:57 +0000)]
client: Add additional case for fscrypt enabled setattr

During setattr in fscrypt case, there's two cases that happen
1. A logical size is provided and then a vector must be populated.
2. A request from setxattr is received and fscrypt_file vector
   is already set.

Also rework tests when setting fscrypt_file, to use logical sizes.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Check for dname max len before wrapping name
Christopher Hoffman [Fri, 28 Mar 2025 13:28:40 +0000 (13:28 +0000)]
client: Check for dname max len before wrapping name

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Add fscrypt enc support to C_Read_Sync_NonBlocking
Christopher Hoffman [Fri, 21 Mar 2025 16:00:16 +0000 (16:00 +0000)]
client: Add fscrypt enc support to C_Read_Sync_NonBlocking

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Address misc comments Mar 24
Christopher Hoffman [Mon, 24 Mar 2025 13:51:30 +0000 (13:51 +0000)]
client: Address misc comments Mar 24

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoFix Testclient bug
Christopher Hoffman [Mon, 24 Mar 2025 12:38:58 +0000 (12:38 +0000)]
Fix Testclient bug

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Add shared_mutex
Christopher Hoffman [Fri, 21 Mar 2025 14:44:36 +0000 (14:44 +0000)]
client: Add shared_mutex

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: When creating WriteEncMgr take into account client_oc
Christopher Hoffman [Wed, 19 Mar 2025 23:22:43 +0000 (23:22 +0000)]
client: When creating WriteEncMgr take into account client_oc

When determining if a write is buffered or not, take into account
the client_oc config. This option allows non-buffered writes when
caps normally used in buffered writes are present.

Fixes: https://tracker.ceph.com/issues/70568
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: Add client_fscrypt_as option
Christopher Hoffman [Wed, 12 Mar 2025 21:31:35 +0000 (21:31 +0000)]
client: Add client_fscrypt_as option

Add option to toggle enforcement of fscrypt access semantics.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
5 weeks agoclient: simplify some filepath constructions
Patrick Donnelly [Tue, 11 Mar 2025 14:49:19 +0000 (10:49 -0400)]
client: simplify some filepath constructions

And add notes where it could maybe be simplified further.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
5 weeks agoclient: print readable encrypted names
Patrick Donnelly [Tue, 11 Mar 2025 14:26:23 +0000 (10:26 -0400)]
client: print readable encrypted names

Replace non-printable characters with '.'.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
6 weeks agoclient: catch error opening snapdir inside snap
Patrick Donnelly [Tue, 11 Mar 2025 14:18:57 +0000 (10:18 -0400)]
client: catch error opening snapdir inside snap

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
6 weeks agoclient: do not wrap ceph special names
Patrick Donnelly [Tue, 11 Mar 2025 14:18:12 +0000 (10:18 -0400)]
client: do not wrap ceph special names

This avoids encrypting .snap which prevents Client::_lookup from opening the
snapdir.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
6 weeks agoclient: remove remaining fscrypt conflicts
Patrick Donnelly [Mon, 10 Mar 2025 15:08:50 +0000 (11:08 -0400)]
client: remove remaining fscrypt conflicts

There also seems to be some missing calls to

    gen_inherited_fscrypt_auth

?

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
6 weeks agoclient: use path walk and on-the-fly enc/dec for fscrypt
Patrick Donnelly [Fri, 7 Mar 2025 15:33:55 +0000 (10:33 -0500)]
client: use path walk and on-the-fly enc/dec for fscrypt

The code before would encrypt/decrypt the dentry and store the result as the
dentry name. This would cause the client to have a different view of the dentry
names compared to the MDS. This created an unnecessary and complex divergence
that requires fixing the name in any code path involving the MDS.

Instead, maintain the same view as before with the MDS. The client uses the new
`Client::path_walk`, `Client::_wrap_name`, and `Client::_unwrap_name`
mechanisms to correctly change from the application's namespace (unencrypted /
case insensitve names) to the Client/MDS namespace.

The complication here is that the Client now needs to recompute the
encrypted/decrypted name for any path walk. This can and should be mitigated by
memoizing the results of the decryption/encryption. This is particularly
important as we can keep the decrypted names in a separate memory region that
is protected from core dump / trace inspection.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
6 weeks agoclient: Use correct sizes in write_success
Christopher Hoffman [Thu, 27 Feb 2025 19:11:40 +0000 (19:11 +0000)]
client: Use correct sizes in write_success

Write success had some incorrect usage of sizes.
request_[size|offset] refers to logical size
toalwritten + offset refers to written to osd size

Fixes: https://tracker.ceph.com/issues/70193
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Use PATH_MAX for max size of fscrypt enabled symlinks
Christopher Hoffman [Wed, 26 Feb 2025 22:24:28 +0000 (22:24 +0000)]
client: Use PATH_MAX for max size of fscrypt enabled symlinks

Fixes: https://tracker.ceph.com/issues/70194
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agocephfs/test_volumes: Create tests for enctag
Christopher Hoffman [Tue, 25 Feb 2025 15:47:10 +0000 (15:47 +0000)]
cephfs/test_volumes: Create tests for enctag

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agodoc: Add documentation for enctag in subvolume
Christopher Hoffman [Tue, 25 Feb 2025 14:15:53 +0000 (14:15 +0000)]
doc: Add documentation for enctag in subvolume

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Add is_encrypted libcephfs api
Christopher Hoffman [Mon, 24 Feb 2025 20:29:14 +0000 (20:29 +0000)]
client: Add is_encrypted libcephfs api

Given a fd, will return if is encrypted or not.
Optionally, an enctag will be returned if set.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agomgr/volumes: Add enctag to subvol
Christopher Hoffman [Mon, 24 Feb 2025 16:08:12 +0000 (16:08 +0000)]
mgr/volumes: Add enctag to subvol

Add functionality to support enctag for subvols. This
will be useful for app or administrator to know which
master key to use.

Fixes: https://tracker.ceph.com/issues/69693
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Use new errno identifiers
Christopher Hoffman [Thu, 20 Feb 2025 14:55:32 +0000 (14:55 +0000)]
client: Use new errno identifiers

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: use fscrypt headers provided by linux
Christopher Hoffman [Wed, 12 Feb 2025 16:27:35 +0000 (16:27 +0000)]
client: use fscrypt headers provided by linux

Fixes: https://tracker.ceph.com/issues/68116
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Fix up a few things in read_sync path
Christopher Hoffman [Tue, 11 Feb 2025 16:05:29 +0000 (16:05 +0000)]
client: Fix up a few things in read_sync path

Fix up a few things in read_sync path
1. File size may not be updated locally, do not check for trim read
2. Do not get_cap before RMW, each do_write takes care of having proper caps

Fixes: https://tracker.ceph.com/issues/69796
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Calculate len before prepare_data_read
Christopher Hoffman [Tue, 4 Feb 2025 18:31:28 +0000 (18:31 +0000)]
client: Calculate len before prepare_data_read

Fixes: https://tracker.ceph.com/issues/69797
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: During fscrypt write, ensure we get Fr cap
Christopher Hoffman [Mon, 3 Feb 2025 19:13:31 +0000 (19:13 +0000)]
client: During fscrypt write, ensure we get Fr cap

During fscrypt write will require Fr cap. It's best to ensure
this requirement is handled at the cap level instead of at the mode
level. Otherwise, O_WRONLY flag won't be enforced.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agotest/libcephfs: Add skips to tests where mount root is a subdir
Christopher Hoffman [Fri, 31 Jan 2025 18:53:14 +0000 (18:53 +0000)]
test/libcephfs: Add skips to tests where mount root is a subdir

When dir_prefix is a subdir, skip tests that expect
behavior of "/" to be on root of filesystem.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Use enc_name when linking a fscrypt enabled inode
Christopher Hoffman [Mon, 27 Jan 2025 17:33:25 +0000 (17:33 +0000)]
client: Use enc_name when linking a fscrypt enabled inode

Fixes: https://tracker.ceph.com/issues/64163
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Do not encrypt '.' or '..'
Christopher Hoffman [Fri, 24 Jan 2025 14:28:11 +0000 (14:28 +0000)]
client: Do not encrypt '.' or '..'

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Use symlink_plain for decrypted fscrypt name
Christopher Hoffman [Thu, 23 Jan 2025 20:22:10 +0000 (20:22 +0000)]
client: Use symlink_plain for decrypted fscrypt name

Use symlink_plain for only the value of a decrypted fscrypt
dname.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: fscrypt last block
Christopher Hoffman [Thu, 16 Jan 2025 23:37:51 +0000 (23:37 +0000)]
client: fscrypt last block

Support two edge cases in fscrypt last block.

1. When fscrypt last block is not the first block
2. Make sure to clean up SaferCond, allowing for successive
   truncates utilizing lastblock.

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Do not decrypt bl on trim read
Christopher Hoffman [Wed, 8 Jan 2025 20:20:10 +0000 (20:20 +0000)]
client: Do not decrypt bl on trim read

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: set symlink dest to proper value
Christopher Hoffman [Wed, 8 Jan 2025 17:53:25 +0000 (17:53 +0000)]
client: set symlink dest to proper value

Fixes: https://tracker.ceph.com/issues/69442
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agotest: Add function policy populator for reuse in fscrypt tests.
Christopher Hoffman [Wed, 8 Jan 2025 17:05:48 +0000 (17:05 +0000)]
test: Add function policy populator for reuse in fscrypt tests.

Fixes: https://tracker.ceph.com/issues/69161
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: change conditional to check for is locked.
Christopher Hoffman [Wed, 8 Jan 2025 15:32:23 +0000 (15:32 +0000)]
client: change conditional to check for is locked.

Fixes: https://tracker.ceph.com/issues/64137
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agofuse client, fscrypt, test: Implement and create tests for S_ENCRYPTED in inode i_flags
Christopher Hoffman [Thu, 19 Dec 2024 15:33:24 +0000 (15:33 +0000)]
fuse client, fscrypt, test: Implement and create tests for S_ENCRYPTED in inode i_flags

This PR adds test for S_ENCRYPTED bit in the i_flags field of Inode.
The test implements 2 quering methods: using FS_IOC_GETFLAGS and STATX_ATTR_ENCRYPTED

Fixes: https://tracker.ceph.com/issues/64129
Author: Igor Golikov <igolikov@ibm.com>
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Use correct sizes on write_success
Christopher Hoffman [Wed, 18 Dec 2024 15:38:02 +0000 (15:38 +0000)]
client: Use correct sizes on write_success

Fixes: https://tracker.ceph.com/issues/69302
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: clear logical size on open(O_TRUNC)
Christopher Hoffman [Wed, 18 Dec 2024 15:03:15 +0000 (15:03 +0000)]
client: clear logical size on open(O_TRUNC)

Fixes: https://tracker.ceph.com/issues/65613
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agotest, client: implement tests for not supported FALLOC ops, use policy to determine...
Christopher Hoffman [Tue, 17 Dec 2024 16:09:20 +0000 (16:09 +0000)]
test, client: implement tests for not supported FALLOC ops, use policy to determine the padding size for encrypted filename

Adding test for not supported FALLOC ops on the encypted tree
Using policy to determine the padding length for encrypted file names and symlinks

Fixes: https://tracker.ceph.com/issues/64162
https://tracker.ceph.com/issues/64131
Author: Igor Golikov <igolikov@ibm.com>
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Add fscrypt last block
Christopher Hoffman [Mon, 9 Dec 2024 18:59:50 +0000 (18:59 +0000)]
client: Add fscrypt last block

Add logic to support fscrypt last block. Includes sending
truncated last block data (decrypted->trunc->encrypted)
from client to mds. The server then writes the last block
on successful truncate.

Fixes: https://tracker.ceph.com/issues/69160
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Ensure file_cache cap is released.
Christopher Hoffman [Fri, 8 Nov 2024 14:00:43 +0000 (14:00 +0000)]
client: Ensure file_cache cap is released.

Fixes: https://tracker.ceph.com/issues/68798
Fixes: https://tracker.ceph.com/issues/68831
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Various fixes to fix multi-fuse client
Christopher Hoffman [Tue, 22 Oct 2024 17:34:27 +0000 (17:34 +0000)]
client: Various fixes to fix multi-fuse client

Provide various fixes in which size used in
multi-fuse client tests.

Fixes: https://tracker.ceph.com/issues/68431
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoqa: Convert and create tests for libcephfs fscrypt
Christopher Hoffman [Tue, 8 Oct 2024 12:10:59 +0000 (12:10 +0000)]
qa: Convert and create tests for libcephfs fscrypt

Convert existing tests to use teuthology framework.
Create tests to test N>1 fscrypt clients

Fixes: https://tracker.ceph.com/issues/66577
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Update fscrypt_file when mds info is newer
Christopher Hoffman [Tue, 24 Sep 2024 15:13:01 +0000 (15:13 +0000)]
client: Update fscrypt_file when mds info is newer

Fixes: https://tracker.ceph.com/issues/68233
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoqa: Add tests of interopability of fscrypt between fuse/kernel
Christopher Hoffman [Tue, 24 Sep 2024 13:25:48 +0000 (13:25 +0000)]
qa: Add tests of interopability of fscrypt between fuse/kernel

Fixes: https://tracker.ceph.com/issues/66577
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoObjectCacher: handle nullptr hole case
Christopher Hoffman [Thu, 5 Sep 2024 17:36:45 +0000 (17:36 +0000)]
ObjectCacher: handle nullptr hole case

Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoObjectCacher: On RetryRead, ensure "hole" value is used
Christopher Hoffman [Wed, 28 Aug 2024 22:07:28 +0000 (22:07 +0000)]
ObjectCacher: On RetryRead, ensure "hole" value is used

On C_RetryRead, ensure "hole" value instead of pointer
to a pointer is used to allow populating vector of holes.

Fixes: https://tracker.ceph.com/issues/67659
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: When calling update_inode_file_size, provide correct size
Christopher Hoffman [Fri, 23 Aug 2024 19:19:31 +0000 (19:19 +0000)]
client: When calling update_inode_file_size, provide correct size

Fixes: https://tracker.ceph.com/issues/67559
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Use effective_size in eof read
Christopher Hoffman [Thu, 8 Aug 2024 19:50:39 +0000 (19:50 +0000)]
client: Use effective_size in eof read

Fixes: https://tracker.ceph.com/issues/67347
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient/FSCrypt: securely erase crypto key
Christopher Hoffman [Thu, 1 Aug 2024 14:12:15 +0000 (14:12 +0000)]
client/FSCrypt: securely erase crypto key

Fixes: https://tracker.ceph.com/issues/64136
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
6 weeks agoclient: Implement status for fscrypt key status
Christopher Hoffman [Fri, 19 Jul 2024 14:44:04 +0000 (14:44 +0000)]
client: Implement status for fscrypt key status

Fixes: https://tracker.ceph.com/issues/64130
Signed-off-by: Christopher Hoffman <choffman@redhat.com>