Bug 13858 - vfs_snapper fstat handler does nothing
vfs_snapper fstat handler does nothing
Status: ASSIGNED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: VFS Modules
unspecified
All All
: P5 minor
: ---
Assigned To: Karolin Seeger
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-03-25 00:07 UTC by David Disseldorp
Modified: 2019-04-16 07:31 UTC (History)
1 user (show)

See Also:


Attachments
cherry-pick for 4.9.next and 4.10.next (1.88 KB, patch)
2019-04-14 20:57 UTC, David Disseldorp
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description David Disseldorp 2019-03-25 00:07:33 UTC
Not sure what I was thinking when I added this, but the fstat handler in vfs_snapper doesn't look right:

2168 static int snapper_gmt_fstat(vfs_handle_struct *handle, files_struct *fsp,
2169                              SMB_STRUCT_STAT *sbuf)
2170 {
2171         time_t timestamp;
2172         int ret;
2173 
2174         ret = SMB_VFS_NEXT_FSTAT(handle, fsp, sbuf);
2175         if (ret == -1) {
2176                 return ret;
2177         }
2178         if (!snapper_gmt_strip_snapshot(talloc_tos(), handle,
2179                                         fsp->fsp_name->base_name,
2180                                         &timestamp, NULL)) {
2181                 return 0;
2182         }
2183         return 0;
2184 }

It returns zero regardless of whether fsp refers to a snapshot or not.
I think this is a cut-n-paste error from shadow_copy2, which does some fiddling about with sbuf for snapshots. The entire handler can probably be dropped.
Comment 1 Jeremy Allison 2019-03-25 16:51:17 UTC
Yep, seems the right thing to do to me. Can you propose a patch and I'll review.

Thanks,

Jeremy.
Comment 2 David Disseldorp 2019-03-27 16:31:03 UTC
(In reply to Jeremy Allison from comment #1)
> Yep, seems the right thing to do to me. Can you propose a patch and I'll
> review.

Thanks! Sent to the list:
https://lists.samba.org/archive/samba-technical/2019-March/133055.html
Comment 3 Jeremy Allison 2019-03-27 16:56:09 UTC
LGTM. RB+ and pushed. Back-port once it's in.
Comment 4 David Disseldorp 2019-04-14 20:57:42 UTC
Created attachment 15059 [details]
cherry-pick for 4.9.next and 4.10.next
Comment 5 Jeremy Allison 2019-04-15 21:29:29 UTC
Re-assigning to Karolin for inclusion in 4.10.next, 4.9.next.
Comment 6 Karolin Seeger 2019-04-16 07:31:33 UTC
(In reply to Jeremy Allison from comment #5)
Pushed to autobuild-v4-{10,9}-test.