Bug 11240 - Incorrect file size returned in the response of "FILE_SUPERSEDE Create"
Summary: Incorrect file size returned in the response of "FILE_SUPERSEDE Create"
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.1.17
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-28 21:39 UTC by Jeremy Allison
Modified: 2015-05-10 19:14 UTC (History)
1 user (show)

See Also:


Attachments
Raw patch for master. (847 bytes, patch)
2015-04-28 21:39 UTC, Jeremy Allison
no flags Details
git-am fix for master. (7.15 KB, patch)
2015-04-29 00:19 UTC, Jeremy Allison
no flags Details
git-am fix for 4.2.next. (7.67 KB, patch)
2015-04-30 22:22 UTC, Jeremy Allison
slow: review+
Details
git-am fix for 4.1.next. (1.53 KB, patch)
2015-04-30 22:23 UTC, Jeremy Allison
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2015-04-28 21:39:28 UTC
Created attachment 10997 [details]
Raw patch for master.

From: Kenny Dinh <kdinh@peaxy.net>
To: samba-technical <samba-technical@lists.samba.org>
Subject: Incorrect file size returned in the Respond of "FILE_SUPERSEDE Create"

[-- Attachment #1 [details] --]
[-- Type: text/plain, Encoding: 7bit, Size: 0.8K --]

Hi all,

We were running a test in IFSTEST suite called "SupersideFileTest".  The
test expects file size to be 0 after a successful open request, with
FILE_SUPERSEDE disposition, returned.

While handling FILE_SUPERSEDE disposition, SAMBA call vfswrap_ftruncate()
to truncate the file.  However, the file size stored in
fsp->fsp_name->st.st_ex_size was not updated after ftruncate() is called.

As a result, the Create Respond for FILE_SUPERSEDE request contains the
stale file size instead of 0.  The existing code simply returns if
ftruncate() succeeded.  I moved the code such that we always call
vfs_stat_fsp() to update the file size in fsp->fsp_name->st.st_ex_size.

Could someone verify if the attached patch is correct is should be pulled
upstream?

Thanks,
Kenny
Comment 1 Jeremy Allison 2015-04-29 00:19:05 UTC
Created attachment 10998 [details]
git-am fix for master.
Comment 2 Jeremy Allison 2015-04-30 22:22:39 UTC
Created attachment 11006 [details]
git-am fix for 4.2.next.

Cherry-pick from master. Includes torture test.
Comment 3 Jeremy Allison 2015-04-30 22:23:20 UTC
Created attachment 11007 [details]
git-am fix for 4.1.next.

Cherry-pick from master. Doesn't include torture test for 4.1.next.
Comment 4 Jeremy Allison 2015-05-01 16:24:36 UTC
Re-assigning to Karolin for inclusion in 4.2.next, 4.1.next.
Comment 5 Karolin Seeger 2015-05-05 18:49:15 UTC
Pushed to autobuild-v4-[1|2]-test.
Comment 6 Karolin Seeger 2015-05-10 19:14:36 UTC
Pushed to both branches.
Closing out bug report.

Thanks!