Bug 606428 - GFS2: O_TRUNC not working on stuffed files across cluster
GFS2: O_TRUNC not working on stuffed files across cluster
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: kernel (Show other bugs)
6.0
All Linux
low Severity medium
: rc
: ---
Assigned To: Robert Peterson
Cluster QE
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-21 11:22 EDT by Nate Straz
Modified: 2010-11-11 11:15 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2010-11-11 11:15:58 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
Proposed patch (455 bytes, patch)
2010-06-22 12:35 EDT, Robert Peterson
no flags Details | Diff
Replacement patch (517 bytes, patch)
2010-06-24 19:09 EDT, Robert Peterson
no flags Details | Diff

  None (edit)
Description Nate Straz 2010-06-21 11:22:31 EDT
Description of problem:

When a stuffed file (< 512 bytes on GFS2, IIRC) already exists and it opened with O_TRUNC (or creat()) and verified on a separate cluster node, the stat will return a non-zero st_size.

I ran into this while running multiple iterations of dd_io where the test files were not being unlinked between runs.  

A summary of 10 runs of dd_io produced the following results:
------------------------------  pan2 summary --------------------------------
Testcase                                 PASS    FAIL TIMEOUT  KILLED STOPPED
--------                                 ----    ---- -------  ------  ------
d_rwsbufsmall                             10       0       0       0       0 
d_rwranbufsmall                           10       0       0       0       0 
d_rwrevbufsmall                           10       0       0       0       0 
d_rwssyncsmall                            10       0       0       0       0 
d_rwransyncsmall                          10       0       0       0       0 
d_rwrevsyncsmall                          10       0       0       0       0 
d_rwsbuflarge                             10       0       0       0       0 
d_rwranbuflarge                           10       0       0       0       0 
d_rwrevbuflarge                           10       0       0       0       0 
d_rwsynclarge                             10       0       0       0       0 
d_rwransynclarge                          10       0       0       0       0 
d_rwrevsynclarge                          10       0       0       0       0 
d_rwsbufempty                             10       0       0       0       0 
d_rwranbufempty                           10       0       0       0       0 
d_rwrevbufempty                           10       0       0       0       0 
d_rwsyncempty                             10       0       0       0       0 
d_rwransyncempty                          10       0       0       0       0 
d_rwrevsyncempty                          10       0       0       0       0 
d_rwsbufstuffed                            3       7       0       0       0 
d_rwranbufstuffed                          2       8       0       0       0 
d_rwrevbufstuffed                          7       3       0       0       0 
d_rwsyncstuffed                            1       9       0       0       0 
d_rwransyncstuffed                         2       8       0       0       0 
d_rwrevsyncstuffed                         6       4       0       0       0 
--------                                 ----    ---- -------  ------  ------
Totals                                   201      39       0       0       0 

Only the stuffed file test case showed the issue of O_TRUNC not working as expected.

Version-Release number of selected component (if applicable):
kernel-2.6.32-33.el6.x86_64

How reproducible:
Easily

Steps to Reproduce:
1. dd_io -i 10 ...
2.
3.
  
Actual results:
stuffed file test cases fail

Expected results:
all test cases pass

Additional info:
Comment 2 RHEL Product and Program Management 2010-06-21 11:43:27 EDT
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux major release.  Product Management has requested further
review of this request by Red Hat Engineering, for potential inclusion in a Red
Hat Enterprise Linux Major release.  This request is not yet committed for
inclusion.
Comment 3 Nate Straz 2010-06-21 12:22:15 EDT
I should also note that I discovered this while running w/ jdata enabled.
Comment 4 Nate Straz 2010-06-22 09:07:04 EDT
I ran this against a file system mounted with data=ordered and found that only the buffered and sync stuffed cases failed.  O_DIRECT and mmap methods did not fail.
Comment 5 Robert Peterson 2010-06-22 12:16:11 EDT
I'm pretty sure I see the problem; this will be easy.  I gave
Nate a gfs2.ko to try.  I'll attach the patch shortly.
Comment 6 Robert Peterson 2010-06-22 12:35:08 EDT
Created attachment 426006 [details]
Proposed patch

Here is the patch to hopefully solve the problem.
Comment 7 Robert Peterson 2010-06-23 10:00:15 EDT
I gave Nate a gfs2.ko with this patch yesterday.  I'll just
set the NEEDINFO flag until I hear whether it worked properly.
Comment 8 Robert Peterson 2010-06-24 09:35:36 EDT
My proposed patch doesn't work.  Obviously, i_disksize needs to
be set before the dinode_out.  My bad.  I started testing a
revised patch last night, but ran into a different problem that
warranted investigation.
Comment 9 Robert Peterson 2010-06-24 19:09:05 EDT
Created attachment 426717 [details]
Replacement patch

Here's the one that works.  At least it did on my west cluster.
Comment 11 Aristeu Rozanski 2010-07-01 12:13:39 EDT
Patch(es) available on kernel-2.6.32-42.el6
Comment 14 Nate Straz 2010-07-08 15:31:10 EDT
This is working much better with the -42 kernel.

------------------------------  pan2 summary --------------------------------
Testcase                                 PASS    FAIL TIMEOUT  KILLED STOPPED
--------                                 ----    ---- -------  ------  ------
d_rwsbufstuffed                           10       0       0       0       0
d_rwranbufstuffed                         10       0       0       0       0
d_rwrevbufstuffed                         10       0       0       0       0
d_rwsyncstuffed                           10       0       0       0       0
d_rwransyncstuffed                        10       0       0       0       0
d_rwrevsyncstuffed                        10       0       0       0       0
d_rwdirectstuffed                         10       0       0       0       0
d_rwrandirectstuffed                      10       0       0       0       0
d_rwrevdirectstuffed                      10       0       0       0       0
d_mmapseq_stuffed                         10       0       0       0       0
d_mmaprand_stuffed                        10       0       0       0       0
d_mmaprev_stuffed                         10       0       0       0       0
--------                                 ----    ---- -------  ------  ------
Totals                                   120       0       0       0       0
Comment 15 releng-rhel@redhat.com 2010-11-11 11:15:58 EST
Red Hat Enterprise Linux 6.0 is now available and should resolve
the problem described in this bug report. This report is therefore being closed
with a resolution of CURRENTRELEASE. You may reopen this bug report if the
solution does not work for you.

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