RDMA/rtrs-srv: Use sysfs_remove_file_self for disconnect

[ Upstream commit f991fdac813f1598a9bb17b602ce04812ba9148c ]

Remove self first to avoid deadlock, we don't want to
use close_work to remove sess sysfs.

Fixes: 91b11610af ("RDMA/rtrs: server: sysfs interface functions")
Link: https://lore.kernel.org/r/20201217141915.56989-5-jinpu.wang@cloud.ionos.com
Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com>
Tested-by: Lutz Pogrell <lutz.pogrell@cloud.ionos.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
Jack Wang 2020-12-17 15:19:00 +01:00 committed by Greg Kroah-Hartman
parent e3d74840c7
commit f8f1833d2a

View File

@ -53,6 +53,8 @@ static ssize_t rtrs_srv_disconnect_store(struct kobject *kobj,
sockaddr_to_str((struct sockaddr *)&sess->s.dst_addr, str, sizeof(str));
rtrs_info(s, "disconnect for path %s requested\n", str);
/* first remove sysfs itself to avoid deadlock */
sysfs_remove_file_self(&sess->kobj, &attr->attr);
close_sess(sess);
return count;