The flushing of the InnoDB temporary tablespace is unnecessarily tied to the write-ahead redo logging and the flushing of the persistent tablespaces.
We should avoid any writes to the temporary tablespace, unless the pages are being evicted from the buffer pool and going to be reused.
I think that we should simply omit any pages of temporary tables from buf_pool.flush_list. This would allow us to remove the loop in buf_flush_wait_flushed(), among other things. The refactored LRU flushing of MDEV-23399 would have to be refined further to initiate writes of pages of temporary tables. And any code that invokes a page flush before invalidating or resizing the buffer pool will have to be adjusted. On shutdown, we can obviously discard any writes of temporary pages, but when shrinking the buffer pool we must preserve such data.
There is no need to care about the LSN in the temporary tablespace, because the changes are never going to be logged or recovered.