tcmu: wait for nl reply only if there are listeners
Subsystems (2)
PATCH 1/1 tcmu: wait for nl reply only if there are listeners
genlmsg_multicast_allns used to return -ESRCH even if the message was successfully sent to a listener. With commit:
commit cb9f7a9a5c96a773bbc9c70660dc600cfff82f82
Author: Nicolas Dichtel <[email protected]> Date: Tue Feb 6 14:48:32 2018 +0100
netlink: ensure to loop over all netns in genlmsg_multicast_allns()
it now will return success if the message was sent to a listener. With that patch, tcmu can now immediately fail if -ESRCH is returned because we know there will be no reply.
--- drivers/target/target_core_user.c | 3 --- 1 file changed, 3 deletions(-)
drivers/target/target_core_user.c +0 -3
@@ -1794,9 +1794,6 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev, ret =genlmsg_multicast_allns (&tcmu_genl_family, skb,0 ,TCMU_MCGRP_CONFIG ,GFP_KERNEL ); -/* We don't care if no one is listening */ -if (ret = -ESRCH ) - ret =0 ;if (!ret) ret =tcmu_wait_genl_cmd_reply (udev);return ret;
Signature · 1 line
1.8.3.1
Martin, I am self nacking this patch for now.
Quoted 34 lines · Mike Christie
genlmsg_multicast_allnsused to return-ESRCHeven if the message was successfully sent to a listener. With commit:commit
cb9f7a9a5c96a773bbc9c70660dc600cfff82f82Author: Nicolas Dichtel <[email protected]> Date: Tue Feb 6 14:48:32 2018 +0100netlink: ensure to loop over all netns in
genlmsg_multicast_allns()it now will return success if the message was sent to a listener. With that patch, tcmu can now immediately fail if
-ESRCHis returned because we know there will be no reply.Signed-off-by Mike Christie <[email protected]>--- drivers/target/target_core_user.c | 3 --- 1 file changed, 3 deletions(-)drivers/target/target_core_user.c +0
-3@@ -1794,9 +1794,6 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev, ret =genlmsg_multicast_allns (&tcmu_genl_family, skb,0 ,TCMU_MCGRP_CONFIG ,GFP_KERNEL ); -/* We don't care if no one is listening */ -if (ret = -ESRCH ) - ret =0 ;if (!ret) ret =tcmu_wait_genl_cmd_reply (udev);return ret;
PATCH 1/1 tcmu: wait for nl reply only if there are listeners or during an add
In reply to Mike Christiegenlmsg_multicast_allns now returns the correct statuses when a message is sent to a listener. However in the case of adding a device we want to wait for the listener otherwise we may miss the the device during startup.
--- drivers/target/target_core_user.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/target/target_core_user.c +6 -5
@@ -1794,11 +1794,12 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev, ret =genlmsg_multicast_allns (&tcmu_genl_family, skb,0 ,TCMU_MCGRP_CONFIG ,GFP_KERNEL ); -/* We don't care if no one is listening */ -if (ret = -ESRCH ) - ret =0 ; -if (!ret) - ret =tcmu_wait_genl_cmd_reply (udev); + +/* Wait during an add as the listener may not be up yet */ +if (ret =0 || + (ret = -ESRCH && cmd =TCMU_CMD_ADDED_DEVICE )) +return tcmu_wait_genl_cmd_reply (udev); +return ret; }
Signature · 1 line
2.19.1
Re: [PATCH] tcmu: wait for nl reply only if there are listeners or during an add
In reply to Mike ChristieQuoted 21 lines · Cathy Avery
genlmsg_multicast_allnsnow returns the correct statuses when a message is sent to a listener. However in the case of adding a device we want to wait for the listener otherwise we may miss the the device during startup.Signed-off-by Cathy Avery <[email protected]>--- drivers/target/target_core_user.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)drivers/target/target_core_user.c +0
-3@@ -1794,11 +1794,12 @@ static int tcmu_netlink_event_send(struct tcmu_dev *udev, ret =genlmsg_multicast_allns (&tcmu_genl_family, skb,0 ,TCMU_MCGRP_CONFIG ,GFP_KERNEL ); -/* We don't care if no one is listening */ -if (ret = -ESRCH ) - ret =0 ;
drivers/target/target_core_user.c static int tcmu_netlink_event_send(struct tcmu_dev *udev, · line 1804
Quoted 10 lines
drivers/target/target_core_user.c +6
-2-if (!ret) - ret =tcmu_wait_genl_cmd_reply (udev); + +/* Wait during an add as the listener may not be up yet */ +if (ret =0 || + (ret = -ESRCH && cmd =TCMU_CMD_ADDED_DEVICE )) +return tcmu_wait_genl_cmd_reply (udev); +return ret; }
Looks ok to me.
Martin K. Petersen
AppliedRe: [PATCH] tcmu: wait for nl reply only if there are listeners or during an add
In reply to Mike ChristieCathy,
Quoted 4 lines
genlmsg_multicast_allnsnow returns the correct statuses when a message is sent to a listener. However in the case of adding a device we want to wait for the listener otherwise we may miss the the device during startup.
Applied to 5.1/scsi-queue, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering