Patch to add support for advertising FULLSYNC to Mac OSX Clients
Kevin Anderson
andersonkw2 at gmail.com
Tue May 30 23:39:40 UTC 2017
Ralph/Jeremy,
I have rebased the patch to apply cleanly on the current master branch which included changing the variable name. Other than that, this patch has been running fine from what I can tell. I've had multiple people ping me on the status of getting this merged. Do you have any objections to merging this?
I have attached the rebased patch which can also be found at https://github.com/samba-team/samba/pull/64.
Thanks,
Kevin Anderson
-------------- next part --------------
>From f9e03c8cea78d0563e0bba5d5c4e33d17d05e3ed Mon Sep 17 00:00:00 2001
From: Kevin Anderson <andersonkw2 at gmail.com>
Date: Fri, 21 Apr 2017 10:07:56 -0400
Subject: [PATCH] Rebase from master and with the latest patch on the mailing
list
This rebases the branch from master and uses the latest patch
on the mainling list.
- Changes the Fullsync options to time machine
- Configures share options automatically upon TM enablement
---
docs-xml/manpages/vfs_fruit.8.xml | 32 ++++++++++++++++++++++++++++++++
libcli/smb/smb2_create_ctx.h | 1 +
source3/modules/vfs_fruit.c | 16 ++++++++++++++++
3 files changed, 49 insertions(+)
diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index 0bddd4aea1a..32d8b725630 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -205,6 +205,38 @@
</varlistentry>
<varlistentry>
+ <term>fruit:time machine = [ yes | no ]</term>
+ <listitem>
+ <para>Controls if Time Machine support via the FULLSYNC volume
+ capability is advertised to clients.</para>
+ <itemizedlist>
+ <listitem><para><command>no (default)</command> Disables
+ advertising Time Machine support and the FULLSYNC volume
+ capability to clients.</para></listitem>
+
+ <listitem><para><command>yes</command> - Enables advertising
+ Time Machine support and the FULLSYNC volume capability to
+ clients. This is necessary for supporting Time Machine backups
+ from Mac OSX clients. This value advertises the capability
+ and with the options below, fsync's a file at the request of
+ the client.
+ </para></listitem>
+
+ </itemizedlist>
+
+ <para>This option enforces the following settings per share (or
+ for all shares if enabled globally):</para>
+ <itemizedlist>
+ <listitem><para><command>durable handles = yes</command></para></listitem>
+ <listitem><para><command>kernel oplocks = no</command></para></listitem>
+ <listitem><para><command>kernel share modes = no</command></para></listitem>
+ <listitem><para><command>posix locking = no</command></para></listitem>
+ </itemizedlist>
+
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
<term>fruit:metadata = [ stream | netatalk ]</term>
<listitem>
<para>Controls where the OS X metadata stream is stored:</para>
diff --git a/libcli/smb/smb2_create_ctx.h b/libcli/smb/smb2_create_ctx.h
index cb194f5c536..0e0b713e55c 100644
--- a/libcli/smb/smb2_create_ctx.h
+++ b/libcli/smb/smb2_create_ctx.h
@@ -42,5 +42,6 @@
/* "AAPL" Volume Capabilities bitmap */
#define SMB2_CRTCTX_AAPL_SUPPORT_RESOLVE_ID 1
#define SMB2_CRTCTX_AAPL_CASE_SENSITIVE 2
+#define SMB2_CRTCTX_AAPL_FULL_SYNC 4
#endif
diff --git a/source3/modules/vfs_fruit.c b/source3/modules/vfs_fruit.c
index 7bc259bf352..9151ca9aff9 100644
--- a/source3/modules/vfs_fruit.c
+++ b/source3/modules/vfs_fruit.c
@@ -137,6 +137,7 @@ struct fruit_config_data {
bool veto_appledouble;
bool posix_rename;
bool aapl_zero_file_id;
+ bool time_machine;
/*
* Additional options, all enabled by default,
@@ -1606,6 +1607,9 @@ static int init_fruit_config(vfs_handle_struct *handle)
config->use_aapl = lp_parm_bool(
-1, FRUIT_PARAM_TYPE_NAME, "aapl", true);
+ config->time_machine = lp_parm_bool(
+ -1, FRUIT_PARAM_TYPE_NAME, "time machine", false);
+
config->unix_info_enabled = lp_parm_bool(
-1, FRUIT_PARAM_TYPE_NAME, "nfs_aces", true);
@@ -2260,6 +2264,10 @@ static NTSTATUS check_aapl(vfs_handle_struct *handle,
break;
}
+ if (config->time_machine) {
+ caps |= SMB2_CRTCTX_AAPL_FULL_SYNC;
+ }
+
SBVAL(p, 0, caps);
ok = data_blob_append(req, &blob, p, 8);
@@ -2688,6 +2696,14 @@ static int fruit_connect(vfs_handle_struct *handle,
"0x0d:0xf00d");
}
+ if (config->time_machine) {
+ lp_do_parameter(SNUM(handle->conn), "durable handles", "yes");
+ lp_do_parameter(SNUM(handle->conn), "kernel oplocks", "no");
+ lp_do_parameter(SNUM(handle->conn), "kernel share modes", "no");
+ lp_do_parameter(SNUM(handle->conn), "strict sync", "yes");
+ lp_do_parameter(SNUM(handle->conn), "posix locking", "no");
+ }
+
return rc;
}
More information about the samba-technical
mailing list