]> git.apps.os.sepia.ceph.com Git - fscrypt.git/commitdiff
return EINVAL instead of ENOTTY to fix ceph support wip-ceph-fuse
authorIgor Golikov <igolikov@ibm.com>
Wed, 25 Dec 2024 12:40:34 +0000 (12:40 +0000)
committerIgor Golikov <igolikov@ibm.com>
Thu, 13 Feb 2025 15:26:56 +0000 (17:26 +0200)
Signed-off-by: Igor Golikov <igolikov@ibm.com>
metadata/policy.go

index 148df4ce69251dd327e3e138d7f5384f719f3409..6b6536b3874e97dfe750f842509ec24f5e6675f5 100644 (file)
@@ -128,6 +128,13 @@ func setPolicy(file *os.File, arg unsafe.Pointer) error {
                 log.Printf("FS_IOC_SET_ENCRYPTION_KEY_RESTRICTED");
                 _, _, errno = unix.Syscall(unix.SYS_IOCTL, file.Fd(), uintptr(C.fs_ioc_set_encryption_policy_restricted), uintptr(arg))
         }
+       // there is some code (e.g. CheckSupport) that calls this function with assumption that it will fail
+        // and return EINVAL.
+        // as a temp solution, we will return EINVAL if the restricted policy fails (and returns ENOTTY)
+        if errno == unix.ENOTTY {
+                log.Printf("returning EINVAL instead of ENOTTY")
+                return unix.EINVAL
+        }      
        if errno != 0 {
                return errno
        }