How to durably rename a file in POSIX?

前端 未结 4 1395
南旧
南旧 2020-12-23 19:11

What\'s the correct way to durably rename a file in a POSIX file system? Specifically wondering about fsyncs on the directories. (If this depends on the OS/FS, I\

4条回答
  •  臣服心动
    2020-12-23 19:51

    It sounds to me like you're trying to do the job of the filesystem. If you move a file the kernel and file-system are responsible for atomic operation and fault-recovery, not your code.

    Anyway, this article seems to address your questions regarding fsync: http://blogs.gnome.org/alexl/2009/03/16/ext4-vs-fsync-my-take/

提交回复
热议问题