]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: userland clients are only allowed to read if fscrypt is enabled
authorXiubo Li <xiubli@redhat.com>
Fri, 26 Nov 2021 02:23:25 +0000 (10:23 +0800)
committerXiubo Li <xiubli@redhat.com>
Thu, 13 Jan 2022 14:01:54 +0000 (22:01 +0800)
For now the userland clients hasn't support the fscrypt yet, they
will be only allowed to read the encrypted files.

Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/client/Client.cc

index 38881a8fb899281b939ac0f057608f76e62d95c7..857ae774c4af6a58b6106179c317886055dff4f8 100644 (file)
@@ -3498,8 +3498,10 @@ int Client::get_caps(Fh *fh, int need, int want, int *phave, loff_t endoff)
       waitfor_caps = true;
     }
 
-    if ((need & CEPH_CAP_FILE_WR) && in->auth_cap &&
-       in->auth_cap->session->readonly)
+    if ((need & CEPH_CAP_FILE_WR) &&
+       ((in->auth_cap && in->auth_cap->session->readonly) ||
+        // userland clients are only allowed to read if fscrypt enabled
+        in->is_fscrypt_enabled()))
       return -CEPHFS_EROFS;
 
     if (in->flags & I_CAP_DROPPED) {