On Tue, Sep 05, 2017 at 11:34:39AM -0400, Brian Foster wrote: > In xfs_log_force_lsn(), the iclog has to be ACTIVE. We switch it to > WANT_SYNC, bump the refcnt and call release_iclog(). The latter may or > may not do anything depending on the refcount. We set log_flushed > immediately after the release before we know whether an xlog_sync() has > actually occurred (is that your concern?). If XFS_LOG_SYNC is set, we > wait on the iclog before _force_lsn() returns, which means the log > buffer I/O has to have completed before we return either way. If the > iclog is still WANT_SYNC, the release didn't do anything, but we wait on > ic_force_wait which is triggered during I/O completion handling. If the > iclog is already DIRTY/ACTIVE, then the I/O has already submitted and > completed. > > fsync looks like the only the user of log_flushed and it also uses > XFS_LOG_SYNC. ISTM that the code is probably still bogus in principle, > but in practice the fsync code may be safe. Thoughts? Am I missing > something else? Yes, I think you're right - the extra XFS_LOG_SYNC code papers over the issue. But given that the log_flushed indicator makes very little sene without XFS_LOG_SYNC it should be ok.