diff --git a/fs/dax.c b/fs/dax.c
index b68ce484e1be7f58ea9379cce298e82bd88ebcfd..4becbf168b7f0df3229b1e1a5d0fb8daca02df0d 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -447,6 +447,7 @@ bool dax_lock_mapping_entry(struct page *page)
 			xa_unlock_irq(&mapping->i_pages);
 			break;
 		} else if (IS_ERR(entry)) {
+			xa_unlock_irq(&mapping->i_pages);
 			WARN_ON_ONCE(PTR_ERR(entry) != -EAGAIN);
 			continue;
 		}