Project

General

Profile

Actions

Tasks #64163

closed

Tasks #63293: Implement fscrypt in libcephfs and cephfs-fuse

Client::link() cannot use nullopt for enc case

Added by Christopher Hoffman about 2 years ago. Updated about 1 year ago.

Status:
Resolved
Priority:
Normal
Category:
-
Target version:
-
% Done:

0%

Reviewed:
Affected Versions:
Component(FS):
Labels (FS):
Pull request ID:
Tags (freeform):
Merge Commit:
Fixed In:
Released In:
Upkeep Timestamp:


Related issues 1 (0 open1 closed)

Related to CephFS - Bug #68963: ceph_test_libcephfs_fscrypt tests failResolvedChristopher Hoffman

Actions
Actions #1

Updated by Patrick Donnelly about 2 years ago

  • Assignee set to Christopher Hoffman
Actions #2

Updated by Christopher Hoffman about 1 year ago

  • Subject changed from Client::link() cannot use nullopt for Inode to Client::link() cannot use nullopt for enc case
  • Description updated (diff)
  • Status changed from New to In Progress
Actions #3

Updated by Christopher Hoffman about 1 year ago

  • Related to Bug #68963: ceph_test_libcephfs_fscrypt tests fail added
Actions #4

Updated by Christopher Hoffman about 1 year ago

commit 027f91745a6a9a4680d1dbea4645c795a6735fce (HEAD -> wip-fscrypt)
Author: Christopher Hoffman <choffman@redhat.com>
Date:   Mon Jan 27 17:33:25 2025 +0000

    client: Use enc_name when linking fscrypt enabled inode

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

diff --git a/src/client/Client.cc b/src/client/Client.cc
index d59c876d347..0d1784a8783 100644
--- a/src/client/Client.cc
+++ b/src/client/Client.cc
@@ -1249,8 +1249,19 @@ Dentry *Client::insert_dentry_inode(Dir *dir, const string& dname, LeaseStat *dl
     }
     Inode *diri = dir->parent_inode;
     clear_dir_complete_and_ordered(diri, false);
-#warning revisit nullopt here
-    dn = link(dir, dname, std::nullopt, in, dn);
+
+    auto fscrypt_denc = fscrypt->get_fname_denc(diri->fscrypt_ctx, &diri->fscrypt_key_validator, true);
+    if (fscrypt_denc) {
+      string _enc_name;
+      string _alt_name;
+      int r = fscrypt_denc->get_encrypted_fname(dname, &_enc_name, &_alt_name);
+      if (r < 0) {
+        ldout(cct, 0) << __FILE__ << ":" << __LINE__ << ": failed to encrypt filename" << dendl;
+      }
+      dn = link(dir, dname, _enc_name, in, dn);
+    } else {
+      dn = link(dir, dname, std::nullopt, in, dn);
+    }
Actions #5

Updated by Christopher Hoffman about 1 year ago

  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF