http://www.perlmonks.org?node_id=837101


in reply to Re: fsyncing directories
in thread fsyncing directories

Thank you, this is a nice workaround :) IO::Handle accepts this file handle because it thinks that it is opened for writing.

From the strace output it seems that this does in fact fsync the directory. Excerpt:

open("/etc/", O_RDONLY) = 3 dup(3) = 4 fsync(4) = 0

I don't think the dup() hurts the functionality. Though of course I cannot be sure because I'd have to crash my system repeatedly to see if the effect is the same.