Re: [RFC PATCH] btrfs: don't call btrfs_sync_file from iomap context

Josef Bacik
2020-09-02T11:10:21Z

On 9/2/20 3:12 AM, Johannes Thumshirn wrote:
> On 02/09/2020 02:22, Josef Bacik wrote:
>> Instead now we have to rip
>> it out until we figure out what to do about it.
>
> I don't think we need to rip out the iomap conversion. We can
> take my fix albeit not pretty, until we have reworked the locking
> around ->fsync(). Probably with a big fat comment attached to it.
>

We do, because your fix breaks DSYNC for AIO. You didn't hit this with
direct io, you hit it with AIO, and the reason you hit it is because you
are on zram, so your bio's completed before we exited iomap_dio_rw. So
that was the last put on the iomap_dio, and thus we ran
iomap_dio_complete() and deadlocked. We can't just drop the DSYNC thing
for AIO because in the normal case where this doesn't happen we need to
know when the last thing is finished in order to run ->fsync(), we can't
just run it after submission. Thanks,

Josef