vfs_gpfs: use linux oplock specific funcions only when available
authorBjoern Jacke <bj@sernet.de>
Fri, 14 Jan 2022 17:02:32 +0000 (17:02 +0000)
committerChristof Schmitt <cs@samba.org>
Wed, 16 Feb 2022 21:38:12 +0000 (21:38 +0000)
Signed-off-by: Bjoern Jacke <bj@sernet.de>
Reviewed-by: Christof Schmitt <cs@samba.org>
Autobuild-User(master): Christof Schmitt <cs@samba.org>
Autobuild-Date(master): Wed Feb 16 21:38:12 UTC 2022 on sn-devel-184

source3/modules/test_vfs_gpfs.c
source3/modules/vfs_gpfs.c

index 58f3c41934ad67dcb4addd4d8e34ae5a3369c395..b03a46a352d7417f85137bc15b666977057b76a4 100644 (file)
@@ -43,12 +43,14 @@ static void test_share_deny_mapping(void **state)
                         0); /* GPFS limitation, cannot deny only delete. */
 }
 
+#ifdef HAVE_KERNEL_OPLOCKS_LINUX
 static void test_gpfs_lease_mapping(void **state)
 {
        assert_int_equal(lease_type_to_gpfs(F_RDLCK), GPFS_LEASE_READ);
        assert_int_equal(lease_type_to_gpfs(F_WRLCK), GPFS_LEASE_WRITE);
        assert_int_equal(lease_type_to_gpfs(F_UNLCK), GPFS_LEASE_NONE);
 }
+#endif /* #ifdef HAVE_KERNEL_OPLOCKS_LINUX */
 
 static void test_gpfs_winattrs_to_dosmode(void **state)
 {
@@ -139,7 +141,9 @@ int main(int argc, char **argv)
 {
        const struct CMUnitTest tests[] = {
                cmocka_unit_test(test_share_deny_mapping),
+#ifdef HAVE_KERNEL_OPLOCKS_LINUX
                cmocka_unit_test(test_gpfs_lease_mapping),
+#endif /* #ifdef HAVE_KERNEL_OPLOCKS_LINUX */
                cmocka_unit_test(test_gpfs_winattrs_to_dosmode),
                cmocka_unit_test(test_dosmode_to_gpfs_winattrs),
                cmocka_unit_test(test_gpfs_get_file_id),
index 52517ee008414d944979b05c59227408d12163a0..e336f8aec5d8afda2cb798e190382f2afd7c4408 100644 (file)
@@ -220,6 +220,7 @@ static int vfs_gpfs_close(vfs_handle_struct *handle, files_struct *fsp)
        return SMB_VFS_NEXT_CLOSE(handle, fsp);
 }
 
+#ifdef HAVE_KERNEL_OPLOCKS_LINUX
 static int lease_type_to_gpfs(int leasetype)
 {
        if (leasetype == F_RDLCK) {
@@ -277,6 +278,16 @@ failure:
        return ret;
 }
 
+#else /* HAVE_KERNEL_OPLOCKS_LINUX */
+
+static int vfs_gpfs_setlease(vfs_handle_struct *handle,
+                               files_struct *fsp,
+                               int leasetype)
+{
+       return ENOSYS;
+}
+#endif /* HAVE_KERNEL_OPLOCKS_LINUX */
+
 static int vfs_gpfs_get_real_filename(struct vfs_handle_struct *handle,
                                      const struct smb_filename *path,
                                      const char *name,