[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200422150256.23473-7-jack@suse.cz>
Date: Wed, 22 Apr 2020 17:02:39 +0200
From: Jan Kara <jack@...e.cz>
To: Matthew Wilcox <willy@...radead.org>
Cc: <linux-fsdevel@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, Jan Kara <jack@...e.cz>
Subject: [PATCH 06/23] xarray: Explicitely set XA_FREE_MARK in __xa_cmpxchg()
__xa_cmpxchg() relies on xas_store() to set XA_FREE_MARK when storing
NULL into xarray that has free tracking enabled. Make the setting of
XA_FREE_MARK explicit similarly as its clearing currently is.
Signed-off-by: Jan Kara <jack@...e.cz>
---
lib/xarray.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/lib/xarray.c b/lib/xarray.c
index 96be029412b2..a372c59e3914 100644
--- a/lib/xarray.c
+++ b/lib/xarray.c
@@ -1479,8 +1479,12 @@ void *__xa_cmpxchg(struct xarray *xa, unsigned long index,
curr = xas_load(&xas);
if (curr == old) {
xas_store(&xas, entry);
- if (xa_track_free(xa) && entry && !curr)
- xas_clear_mark(&xas, XA_FREE_MARK);
+ if (xa_track_free(xa)) {
+ if (entry && !curr)
+ xas_clear_mark(&xas, XA_FREE_MARK);
+ else if (!entry && curr)
+ xas_set_mark(&xas, XA_FREE_MARK);
+ }
}
} while (__xas_nomem(&xas, gfp));
--
2.16.4
Powered by blists - more mailing lists