On Thu, 2018-04-19 at 10:44 +1000, Dave Chinner wrote: > On Wed, Apr 18, 2018 at 12:00:10PM -0400, Jeff Layton wrote: > > Instead of growing struct file to accommodate a second errseq > > cursor, > > this only implements that behavior when the file is opened with > > O_PATH > > (as we know that that will have the fsync op set to NULL). Maybe we > > can > > do this better somehow though. > > No idea whether this is possible, or even a good idea, but could we > just have syncfs() create a temporary struct file for the duration > of the syncfs call, so it works on any fd passed in? (sorta like an > internal dupfd() call?) > If the main use case is something like Postgresql, where you care about just one or two critical files, rather than monitoring the entire filesystem could we perhaps use a dedicated mmap() mode? It should be possible to throw up a bitmap that displays the exact blocks or pages that are affected, once the file has been damaged. For buffered files, you might even consider allowing an appropriately privileged process to discard the dirty pages (perhaps by clearing the bits in the bitmap?) once they have been identified and possibly copied back out of the page cache. Cheers Trond