dax: Make sure the unlocking entry isn't locked
authorMatthew Wilcox <willy@infradead.org>
Sat, 10 Nov 2018 01:09:37 +0000 (20:09 -0500)
committerMatthew Wilcox <willy@infradead.org>
Fri, 16 Nov 2018 21:38:50 +0000 (16:38 -0500)
I wrote the semantics in the commit message, but didn't document it in
the source code.  Use a BUG_ON instead (if any code does do this, it's
really buggy; we can't recover and it's worth taking the machine down).

Signed-off-by: Matthew Wilcox <willy@infradead.org>
fs/dax.c

index 529ac9d7c10a02af78ca0689fd2dbec7e8d08ce8..7944417f5a718a354cac92dd065cd589c2df53bc 100644 (file)
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -255,6 +255,7 @@ static void dax_unlock_entry(struct xa_state *xas, void *entry)
 {
        void *old;
 
+       BUG_ON(dax_is_locked(entry));
        xas_reset(xas);
        xas_lock_irq(xas);
        old = xas_store(xas, entry);