1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-26 21:57:41 +03:00

smbd/ioctl: match WS2016 ReFS set compression behaviour

ReFS doesn't support compression, but responds to set-compression FSCTLs
with NT_STATUS_OK if (and only if) the requested compression format is
COMPRESSION_FORMAT_NONE.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=12144

Reported-by: Nick Barrett <nick@barrett.org.nz>
Signed-off-by: David Disseldorp <ddiss@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Mon Jan  9 23:14:28 CET 2017 on sn-devel-144

(cherry picked from commit 28cc347876b97b7409d6efd377f031fc6df0c5f3)
This commit is contained in:
David Disseldorp 2017-01-05 17:36:02 +01:00 committed by Stefan Metzmacher
parent e0bb6287e0
commit ceaafa7cdb

View File

@ -104,11 +104,6 @@ static NTSTATUS fsctl_set_cmprn(TALLOC_CTX *mem_ctx,
return status;
}
if ((fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) == 0) {
DEBUG(4, ("FS does not advertise compression support\n"));
return NT_STATUS_NOT_SUPPORTED;
}
ndr_ret = ndr_pull_struct_blob(in_input, mem_ctx, &cmpr_state,
(ndr_pull_flags_fn_t)ndr_pull_compression_state);
if (ndr_ret != NDR_ERR_SUCCESS) {
@ -116,15 +111,22 @@ static NTSTATUS fsctl_set_cmprn(TALLOC_CTX *mem_ctx,
return NT_STATUS_INVALID_PARAMETER;
}
status = SMB_VFS_SET_COMPRESSION(fsp->conn,
mem_ctx,
fsp,
cmpr_state.format);
if (!NT_STATUS_IS_OK(status)) {
return status;
status = NT_STATUS_NOT_SUPPORTED;
if (fsp->conn->fs_capabilities & FILE_FILE_COMPRESSION) {
status = SMB_VFS_SET_COMPRESSION(fsp->conn,
mem_ctx,
fsp,
cmpr_state.format);
} else if (cmpr_state.format == COMPRESSION_FORMAT_NONE) {
/*
* bso#12144: The underlying filesystem doesn't support
* compression. We should still accept set(FORMAT_NONE) requests
* (like WS2016 ReFS).
*/
status = NT_STATUS_OK;
}
return NT_STATUS_OK;
return status;
}
static NTSTATUS fsctl_zero_data(TALLOC_CTX *mem_ctx,