[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <677f013c1466_f58f29466@dwillia2-xfh.jf.intel.com.notmuch>
Date: Wed, 8 Jan 2025 14:50:36 -0800
From: Dan Williams <dan.j.williams@...el.com>
To: Alistair Popple <apopple@...dia.com>, <akpm@...ux-foundation.org>,
<dan.j.williams@...el.com>, <linux-mm@...ck.org>
CC: Alistair Popple <apopple@...dia.com>, <lina@...hilina.net>,
<zhang.lyra@...il.com>, <gerald.schaefer@...ux.ibm.com>,
<vishal.l.verma@...el.com>, <dave.jiang@...el.com>, <logang@...tatee.com>,
<bhelgaas@...gle.com>, <jack@...e.cz>, <jgg@...pe.ca>,
<catalin.marinas@....com>, <will@...nel.org>, <mpe@...erman.id.au>,
<npiggin@...il.com>, <dave.hansen@...ux.intel.com>, <ira.weiny@...el.com>,
<willy@...radead.org>, <djwong@...nel.org>, <tytso@....edu>,
<linmiaohe@...wei.com>, <david@...hat.com>, <peterx@...hat.com>,
<linux-doc@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-arm-kernel@...ts.infradead.org>, <linuxppc-dev@...ts.ozlabs.org>,
<nvdimm@...ts.linux.dev>, <linux-cxl@...r.kernel.org>,
<linux-fsdevel@...r.kernel.org>, <linux-ext4@...r.kernel.org>,
<linux-xfs@...r.kernel.org>, <jhubbard@...dia.com>, <hch@....de>,
<david@...morbit.com>
Subject: Re: [PATCH v5 03/25] fs/dax: Don't skip locked entries when scanning
entries
Alistair Popple wrote:
> Several functions internal to FS DAX use the following pattern when
> trying to obtain an unlocked entry:
>
> xas_for_each(&xas, entry, end_idx) {
> if (dax_is_locked(entry))
> entry = get_unlocked_entry(&xas, 0);
>
> This is problematic because get_unlocked_entry() will get the next
> present entry in the range, and the next entry may not be
> locked. Therefore any processing of the original locked entry will be
> skipped. This can cause dax_layout_busy_page_range() to miss DMA-busy
> pages in the range, leading file systems to free blocks whilst DMA
> operations are ongoing which can lead to file system corruption.
>
> Instead callers from within a xas_for_each() loop should be waiting
> for the current entry to be unlocked without advancing the XArray
> state so a new function is introduced to wait.
Oh wow, good eye!
Did this trip up an xfstest, or did you see this purely by inspection?
> Also while we are here rename get_unlocked_entry() to
> get_next_unlocked_entry() to make it clear that it may advance the
> iterator state.
Outside of the above clarification of how found / end user effect you
can add:
Reviewed-by: Dan Williams <dan.j.williams@...el.com>
Powered by blists - more mailing lists