Re: [PATCH] fs/ntfs3: don't hold ni_lock when calling truncate_setsize()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 2, 2023 at 6:05 AM Tetsuo Handa
<penguin-kernel@xxxxxxxxxxxxxxxxxxx> wrote:
>
> Since filemap_update_page() calls filemap_read_folio() after calling
> folio_trylock() which will set PG_locked bit, ntfs_truncate() must not
> call truncate_setsize() which will wait for PG_locked bit to be
> cleared when holding ni_lock lock.

I've applied this patch directly.

I'm not thrilled about changing the locking like this, but I don't
think truncate_setsize() can possibly rely on the ni_lock in any
productive ways (ie it only touches generic vfs data, not anything
that ni_lock protects), and it clearly is a source of deadlocks.

So I think some ntfs3 person needs to think hard about the locking
here, and maybe there are future patches in this area, but this seems
to be the RightThing(tm) for now, at least.

                Linus




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux