[PATCH v6] File Server Remote VSS Protocol server

David Disseldorp ddiss at suse.de
Tue Mar 31 04:00:48 MDT 2015

This patch-set adds a new File Server Remote VSS (Volume Shadow Copy
Service) Protocol server, test infrastructure, documentation, and
corresponding VFS layer changes to handle remote share snapshot

FSRVP clients, including Samba's rpcclient utility, can request the
creation of a remote share snapshot using a sequence of operations as
documented in the MS-FSRVP[1] specification (§4 Protocol examples). E.g.
- IsPathSupported to query if the share is supported by the server for
  shadow copy operations.
  + Samba handles this request by calling the new snap_check_path() VFS
    hook, to check whether the underlying FS supports snapshots on the
    corresponding share path.
- SetContext to set the context of subsequent shadow copy operations.
- StartShadowCopySet to initiate a new shadow copy set on the server.
- AddToShadowCopySet to add a share to the shadow copy set.
  + Persistent FSRVP server state is stored by Samba in srv_fss.tdb.
- PrepareShadowCopySet  to prepare the shadow copy set.
- CommitShadowCopySet to commit a shadow copy set.
  + Samba handles this request by calling the new snap_create() VFS
    hook for each shadow copy in the set.
- ExposeShadowCopySet to expose all the shadow copies in a shadow copy
  set as file shares.
  + Samba uses the registry smb.conf back-end to dynamically expose
    snapshot shares, using configuration parameters and share ACLs
    cloned from the base share.

vfs_btrfs and vfs_snapper changes are included to perform snapshot
creation and deletion for Btrfs subvolumes.
A new vfs_shell_snap module is additionally provided, which allows for
the execution of arbitrary commands when handling snapshot requests.
This module is used during selftest, ensuring that FSRVP snapshot
and FSCTL_SRV_ENUM_SNAPS requests are tested by autobuild.

This implementation varies slightly from previous prototype code posted
and demoed at SambaXP, in that:
- Snapshot creation and deletion requests are handled and dispatched
  through the VFS in a synchronous manner for the following reasons:
  + MS-FSVRP states: At any given time, Windows servers allow only one
    shadow copy set to be going through the creation process.
  + Asynchronous DCE/RPC server support requires intrusive changes to
    many core components within Samba, and a suitable architecture
    hasn't yet been agreed upon.
- mgmt (Remote Management Interface) RPC server support is not included.
  I still need to address some minor concerns raised by Metze when I
  posted the mgmt server code previously[2].
  + The Windows diskshadow.exe FSRVP client requires mgmt RPC server
    support. The Samba rpcclient FSRVP client does not.

Feedback appreciated.

Cheers, David

1. Microsoft MS-FSRVP specification

2. Mgmt server patch-set


Changes since V5:
- Add documented "fss: prune stale" and "fss: sequence timeout" FSRVP
  parameters to python/samba/tests/docs.py to ignore testparm mismatch.

Changes since V4:
- Remove unnecessary torture/rpc/proto.h include from torture/local

Changes since V3 (thanks Jeremy):
- Fix snapper_create_snap_pack() error path cleanup
- Zero FSRVP server sequence timer after free

Changes since V2 (thanks to Volker & Justin for their feedback):
- Use IDL for FSRVP server on-disk state marshalling and unmarshalling
- Use callbacks for state retrieval, making DB version upgrade less
- Simplify FSRVP state build dependency for server and smbtorture
- Fix minor formatting issues
- Use strlcpy instead of strncpy in vfs_btrfs, and check for truncation

Changes since V1 (thanks to Jeremy for his feedback):
- Fix errno retention around btrfs snapshot ioctls
- Check for dirname and basename in libreplace
  + build vfs_btrfs conditionally
- Use wide char string routines for '\\' matching
- Rebase against current master branch

The following changes since commit bdf0a81006534348996a27207e0f712646bf39b5:

  waf: Remove 'linkflags.remove(x)' line added in error. (2015-03-31 04:32:52 +0200)

are available in the git repository at:

  git://git.samba.org/ddiss/samba.git fsrvp_srv_v6

for you to fetch changes up to 254871a05dffa91c2c2ae18d636695d692ff6bb3:

  selftest: run the FSRVP test suite against s3fs (2015-03-31 11:30:07 +0200)

David Disseldorp (15):
      librpc: add FSRVP server state idl
      fsrvp: add server state storage back-end
      torture: add local FSRVP server state tests
      vfs: add snapshot create/delete hooks
      replace: check for dirname() and basename()
      vfs_btrfs: add snapshot create/delete calls
      vfs_snapper: create/delete snapshot support
      fsrvp: add remote snapshot RPC server
      doc: "prune stale" and "sequence timeout" fssd parameters
      doc: explain vfs_snapper remote snapshot configuration
      doc: explain vfs_btrfs remote snapshot configuration
      vfs: add vfs_shell_snap module
      doc: add vfs_shell_snap manpage
      selftest: add snapshot share configuration
      selftest: run the FSRVP test suite against s3fs

Noel Power (1):
      fsrvp: prune shadow copies if associated path doesn't exist

 docs-xml/manpages/vfs_btrfs.8.xml             |   54 +-
 docs-xml/manpages/vfs_full_audit.8.xml        |    3 +
 docs-xml/manpages/vfs_shell_snap.8.xml        |  155 ++
 docs-xml/manpages/vfs_snapper.8.xml           |   33 +-
 docs-xml/smbdotconf/misc/fssprunestale.xml    |   16 +
 .../smbdotconf/misc/fsssequencetimeout.xml    |   16 +
 docs-xml/smbdotconf/misc/rpcdaemon.xml        |    7 +-
 docs-xml/wscript_build                        |    1 +
 examples/VFS/skel_opaque.c                    |   30 +
 examples/VFS/skel_transparent.c               |   32 +
 lib/replace/wscript                           |    3 +-
 librpc/idl/fsrvp_state.idl                    |   36 +
 librpc/idl/wscript_build                      |    3 +-
 librpc/wscript_build                          |    5 +
 python/samba/tests/docs.py                    |    2 +-
 selftest/knownfail                            |    1 +
 selftest/selftesthelpers.py                   |    1 +
 selftest/skip                                 |    1 -
 selftest/target/Samba3.pm                     |   18 +
 source3/include/vfs.h                         |   31 +
 source3/include/vfs_macros.h                  |   15 +
 source3/modules/vfs_btrfs.c                   |  320 +++
 source3/modules/vfs_default.c                 |   30 +
 source3/modules/vfs_full_audit.c              |   56 +-
 source3/modules/vfs_shell_snap.c              |  201 ++
 source3/modules/vfs_snapper.c                 |  586 ++++++
 source3/modules/vfs_time_audit.c              |   76 +-
 source3/modules/wscript_build                 |    8 +
 source3/rpc_server/fss/srv_fss_agent.c        | 1767 +++++++++++++++++
 source3/rpc_server/fss/srv_fss_agent.h        |   26 +
 source3/rpc_server/fss/srv_fss_private.h      |   92 +
 source3/rpc_server/fss/srv_fss_state.c        |  699 +++++++
 source3/rpc_server/fssd.c                     |  225 +++
 source3/rpc_server/rpc_config.c               |    4 +-
 source3/rpc_server/rpc_config.h               |    4 +-
 source3/rpc_server/wscript_build              |   14 +
 source3/selftest/tests.py                     |    1 +
 source3/smbd/server.c                         |    7 +
 source3/smbd/vfs.c                            |   33 +
 source3/wscript                               |    5 +-
 source3/wscript_build                         |    2 +-
 source4/torture/local/fsrvp_state.c           |  494 +++++
 source4/torture/local/local.c                 |    1 +
 source4/torture/local/wscript_build           |    5 +-
 44 files changed, 5097 insertions(+), 22 deletions(-)
 create mode 100644 docs-xml/manpages/vfs_shell_snap.8.xml
 create mode 100644 docs-xml/smbdotconf/misc/fssprunestale.xml
 create mode 100644 docs-xml/smbdotconf/misc/fsssequencetimeout.xml
 create mode 100644 librpc/idl/fsrvp_state.idl
 create mode 100644 source3/modules/vfs_shell_snap.c
 create mode 100644 source3/rpc_server/fss/srv_fss_agent.c
 create mode 100644 source3/rpc_server/fss/srv_fss_agent.h
 create mode 100644 source3/rpc_server/fss/srv_fss_private.h
 create mode 100644 source3/rpc_server/fss/srv_fss_state.c
 create mode 100644 source3/rpc_server/fssd.c
 create mode 100644 source4/torture/local/fsrvp_state.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fsrvp_srv_v6.patchset
Type: text/x-patch
Size: 193774 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150331/4cdf3980/attachment-0001.bin>

More information about the samba-technical mailing list