]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: Address misc comments Mar 24
authorChristopher Hoffman <choffman@redhat.com>
Mon, 24 Mar 2025 13:51:30 +0000 (13:51 +0000)
committerChristopher Hoffman <choffman@redhat.com>
Fri, 15 Aug 2025 16:03:30 +0000 (16:03 +0000)
Signed-off-by: Christopher Hoffman <choffman@redhat.com>
src/client/Client.cc
src/client/fuse_ll.cc

index 37f1c3bc0bc30e452e669eac28702692daad2b8b..5863a15484fc27d2d40e5b4ec2fa50eac9f39979 100644 (file)
@@ -7842,11 +7842,13 @@ int Client::path_walk(InodeRef dirinode, const filepath& origpath, walk_dentry_r
     /* Get extra requested caps on the last component */
     if (i == (path.depth() - 1)) {
       caps |= extra_options.mask;
+      #if 0
       if (diri->is_fscrypt_enabled()) {
         if (extra_options.mask & CEPH_FILE_MODE_WR) {
           caps |= CEPH_FILE_MODE_RD;
         }
       }
+      #endif
     }
 
     int r = _lookup(diri, dname, alternate_name, caps, &next, perms, extra_options.is_rename);
@@ -18169,7 +18171,7 @@ int Client::is_encrypted(int fd, UserPerm& perms, char* enctag)
       enctag = nullptr;
     }
 
-    return 0;
+    return 1;
   }
   enctag = nullptr;
   return -EINVAL;
