Bug 11753 - Windows backup fails against Samba 4.3.x on Windows 8.1 / Server 2012R2 and newer
Summary: Windows backup fails against Samba 4.3.x on Windows 8.1 / Server 2012R2 and n...
Status: RESOLVED FIXED
Alias: None
Product: Samba 4.1 and newer
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.3.5
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-25 04:57 UTC by Uri Simchoni
Modified: 2016-03-14 08:34 UTC (History)
3 users (show)

See Also:


Attachments
patch for 4.4.0 (2.11 KB, patch)
2016-03-01 21:31 UTC, Uri Simchoni
jra: review+
Details
patch for 4.3.next (2.43 KB, patch)
2016-03-01 21:34 UTC, Uri Simchoni
jra: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Uri Simchoni 2016-02-25 04:57:31 UTC
When running Windows backup against a samba share, the operation fails right after creation of the volume snapshot with message "Incorrect function"

This happens ONLY against Samba 4.3.x series and ONLY on Windows 8.1, Windows server 2012R2, Windows 10, and Windows Server 2016 Technical Preview.

To reproduce, set up a stand-alone Samba 4.3.x server according to https://wiki.samba.org/index.php/Standalone_server and attempt to create a system image of a Windows machine on a share of that server.

This bug is different from https://bugzilla.samba.org/show_bug.cgi?id=10159. In the other bug, the root cause was Samba's lack of support for resilient file handles, and is fixed or has fixes on the Windows side (a hotfixed Windows 8, an up-to-date Win8.1, and Win10 can backup without resiliency support). This bug occurs when the SMB dialect is 3.0.2 or 3.1.1 and the client machine opens the .vhdx file with SVHDX_OPEN_DEVICE_CONTEXT or SVHDX_OPEN_DEVICE_CONTEXT_V2 create context.

If the client is an older version of Windows, the dialect is older - bug doesn't happen.

If samba is older, it ignores the SVHDX_OPEN_DEVICE_CONTEXT which turns out to be the correct thing to do.

A workaround is to set "server max protocol" to SMB3_00 or lower.

An excerpt of a backup command line session on a Win10 client:

C:\WINDOWS\system32>wbadmin start backup -allCritical -backupTarget:\\192.168.40.251\ush -user:localu1 -password:password00
wbadmin 1.0 - Backup command-line tool
(C) Copyright 2013 Microsoft Corporation. All rights reserved.


Note: The backed up data cannot be securely protected at this destination.
Backups stored on a remote shared folder might be accessible by other
people on the network. You should only save your backups to a location
where you trust the other users who have access to the location or on a
network that has additional security precautions in place.

Retrieving volume information...
This will back up System Reserved (500.00 MB),(C:) to \\192.168.40.251\ush.
Do you want to start the backup operation?
[Y] Yes [N] No y

The backup operation to \\192.168.40.251\ush is starting.
Creating a shadow copy of the volumes specified for backup...
Creating a shadow copy of the volumes specified for backup...
Creating a shadow copy of the volumes specified for backup...
Creating a shadow copy of the volumes specified for backup...
The backup of volume System Reserved (500.00 MB) could not be completed. Error: Incorrect function.
Summary of the backup operation:
------------------

The backup operation stopped before completing.
The backup operation stopped before completing.
Detailed error: Incorrect function.
Log of files successfully backed up:
C:\WINDOWS\Logs\WindowsBackup\Backup-23-02-2016_18-30-14.log

Log of files for which backup failed:
C:\WINDOWS\Logs\WindowsBackup\Backup_Error-23-02-2016_18-30-14.log

There was a failure in preparing the backup image of one of the volumes in the backup set.
Incorrect function.

C:\WINDOWS\system32>type c:\Windows\Logs\WindowsBackup\Backup_Error-23-02-2016_14-31-49.log
Backup of volume \\?\Volume{1948156d-0000-0000-0000-100000000000}\ has failed. Incorrect function.
Comment 1 Uri Simchoni 2016-03-01 21:31:55 UTC
Created attachment 11888 [details]
patch for 4.4.0
Comment 2 Uri Simchoni 2016-03-01 21:34:02 UTC
Created attachment 11889 [details]
patch for 4.3.next

The 4.3.next patch is not a cherry-pick, Jeremy - I took the liberty of adding your RB assuming that's you who will be reviewing the patch.
Comment 3 Jeremy Allison 2016-03-02 17:46:23 UTC
Comment on attachment 11888 [details]
patch for 4.4.0

LGTM.
Comment 4 Jeremy Allison 2016-03-02 17:54:54 UTC
Comment on attachment 11889 [details]
patch for 4.3.next

LGTM.
Comment 5 Jeremy Allison 2016-03-02 17:55:16 UTC
Re-assigning to Karolin for inclusion in 4.4.0, 4.3.next.
Comment 6 Karolin Seeger 2016-03-04 10:35:16 UTC
(In reply to Jeremy Allison from comment #5)
Pushed to autobuild-v4-[3|4]-test.
Comment 7 Karolin Seeger 2016-03-14 08:34:32 UTC
(In reply to Karolin Seeger from comment #6)
Pushed to both branches.
Closing out bug report.

Thanks!