On Fri, Oct 19, 2018 at 08:16:27AM +0000, Romain Le Disez wrote: > Thanks all for your answers, it is really helpful, I have now a clearer vision of how it works. > > I have one last question. > > If I’m in the process of creating 1000 files this way, but the server crashes before the syncfs() function was called, what will happen to the files that were already rename()/linkat()? files up to a certain point will be there in order, data in those files is likely to be missing. What files are there and what files have data will be completely random. i.e. you'll have a mess to clean up. > Do they follow the same ordering, so I’m sure they are either complete (all data/xattr + xfs metadata) or not in the destination directory? > > Or, is syncfs() the only way to ensure this ordering? syncfs is like a bulk checkpoint. Until it completes, there are no guarantees about anything. Only way to guarantee per file data integrity and ordering is to use fsync. Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx