On Fri, Jan 7, 2011 at 8:29 PM, Thomas Bellman <bell...@nsc.liu.se> wrote: > What is the visibility of the changes for other processes supposed > to be in the meantime? I.e., if things happen in this order:
Should be atomic too, at close time. > 1. Process A does fda = open("foo.txt", O_TRUNC|O_ATOMIC) > 2. Process B does fdb = open("foo.txt", O_RDONLY) > 3. B does read(fdb, buf, 4096) > 4. A does write(fda, "NEW DATA\n", 9) > 5. Process C comes in and does fdc = open("foo.txt", O_RDONLY) > 6. C does read(fdc, buf, 4096) > 7. A calls close(fda) > > Does B see an empty file, or does it see the old contents of > the file? Old file, otherwise A wouldn't be atomic. > Does C see "NEW DATA\n", or does it see the old > contents of the file, or perhaps an empty file? Old file again, as the 'transaction' isn't finished until close. -- Olaf -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html