]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: During lookup of fscrypt symlink, use target fscrypt info.
authorChristopher Hoffman <choffman@redhat.com>
Wed, 24 Apr 2024 17:38:44 +0000 (17:38 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Thu, 14 Aug 2025 20:08:08 +0000 (20:08 +0000)
During a lookup of fscrypt enabled symlink, use target fscrypt
info. This must be used because enc key for each file is derived
from master_key+nonce.

Fixes: https://tracker.ceph.com/issues/65615
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/client/Client.cc

index b30e91387762f38dfc76e5ff248d77e5aba68b52..195489b19a4b7c69f43c729c2b588be790e2a7bb 100644 (file)
@@ -7613,15 +7613,16 @@ int Client::_do_lookup(const InodeRef& dir, const string& name, int mask,
   r = make_request(req, perms, target);
   ldout(cct, 10) << __func__ << " res is " << r << dendl;
 
-  if (r == 0 && (*target)->is_symlink()) {
-    auto fscrypt_denc = fscrypt->get_fname_denc(dir->fscrypt_ctx, &dir->fscrypt_key_validator, true);
+  auto inode = *target;
+  if (r == 0 && inode->is_symlink()) {
+    auto fscrypt_denc = fscrypt->get_fname_denc(inode->fscrypt_ctx, &inode->fscrypt_key_validator, true);
     if (fscrypt_denc) {
       string slname;
-      int ret = fscrypt_denc->get_decrypted_symlink((*target)->symlink, &slname);
+      int ret = fscrypt_denc->get_decrypted_symlink(inode->symlink, &slname);
       if (ret < 0) {
         ldout(cct, 0) << __FILE__ << ":" << __LINE__ << ": failed to decrypt symlink (r=" << ret << ")" << dendl;
       }
-      (*target)->symlink_plain = slname;
+      inode->symlink_plain = slname;
     }
   }