<p dir="ltr"><br>
On Nov 24, 2015 16:25, "Jan Kara" <<a href="mailto:jack@suse.cz">jack@suse.cz</a>> wrote:<br>
><br>
> On Mon 23-11-15 20:02:48, Dmitry Monakhov wrote:<br>
> > After freeze_fs was revoked (from Jan Kara) pages's write-back completion<br>
> > is deffered before unwritten conversion, so explicit flush_unwritten_io()<br>
> > was removed here: c724585b62411<br>
> > But we still may face deferred conversion for aio-dio case<br>
> > # Trivial testcase<br>
> > for ((i=0;i<60;i++));do fsfreeze -f /mnt ;sleep 1;fsfreeze -u /mnt;done &<br>
> > fio --bs=4k --ioengine=libaio --iodepth=128 --size=1g --direct=1 \<br>
> > --runtime=60 --filename=/mnt/file --name=rand-write --rw=randwrite<br>
> > NOTE: Sane testcase should be integrated to xfstests, but it requires<br>
> > changes in common/* code, so let's use this this test at the moment.<br>
> ><br>
> > In order to fix this race we have to guard journal transaction with explicit<br>
> > sb_{start,end}_intwrite() as we do with ext4_evict_inode here:8e8ad8a5<br>
><br>
> Well, this problem seems to suggest that we have the freeze protection for<br>
> AIO writes wrong. We should call file_end_write() from aio_complete() and<br>
> not from aio_run_iocb()... <br>
Yep. It was my first attempt to fix that issue, but unfortunately this trick will break lockdep. Caller will do file_start_write and exit to userspace. Lockdep treats such behaviour as bug (return to userspace with a lock held)</p>
<p dir="ltr">There are two way to fix that<br>
1) add specific 'long' lock primitive to lockdep<br>
2) let sync_filesystems to wait pended aio-dio <br></p>
<p dir="ltr">> I believe XFS and other filesystems may have<br>
> problems with this as well (CCed). Attached patch (so far only compile<br>
> tested since my test machine is pondering on something else) should fix<br>
> this.<br>
><br>
> Honza<br>
><br>
> --<br>
> Jan Kara <<a href="mailto:jack@suse.com">jack@suse.com</a>><br>
> SUSE Labs, CR<br>
</p>