You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a case that writing the same file in parallel may happen.
(Implicitly caused by NFS client at least on linux)
We still don't know the exact conditions,
However from what we observed log files given from a user facing this issue,
Writing the same file in parallel may happen in case
the target file size is relatively large (around 300MB
the bandwidth between a NFS client and leo_gateway is relatively narrow (across the web
on ubuntu14.04LTS with LeoFS1.3.1
How it works
Say there are two threads(A, B) spawned by NFS client to write a same file which size is 300MB in parallel and they will work like the following
A start to write the file at offset 0 ### writing a former part of a file
B start to write the file at offset 181542912 ### writing a latter parf of a file
A and B write the file while keep increasing each offset by 1048576(1024 * 1024
B finish to write the last latter part of the file
A finish to write the last former part of the file (in this case offset: 181403648 byte count:139264
Since the current implementation has not assumed such behavior,
the final total size calculated by A can be wrong.
mocchira
changed the title
[leo_gateway][nfs] The total file size can be wrong when writing one file in parallel
[leo_gateway][nfs] The total file size can be wrong when writing the same file in parallel
Feb 3, 2017
How to reproduce
There is a case that writing the same file in parallel may happen.
(Implicitly caused by NFS client at least on linux)
We still don't know the exact conditions,
However from what we observed log files given from a user facing this issue,
Writing the same file in parallel may happen in case
How it works
Say there are two threads(A, B) spawned by NFS client to write a same file which size is 300MB in parallel and they will work like the following
A
start to write the file at offset 0 ### writing aformer
part of a fileB
start to write the file at offset 181542912 ### writing alatter
parf of a fileA
andB
write the file while keep increasing each offset by 1048576(1024 * 1024B
finish to write the lastlatter
part of the fileA
finish to write the lastformer
part of the file (in this case offset: 181403648 byte count:139264Since the current implementation has not assumed such behavior,
the final total size calculated by A can be wrong.
How to fix
https://github.com/leo-project/leofs/blob/1.3.2/apps/leo_gateway/src/leo_nfs_file_handler.erl#L339 must be called only in case SrcMetadata#?METADATA.cnumber >= IndexEnd
The text was updated successfully, but these errors were encountered: