Bug 14320 - smbd mistakenly updates a file's write-time on close
Summary: smbd mistakenly updates a file's write-time on close
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Documentation (show other bugs)
Version: unspecified
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba Documentation QA Contact~
URL:
Keywords:
Depends on: 14150
Blocks:
  Show dependency treegraph
 
Reported: 2020-03-14 17:43 UTC by Ralph Böhme
Modified: 2020-04-09 07:20 UTC (History)
3 users (show)

See Also:


Attachments
git-am fix for 4.12.next. (13.96 KB, patch)
2020-03-30 21:29 UTC, Jeremy Allison
slow: review+
Details
git-am fix for 4.11.next (4.28 KB, patch)
2020-03-30 21:34 UTC, Jeremy Allison
slow: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ralph Böhme 2020-03-14 17:43:04 UTC
Given the following sequence of SMB2 operations:

A) create

B) write

...wait 3 seconds...

C) getinfo SMB2_FILE_ALL_INFO

D) write

...wait 1 second...

E) close with SMB2_CLOSE_FLAGS_FULL_INFORMATION

On a Windows server the file's write-time is updated

1. 2 seconds after B)

On a Samba server the file's write-time is updated

1. 2 seconds after B)

2. at stage E) when the handle is closed

This is wrong: there's no delayed write-time update pending, so the close shouldn't update the write-time.

In our code the problem is caused by fsp->update_write_time_on_close never being reset. Setting this to false in fsp_flush_write_time_update() might do the trick, but this needs a closer look.

This particular sequence of operations is suprisingly not tested, so we got it wrong.

Working on fix, need bugnumber...
Comment 1 Jeremy Allison 2020-03-15 04:53:05 UTC
Oh, good catch. Yep, surely not tested and I'm hoping the simple fix "just works" (tm) :-).
Comment 2 Jeremy Allison 2020-03-30 21:29:19 UTC
Created attachment 15878 [details]
git-am fix for 4.12.next.

Cherry-picked from master.
Comment 3 Jeremy Allison 2020-03-30 21:33:48 UTC
Comment on attachment 15878 [details]
git-am fix for 4.12.next.

Cherry-picked from master
Comment 4 Jeremy Allison 2020-03-30 21:34:38 UTC
Created attachment 15879 [details]
git-am fix for 4.11.next

Back-ported from master (only includes the smbd changes, the torture tests don't exist for 4.11).
Comment 5 Ralph Böhme 2020-04-06 14:13:47 UTC
Reassigning to Karolin for inclusion in 4.11 and 4.12.
Comment 6 Karolin Seeger 2020-04-07 08:10:48 UTC
(In reply to Ralph Böhme from comment #5)
Pushed to autobuild-v4-{12,11}-test.
Comment 7 Karolin Seeger 2020-04-09 07:20:09 UTC
(In reply to Karolin Seeger from comment #6)
Pushed to both branches.
Closing out bug report.

Thanks!