scst: Port to Linux kernel v7.0

Support for the following changes in the Linux kernel v7.0:

  - e3b2cf6e5dba ("kernfs: pass struct ns_common instead of
    const void * for namespace tags")
This commit is contained in:
Gleb Chesnokov
2026-04-12 13:17:55 +03:00
parent 8a3b257c33
commit 9003543f45
2 changed files with 24 additions and 0 deletions

View File

@@ -171,7 +171,11 @@ out_unlock:
int __init event_init(void)
{
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0)
iscsi_net_ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
#else
iscsi_net_ns = to_net_ns(kobj_ns_grab_current(KOBJ_NS_TYPE_NET));
#endif
{
struct netlink_kernel_cfg cfg = {
@@ -188,7 +192,11 @@ int __init event_init(void)
drop_ns:
PRINT_ERROR("%s", "netlink_kernel_create() failed");
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0)
kobj_ns_drop(KOBJ_NS_TYPE_NET, iscsi_net_ns);
#else
kobj_ns_drop(KOBJ_NS_TYPE_NET, to_ns_common(iscsi_net_ns));
#endif
iscsi_net_ns = NULL;
return -ENOMEM;
}
@@ -196,6 +204,10 @@ drop_ns:
void event_exit(void)
{
netlink_kernel_release(nl);
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0)
kobj_ns_drop(KOBJ_NS_TYPE_NET, iscsi_net_ns);
#else
kobj_ns_drop(KOBJ_NS_TYPE_NET, to_ns_common(iscsi_net_ns));
#endif
iscsi_net_ns = NULL;
}

View File

@@ -4579,7 +4579,11 @@ static int __init srpt_init_module(void)
goto destroy_wq;
}
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0)
srpt_net_ns = kobj_ns_grab_current(KOBJ_NS_TYPE_NET);
#else
srpt_net_ns = to_net_ns(kobj_ns_grab_current(KOBJ_NS_TYPE_NET));
#endif
if (rdma_cm_port) {
struct sockaddr_in addr;
@@ -4623,7 +4627,11 @@ destroy_id:
rdma_destroy_id(rdma_cm_id);
drop_ns:
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0)
kobj_ns_drop(KOBJ_NS_TYPE_NET, srpt_net_ns);
#else
kobj_ns_drop(KOBJ_NS_TYPE_NET, to_ns_common(srpt_net_ns));
#endif
srpt_net_ns = NULL;
ib_unregister_client(&srpt_client);
@@ -4642,7 +4650,11 @@ static void __exit srpt_cleanup_module(void)
if (rdma_cm_id)
rdma_destroy_id(rdma_cm_id);
#if LINUX_VERSION_CODE < KERNEL_VERSION(7, 0, 0)
kobj_ns_drop(KOBJ_NS_TYPE_NET, srpt_net_ns);
#else
kobj_ns_drop(KOBJ_NS_TYPE_NET, to_ns_common(srpt_net_ns));
#endif
srpt_net_ns = NULL;
ib_unregister_client(&srpt_client);