chaos / diod

Distributed I/O Daemon - a 9P file server
GNU General Public License v2.0
342 stars 55 forks source link

There may be a inconsistency or mistake in description for `fsync` of 9P2000.L . #101

Open ken4647 opened 2 months ago

ken4647 commented 2 months ago

In In the description of this project, fsync is formatted to this:

size[4] Tfsync tag[2] fid[4]

However, in linux and qemu, it should be like this:

size[4] Tfsync tag[2] fid[4] datasync[4]

,while it means fsync both content and metadata when datasync[4] is 0 , and 1 means fsync content only.

The implement in Linux's 9p client is below: image

I also conducted experiments based on the qemu‘s 9pfs backend and proved that the datasync field is necessary.

Is this inconsistency caused by some reason?

garlick commented 2 months ago

Great find!

FWIW, the commit that added the datasync argument to the kernel is torvalds/linux@b165d60145b717261a0234f989c442c2b68b6ec0 (from 2010)

I was able to run the tests/kern tests after applying the workaround in #101, and found that t15 passes, which is probably how this went unnoticed for so long.