Bug 1700295

Summary: The data couldn't be flushed immediately even with O_SYNC in glfs_create or with glfs_fsync/glfs_fdatasync after glfs_write.
Product: [Community] GlusterFS Reporter: Xiubo Li <xiubli>
Component: coreAssignee: Xiubo Li <xiubli>
Status: CLOSED NOTABUG QA Contact:
Severity: urgent Docs Contact:
Priority: high    
Version: 6CC: amarts, amukherj, bugs, pasik, pkarampu, prasanna.kalever
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-17 04:09:19 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Xiubo Li 2019-04-16 09:26:32 UTC
Description of problem:

In gluster-block project we had hit a case where we will sometimes get old block metadata with blockGetMetaInfo(), which will glfs_read from the block file, after updating the block metadata with GB_METAUPDATE_OR_GOTO(), which will glfs_write the block file.

In GB_METAUPDATE_OR_GOTO, it basically open the metafile with the O_SYNC, write the new details and close it in-place, which should flush the data to metafile. But looks like in glusterfs-api-devel-6.0-0.4.rc1.fc29.x86_64 it will not be flushed in time.

Version-Release number of selected component (if applicable):




How reproducible:
In RHEL 7 by using the gluster-blocl/tests/basic.t script with glusterfs-api-devel-6.0-0.4.rc1.fc29.x86_64 it is very easy to reproduce, in my setups almost 40%.

Steps to Reproduce:
1. git clone https://github.com/gluster/gluster-block.git
2. build it from source and install it
3. install the tcmu-runner package or use the upstream code
4. $ ./tests/basic.t



Actual results:
Delete will fail sometimes

Expected results:
Delete should be success

Additional info:

More detail please see
https://github.com/gluster/gluster-block/issues/204
https://github.com/gluster/gluster-block/pull/209