@@ -18492,6 +18494,8 @@ mds_rank_t Client::_get_random_up_mds() const
 }
 
 int  Client::get_inode_flags(const Inode* in, int* file_attr_out) {
+  ceph_assert(ceph_mutex_is_locked_by_me(client_lock));
+
   if (!file_attr_out)
     return -EINVAL;
 
@@ -18506,6 +18510,8 @@ int  Client::get_inode_flags(const Inode* in, int* file_attr_out) {
 }
 
 int Client::get_inode_flags(int fd, int* file_attr_out) {
+  std::scoped_lock l{client_lock};
+
   Fh *fh = get_filehandle(fd);
   if (!fh) {
     return -EBADF;
index 9e77b9553f34aa4f56999917a63b278c83e85f8f..33d99f69feebe462a2035a7e38d5b40dd10d9088 100644 (file)
@@ -958,9 +958,7 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
     break;
     case FS_IOC_GET_ENCRYPTION_POLICY_EX_RESTRICTED:
     case FS_IOC_GET_ENCRYPTION_POLICY_EX: {
-      auto arg = (fscrypt_get_policy_ex_arg *)in_buf;
-
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": in_bufsz=" << in_bufsz << " out_bufsz=" << out_bufsz << " FS_IOC_GET_ENCRYPTION_POLICY_EX buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": in_bufsz=" << in_bufsz << " out_bufsz=" << out_bufsz << " FS_IOC_GET_ENCRYPTION_POLICY_EX buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
 
       struct fscrypt_get_policy_ex_arg out_arg;
       if (out_bufsz < sizeof(out_arg.policy)) {
@@ -992,17 +990,13 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
 
       auto arg = (fscrypt_add_key_arg *)in_buf;
 
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": in_bufsz=" << in_bufsz << " ioctl buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << dendl;
 
       if (arg->key_spec.type != FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER) {
         fuse_reply_err(req, ENOTSUP);
         break;
       }
 
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": key_spec.type=" << arg->key_spec.type << " key_spec buffer:\n" << fscrypt_hex_str(&arg->key_spec, sizeof(arg->key_spec)) << dendl;
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": raw_size=" << arg->raw_size << " key_id=" << arg->key_id << dendl;
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": raw:\n" << fscrypt_hex_str(arg->raw, arg->raw_size) << dendl;
-
       if (arg->key_id == 0 &&
           in_bufsz < sizeof(*arg) + arg->raw_size) {
         generic_dout(0) << __FILE__ << ":" << __LINE__ << ": in_bufsz=" << in_bufsz << " too short, expected=" << sizeof(*arg) + arg->raw_size << dendl;
@@ -1030,7 +1024,7 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
         break;
       }
 
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": FS_IOC_REMOVE_ENCRYPTION_KEY ioctl buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": FS_IOC_REMOVE_ENCRYPTION_KEY ioctl buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
 
       auto arg = (fscrypt_remove_key_arg *)in_buf;
       if (arg->key_spec.type != FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER) {
@@ -1056,14 +1050,14 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
     }
     case FS_IOC_SET_ENCRYPTION_POLICY:
     case FS_IOC_SET_ENCRYPTION_POLICY_RESTRICTED: {
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": FS_IOC_SET_ENCRYPTION_POLICY arg=" << (void *)_arg << " in_buf=" << (void *)in_buf << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": FS_IOC_SET_ENCRYPTION_POLICY arg=" << (void *)_arg << " in_buf=" << (void *)in_buf << dendl;
       if (!in_buf) {
         generic_dout(0) << __FILE__ << ":" << __LINE__ << ": ioctl buffer <none>" << dendl;
         fuse_reply_err(req, EINVAL);
         break;
       }
 
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": ioctl buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": ioctl buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
 
       auto arg = (fscrypt_policy_arg *)in_buf;
       if (in_bufsz < sizeof(arg->policy)) {
@@ -1085,7 +1079,7 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
 
       Fh *fh = (Fh*)fi->fh;
       Inode *in = fh->inode.get();
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": XXXX ioctl ino=" << in->ino << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": XXXX ioctl ino=" << in->ino << dendl;
 
       int r = cfuse->client->ll_set_fscrypt_policy_v2(in, policy);
       if (r < 0) {
@@ -1093,7 +1087,7 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
         break;
       }
 
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": set fscrypt policy: success" << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": set fscrypt policy: success" << dendl;
 
       fuse_reply_ioctl(req, 0, nullptr, 0);
       break;
@@ -1102,12 +1096,12 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
     case FS_IOC_GET_ENCRYPTION_KEY_STATUS: {
       if (!in_buf ||
         in_bufsz != sizeof(fscrypt_get_key_status_arg)) {
-        generic_dout(0) << __FILE__ << ":" << __LINE__ << ": ioctl buffer <none>" << dendl;
+        generic_dout(10) << __FILE__ << ":" << __LINE__ << ": ioctl buffer <none>" << dendl;
         fuse_reply_err(req, EINVAL);
         break;
       }
 
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": FS_IOC_GET_ENCRYPTION_KEY_STATUS ioctl buffer:\n" << fscrypt_hex_str(in_buf, in_bufsz) << dendl;
 
       auto arg = (fscrypt_get_key_status_arg *)in_buf;
       if (arg->key_spec.type != FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER) {
@@ -1116,12 +1110,15 @@ static void fuse_ll_ioctl(fuse_req_t req, fuse_ino_t ino,
       }
 
       int r = cfuse->client->get_fscrypt_key_status(arg);
+      if (r < 0) {
+        fuse_reply_err(req, get_sys_errno(-r));
+      }
 
       fuse_reply_ioctl(req, 0, arg, sizeof(*arg));
     }
     break;
     case FS_IOC_GETFLAGS: {
-      generic_dout(0) << __FILE__ << ":" << __LINE__ << ": FS_IOC_GETFLAGS ioctl" << dendl;
+      generic_dout(10) << __FILE__ << ":" << __LINE__ << ": FS_IOC_GETFLAGS ioctl" << dendl;
 
       int file_attr = 0;
       if (out_bufsz < sizeof(file_attr)) {
@@ -1474,7 +1471,7 @@ static void do_init(void *data, fuse_conn_info *conn)
   fuse_apply_conn_info_opts(cfuse->conn_opts, conn);
 #endif
 
-  generic_dout(0) << __FILE__ << ":" << __LINE__ << ": conn proto ver " << conn->proto_major << ":" << conn->proto_minor << dendl;
+  generic_dout(10) << __FILE__ << ":" << __LINE__ << ": conn proto ver " << conn->proto_major << ":" << conn->proto_minor << dendl;
 
   if(conn->capable & FUSE_CAP_SPLICE_MOVE)
     conn->want |= FUSE_CAP_SPLICE_MOVE;