[Bugs] [Bug 1364912] New: The content of file in client is wrong when time was adjusted by NTP in this client.
bugzilla at redhat.com
bugzilla at redhat.com
Mon Aug 8 08:01:11 UTC 2016
https://bugzilla.redhat.com/show_bug.cgi?id=1364912
Bug ID: 1364912
Summary: The content of file in client is wrong when time was
adjusted by NTP in this client.
Product: GlusterFS
Version: mainline
Component: md-cache
Assignee: bugs at gluster.org
Reporter: george.lian at nokia.com
Group: nokia
Description of problem:
When the system time was adjusted by NTP or others application, md_cache can't
be invalidated while the content of file was changed at same time.
Version-Release number of selected component (if applicable):
mainline
How reproducible:
Let's say VM1,VM2 is a client of storage node.
SN0 is storage node server.
there are a directory which mount with glusterfs type to storage server, let's
say /mnt/sn_mpoint/ on both VM1 and VM2
there is a file in directory /mnt/sn_mpoint , let's say "test_file"
there is only a string "content_in_step1" in the file
Steps to Reproduce:
1. run a command to create a cache for this file in VM1.
[VM1]# cat /mnt/sn_mpoint/test_file
2. adjust the system time of VM1, now time is hh:mm:ss (assume hh >1)
[VM1]# date -s hh-1:mm:ss
3. change the content of file in gluster server through action on VM2
[VM2]# echo "content_in_step3" > /mnt/sn_mpoint/test_file
4. show the content in VM1
[VM1]# cat /mnt/sn_mpoint/test_file
Actual results:
"content_in_step1"
Expected results:
"content_in_step3"
Additional info:
after investigation, there a function called "is_md_cache_xatt_valid"
static gf_boolean_t
is_md_cache_xatt_valid (xlator_t *this, struct md_cache *mdc)
{
struct mdc_conf *conf = NULL;
time_t now = 0;
gf_boolean_t ret = _gf_true;
conf = this->private;
time (&now);
LOCK (&mdc->lock);
{
// if (now >= (mdc->xa_time + conf->timeout))
if (now >= (mdc->xa_time + conf->timeout) || now <
(mdc->xa_time)
ret = _gf_false;
}
UNLOCK (&mdc->lock);
return ret;
}
I try change the line which commented to the new one, which mean do invalidate
for this cache when current time is young than mdc's cache time, and I have
verified the changes, the issue seems gone.
there are 2 other function "is_md_cache_iatt_valid" and "__qr_cache_is_fresh"
seems have same issues.
I dont' think my changes is the best solutions for this issue, just for your
reference, and wish your comments and right solutions for this issue.
--
You are receiving this mail because:
You are the assignee for the bug.
More information about the Bugs
mailing list