Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 4 Mar 2018 19:15:24 +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-11@freebsd.org
Subject:   svn commit: r330401 - stable/11/sys/compat/linuxkpi/common/src
Message-ID:  <201803041915.w24JFOMH018277@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Sun Mar  4 19:15:24 2018
New Revision: 330401
URL: https://svnweb.freebsd.org/changeset/base/330401

Log:
  MFC r330236:
  Correct the return value from flush_work() and flush_delayed_work() in the
  LinuxKPI to comply more with Linux. This fixes an issue when these functions
  are used in waiting loops.
  
  Sponsored by:	Mellanox Technologies

Modified:
  stable/11/sys/compat/linuxkpi/common/src/linux_work.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/compat/linuxkpi/common/src/linux_work.c
==============================================================================
--- stable/11/sys/compat/linuxkpi/common/src/linux_work.c	Sun Mar  4 19:12:54 2018	(r330400)
+++ stable/11/sys/compat/linuxkpi/common/src/linux_work.c	Sun Mar  4 19:15:24 2018	(r330401)
@@ -454,6 +454,7 @@ bool
 linux_flush_work(struct work_struct *work)
 {
 	struct taskqueue *tq;
+	int retval;
 
 	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
 	    "linux_flush_work() might sleep");
@@ -463,8 +464,9 @@ linux_flush_work(struct work_struct *work)
 		return (0);
 	default:
 		tq = work->work_queue->taskqueue;
+		retval = taskqueue_poll_is_busy(tq, &work->work_task);
 		taskqueue_drain(tq, &work->work_task);
-		return (1);
+		return (retval);
 	}
 }
 
@@ -477,6 +479,7 @@ bool
 linux_flush_delayed_work(struct delayed_work *dwork)
 {
 	struct taskqueue *tq;
+	int retval;
 
 	WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL,
 	    "linux_flush_delayed_work() might sleep");
@@ -490,8 +493,9 @@ linux_flush_delayed_work(struct delayed_work *dwork)
 		/* FALLTHROUGH */
 	default:
 		tq = dwork->work.work_queue->taskqueue;
+		retval = taskqueue_poll_is_busy(tq, &dwork->work.work_task);
 		taskqueue_drain(tq, &dwork->work.work_task);
-		return (1);
+		return (retval);
 	}
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201803041915.w24JFOMH018277>