Message ID | 20230726144502.566785-4-ming.lei@redhat.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | ublk: fail to start/recover/del device if interrupted by signal | expand |
On Wed, Jul 26, 2023 at 10:45:02PM +0800, Ming Lei wrote: >If user interrupts wait_event_interruptible() in ublk_ctrl_del_dev(), >return -EINTR and let user know what happens. > >Fixes: 0abe39dec065 ("block: ublk: improve handling device deletion") >Reported-by: Stefano Garzarella <sgarzare@redhat.com> >Signed-off-by: Ming Lei <ming.lei@redhat.com> >--- > drivers/block/ublk_drv.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> > >diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c >index 9fcba3834e8d..21d2e71c5514 100644 >--- a/drivers/block/ublk_drv.c >+++ b/drivers/block/ublk_drv.c >@@ -2126,8 +2126,8 @@ static int ublk_ctrl_del_dev(struct ublk_device **p_ub) > * - the device number is freed already, we will not find this > * device via ublk_get_device_from_id() > */ >- wait_event_interruptible(ublk_idr_wq, ublk_idr_freed(idx)); >- >+ if (wait_event_interruptible(ublk_idr_wq, ublk_idr_freed(idx))) >+ return -EINTR; > return 0; > } > >-- >2.40.1 >
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 9fcba3834e8d..21d2e71c5514 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -2126,8 +2126,8 @@ static int ublk_ctrl_del_dev(struct ublk_device **p_ub) * - the device number is freed already, we will not find this * device via ublk_get_device_from_id() */ - wait_event_interruptible(ublk_idr_wq, ublk_idr_freed(idx)); - + if (wait_event_interruptible(ublk_idr_wq, ublk_idr_freed(idx))) + return -EINTR; return 0; }
If user interrupts wait_event_interruptible() in ublk_ctrl_del_dev(), return -EINTR and let user know what happens. Fixes: 0abe39dec065 ("block: ublk: improve handling device deletion") Reported-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> --- drivers/block/ublk_drv.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)