Bug 1723761 - [Ganesha]: truncate operation not updating the ctime
Summary: [Ganesha]: truncate operation not updating the ctime
Keywords:
Status: CLOSED NEXTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: posix
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
Assignee: Jiffin
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks: 1720163 1724558 1739399
TreeView+ depends on / blocked
 
Reported: 2019-06-25 10:41 UTC by Jiffin
Modified: 2019-08-09 08:52 UTC (History)
15 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of: 1720163
: 1724558 1739399 (view as bug list)
Environment:
Last Closed: 2019-06-27 09:29:20 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Gluster.org Gerrit 22948 0 None Merged posix : add posix_set_ctime() in posix_ftruncate() 2019-06-27 09:29:19 UTC

Description Jiffin 2019-06-25 10:41:18 UTC
+++ This bug was initially created as a clone of Bug #1720163 +++

Description of problem:


truncate/00.t and chown/00.t tests are failing in posix compliance when ran over 3.5.0 build v3 mount.These used to pass in 3.4.0 release

-------------------

# prove -r /home/ntfs-3g-pjd-fstest/tests/chown/00.t 
/home/ntfs-3g-pjd-fstest/tests/chown/00.t .. Failed 1/171 subtests 

Test Summary Report
-------------------
/home/ntfs-3g-pjd-fstest/tests/chown/00.t (Wstat: 0 Tests: 171 Failed: 1)
  Failed test:  118
Files=1, Tests=171, 17 wallclock secs ( 0.03 usr  0.01 sys +  0.52 cusr  0.73 csys =  1.29 CPU)
Result: FAIL


# prove -r /home/ntfs-3g-pjd-fstest/tests/truncate/00.t 
/home/ntfs-3g-pjd-fstest/tests/truncate/00.t .. Failed 1/21 subtests 

Test Summary Report
-------------------
/home/ntfs-3g-pjd-fstest/tests/truncate/00.t (Wstat: 0 Tests: 21 Failed: 1)
  Failed test:  15
Files=1, Tests=21,  2 wallclock secs ( 0.01 usr  0.01 sys +  0.07 cusr  0.10 csys =  0.19 CPU)
Result: FAIL


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

# rpm -qa | grep ganesha
nfs-ganesha-gluster-2.7.3-4.el7rhgs.x86_64
nfs-ganesha-debuginfo-2.7.3-4.el7rhgs.x86_64
glusterfs-ganesha-6.0-5.el7rhgs.x86_64
nfs-ganesha-2.7.3-4.el7rhgs.x86_64

# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.7 Beta (Maipo)

How reproducible:
3/3


Steps to Reproduce:
1.Create 4 node Ganesha cluster
2.Create 12*3 Distributed-Replicate Volume.
3.Export the volume via Ganesha
4.Mount the volume on client via v3.0
5.Run posix compliance test 

Actual results:
===============

truncate/00.t and chown/00.t tests were failing with 3.5.0.
These test used to pass with older LIVE bits

3.5.0
------

Test Summary Report
-------------------
/home/ntfs-3g-pjd-fstest/tests/chmod/00.t    (Wstat: 0 Tests: 106 Failed: 2)
  Failed tests:  31, 39
/home/ntfs-3g-pjd-fstest/tests/chown/00.t    (Wstat: 0 Tests: 171 Failed: 1)
  Failed test:  118
/home/ntfs-3g-pjd-fstest/tests/ftruncate/00.t (Wstat: 0 Tests: 26 Failed: 1)
  Failed test:  24
/home/ntfs-3g-pjd-fstest/tests/mknod/03.t    (Wstat: 0 Tests: 12 Failed: 9)
  Failed tests:  1-3, 5-7, 9-11
/home/ntfs-3g-pjd-fstest/tests/truncate/00.t (Wstat: 0 Tests: 21 Failed: 1)
  Failed test:  15


3.4.0
-----

Test Summary Report
-------------------
/root/ntfs-3g-pjd-fstest/tests/chmod/00.t    (Wstat: 0 Tests: 106 Failed: 2)
  Failed tests:  31, 39
/root/ntfs-3g-pjd-fstest/tests/ftruncate/00.t (Wstat: 0 Tests: 26 Failed: 1)
  Failed test:  24
/root/ntfs-3g-pjd-fstest/tests/link/00.t     (Wstat: 0 Tests: 82 Failed: 4)
  Failed tests:  57-58, 64-65
/root/ntfs-3g-pjd-fstest/tests/mknod/03.t    (Wstat: 0 Tests: 12 Failed: 9)
  Failed tests:  1-3, 5-7, 9-11

Expected results:
==========
truncate/00.t and chown/00.t tests should pass

Additional info:



--- Additional comment from Jiffin on 2019-06-13 10:29:54 UTC ---

Failures cases:

ctime is not getting updated properly for truncate operation on v3 and v4 mounts(truncate)

ctime is not getting updated properly for mkdir in v3 operation (chown), it seems to be hard to believe for me every other operation apart from mkdir is passing(create,mkfifo, symlink)

If possible can u please try to olders nfs-clients than rhel 7.7

--- Additional comment from Manisha Saini on 2019-06-13 19:44:29 UTC ---

