lkml.org 
[lkml]   [2015]   [Jul]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 3/3] xen-blkback: rm BUG_ON() in purge_persistent_gnt()
El 21/07/15 a les 5.30, Bob Liu ha escrit:
> This BUG_ON() will be triggered when previous purge work haven't finished.
> It's reasonable under pretty extreme load and should not panic the system.
>
> Signed-off-by: Bob Liu <bob.liu@oracle.com>
> ---
> drivers/block/xen-blkback/blkback.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/block/xen-blkback/blkback.c b/drivers/block/xen-blkback/blkback.c
> index ced9677..b90ac8e 100644
> --- a/drivers/block/xen-blkback/blkback.c
> +++ b/drivers/block/xen-blkback/blkback.c
> @@ -394,7 +394,9 @@ static void purge_persistent_gnt(struct xen_blkif *blkif)
>
> pr_debug("Going to purge %u persistent grants\n", num_clean);
>
> - BUG_ON(!list_empty(&blkif->persistent_purge_list));
> + if (!list_empty(&blkif->persistent_purge_list))
> + return;
> +

I see the problem with this, there's a check for work_pending before
this BUG_ON, but it doesn't account if the work is currently running. I
would rather prefer to replace the work_pending check with work_busy
instead, which will also take into account if the work is still running.
The comment on work_busy however makes me nervous:

* Test whether @work is currently pending or running. There is no
* synchronization around this function and the test result is
* unreliable and only useful as advisory hints or for debugging.

AFAICT I think it should be safe because we don't have concurrent
purge_persistent_gnt calls, but I'm no expert on Linux workqueues. It
also makes me wonder why we have such a half-baked function in the Linux
kernel.

Roger.



\
 
 \ /
  Last update: 2015-07-21 11:41    [W:0.641 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site