From bdf8d6e7eb7c4cd42980559251f88a78f404a41a Mon Sep 17 00:00:00 2001 From: Thomas Schoebel-Theuer Date: Wed, 24 May 2023 11:52:02 +0200 Subject: [PATCH] copy: safeguard potential race --- kernel/mars_copy.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/kernel/mars_copy.c b/kernel/mars_copy.c index c0333e1c..f7765336 100644 --- a/kernel/mars_copy.c +++ b/kernel/mars_copy.c @@ -106,13 +106,9 @@ void notify_clash(struct copy_brick *brick, bool do_wake) } static inline -bool clear_clash(struct copy_brick *brick) +void clear_clash(struct copy_brick *brick) { - bool cleared; - - cleared = cmpxchg(&brick->clash, true, false); - smp_mb(); - return cleared; + cmpxchg(&brick->clash, true, false); } /* Current semantics (NOT REALLY IMPLEMENTED because OUTPUT IS NOT IN USE) @@ -1031,6 +1027,7 @@ int _run_copy(struct copy_brick *brick, loff_t this_start) MARS_DBG("clash\n"); _clear_all_mref(brick); _clear_state_table(brick); + smp_mb(); clear_clash(brick); } }