(In reply to Jiffin from comment #5)
> Failures cases:
> 
> ctime is not getting updated properly for truncate operation on v3 and v4
> mounts(truncate)
> 
> ctime is not getting updated properly for mkdir in v3 operation (chown), it
> seems to be hard to believe for me every other operation apart from mkdir is
> passing(create,mkfifo, symlink)
> 
> If possible can u please try to olders nfs-clients than rhel 7.7

Hi Jiffin,

Posix compliance on 3.4.0 was ran with RHEL 7.7 clients only.Hence it does not seems to be RHEL client issue since its passing with 3.4.0+ RHEL 7.7 but failing with 3.5.0+ RHEL 7.7

--- Additional comment from Jiffin on 2019-06-18 09:56:20 UTC ---

As I mentioned before the failure for truncate operation is genuine. But I was able to pass test case for chown if I increase the sleep from 1s to 2s, so most probably a timing issue.

--- Additional comment from RHEL Product and Program Management on 2019-06-20 06:14:28 UTC ---

This BZ is being approved for the RHGS 3.5.0 release, upon receipt of the 3 ACKs (PM,Devel,QA) for the release flag 'rhgs-3.5.0', and on being attached to an official RHGS 3.5.0 BZ Tracker

--- Additional comment from Jiffin on 2019-06-24 09:26:33 UTC ---

The test was in the following part
# successful truncate(2) updates ctime.
expect 0 create ${n0} 0644
ctime1=`${fstest} stat ${n0} ctime`
sleep 1
expect 0 truncate ${n0} 123 
ctime2=`${fstest} stat ${n0} ctime`
test_check $ctime1 -lt $ctime2 --->  failure. The ctime1 and ctime2 was same while running this test nfs mounts. 
expect 0 unlink ${n0}


But when I tried to create the same scenario manually and via test script. In both cases the ctime is getting updated properly.

# vim /root/ntfs-3g-pjd-fstest/tests/truncate/00.t
-sh-4.2# touch foo
-sh-4.2# stat foo
  File: ‘foo’
  Size: 0         	Blocks: 0          IO Block: 1048576 regular empty file
Device: 2bh/43d	Inode: 9680437269025099955  Links: 1
Access: (0644/-rw-r--r--)  Uid: (   99/  nobody)   Gid: (   99/  nobody)
Context: system_u:object_r:nfs_t:s0
Access: 2019-06-21 15:10:43.000000000 +0530
Modify: 2019-06-21 15:10:43.000000000 +0530
Change: 2019-06-21 15:10:43.000000000 +0530
 Birth: -
-sh-4.2# truncate -s 0 foo
-sh-4.2# stat foo
  File: ‘foo’
  Size: 0         	Blocks: 0          IO Block: 1048576 regular empty file
Device: 2bh/43d	Inode: 9680437269025099955  Links: 1
Access: (0644/-rw-r--r--)  Uid: (   99/  nobody)   Gid: (   99/  nobody)
Context: system_u:object_r:nfs_t:s0
Access: 2019-06-21 15:10:43.000000000 +0530
Modify: 2019-06-21 15:11:04.000000000 +0530
Change: 2019-06-21 15:11:04.000000000 +0530
 Birth: -


# cat test.sh
#!/bin/bash

touch fqwe

stat fqwe


sleep 1


truncate -s 123 fqwe


stat fqwe


# ./test.sh 
  File: ‘fqwe’
  Size: 0         	Blocks: 0          IO Block: 1048576 regular empty file
Device: 2bh/43d	Inode: 13678437881096575140  Links: 1
Access: (0644/-rw-r--r--)  Uid: (   99/  nobody)   Gid: (   99/  nobody)
Context: system_u:object_r:nfs_t:s0
Access: 2019-06-21 15:18:17.000000000 +0530
Modify: 2019-06-21 15:18:17.000000000 +0530
Change: 2019-06-21 15:18:17.000000000 +0530
 Birth: -
  File: ‘fqwe’
  Size: 0         	Blocks: 0          IO Block: 1048576 regular empty file
Device: 2bh/43d	Inode: 13678437881096575140  Links: 1
Access: (0644/-rw-r--r--)  Uid: (   99/  nobody)   Gid: (   99/  nobody)
Context: system_u:object_r:nfs_t:s0
Access: 2019-06-21 15:18:17.000000000 +0530
Modify: 2019-06-21 15:18:18.000000000 +0530
Change: 2019-06-21 15:18:18.000000000 +0530


will check via packet traces as well and confirm

--- Additional comment from Sunil Kumar Acharya on 2019-06-24 14:50:59 UTC ---

Please updated the RDT flag/text appropriately.

--- Additional comment from Jiffin on 2019-06-25 10:36:45 UTC ---

RCA : with ctime feature posix_ftruncate was not setting up the ctime which resulted in this failure.
Thanks Kotresh for pointing out the fix. will post the patch soon.

Comment 1 Worker Ant 2019-06-26 11:20:41 UTC
REVIEW: https://review.gluster.org/22948 (posix : add posix_set_ctime() in posix_ftruncate()) posted (#1) for review on master by jiffin tony Thottan

Comment 2 Worker Ant 2019-06-27 09:29:20 UTC
REVIEW: https://review.gluster.org/22948 (posix : add posix_set_ctime() in posix_ftruncate()) merged (#3) on master by Kotresh HR


Note You need to log in before you can comment on or make changes to this bug.