Date: Mon, 7 Oct 2019 08:28:06 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353180 - stable/12/sys/contrib/rdma/krping Message-ID: <201910070828.x978S6pM048059@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Mon Oct 7 08:28:05 2019 New Revision: 353180 URL: https://svnweb.freebsd.org/changeset/base/353180 Log: MFC r352954: Notify all sleeping threads of device removal in krping. Implement d_purge for krping_cdevsw. Submitted by: slavash@ Sponsored by: Mellanox Technologies Modified: stable/12/sys/contrib/rdma/krping/krping.c stable/12/sys/contrib/rdma/krping/krping.h stable/12/sys/contrib/rdma/krping/krping_dev.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/contrib/rdma/krping/krping.c ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping.c Mon Oct 7 08:25:25 2019 (r353179) +++ stable/12/sys/contrib/rdma/krping/krping.c Mon Oct 7 08:28:05 2019 (r353180) @@ -2189,3 +2189,17 @@ krping_walk_cb_list(void (*f)(struct krping_stats *, v (*f)(cb->pd ? &cb->stats : NULL, arg); mutex_unlock(&krping_mutex); } + +void +krping_cancel_all(void) +{ + struct krping_cb *cb; + + mutex_lock(&krping_mutex); + list_for_each_entry(cb, &krping_cbs, list) { + cb->state = ERROR; + wake_up_interruptible(&cb->sem); + } + mutex_unlock(&krping_mutex); +} + Modified: stable/12/sys/contrib/rdma/krping/krping.h ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping.h Mon Oct 7 08:25:25 2019 (r353179) +++ stable/12/sys/contrib/rdma/krping/krping.h Mon Oct 7 08:28:05 2019 (r353180) @@ -17,3 +17,4 @@ struct krping_stats { int krping_doit(char *); void krping_walk_cb_list(void (*)(struct krping_stats *, void *), void *); int krping_sigpending(void); +void krping_cancel_all(void); Modified: stable/12/sys/contrib/rdma/krping/krping_dev.c ============================================================================== --- stable/12/sys/contrib/rdma/krping/krping_dev.c Mon Oct 7 08:25:25 2019 (r353179) +++ stable/12/sys/contrib/rdma/krping/krping_dev.c Mon Oct 7 08:28:05 2019 (r353180) @@ -40,6 +40,7 @@ static d_open_t krping_open; static d_close_t krping_close; static d_read_t krping_read; static d_write_t krping_write; +static d_purge_t krping_purge; /* Character device entry points */ static struct cdevsw krping_cdevsw = { @@ -48,6 +49,7 @@ static struct cdevsw krping_cdevsw = { .d_close = krping_close, .d_read = krping_read, .d_write = krping_write, + .d_purge = krping_purge, .d_name = "krping", }; @@ -208,6 +210,13 @@ krping_write(struct cdev *dev, struct uio *uio, int io done: free(krpingmsg, M_DEVBUF); return(err); +} + +static void +krping_purge(struct cdev *dev __unused) +{ + + krping_cancel_all(); } int
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201910070828.x978S6pM048059>