Re: [PATCH 04/10] iomap: zeroing already holds invalidate_lock in iomap_file_buffered_write_punch_delalloc

Christoph Hellwig
2024-08-28T04:51:16Z

On Tue, Aug 27, 2024 at 09:28:04AM -0700, Darrick J. Wong wrote:
> On Tue, Aug 27, 2024 at 07:09:51AM +0200, Christoph Hellwig wrote:
> > All callers of iomap_zero_range already hold invalidate_lock, so we can't
> > take it again in iomap_file_buffered_write_punch_delalloc.
>
> What about the xfs_zero_range call in xfs_file_write_checks? AFAICT we
> don't hold the invalidate lock there. Did I misread that?

No, I think you're right. My testing just never managed to hit a short
zero while doing the write prep.

I guess I'll need to do something more complicated than the zero flag
then. I initially added a new flag just for that and then (wrongly as you
pointed out) that I don't need it after all.

> Also, would nested takings of the invalidate lock cause a livelock? Or
> is this actually quite broken now?

It is a cold, hard deadlock.