[PATCH 0/5] ksmbd: add macOS Time Machine / AAPL SMB2 extension support

"Gaël Blivet-Bailly" <[email protected]>
Newsgroups org.kernel.vger.linux-cifs
Message-ID <[email protected]>
From: Gael Blivet <[email protected]>

ksmbd currently doesn't implement any of the Apple "AAPL" SMB2
extensions. Without them, macOS Time Machine backups over SMB do not
work at all. This series adds enough of the extension to fix that.

The underlying logic was built and live-tested against a real Time
Machine backup and everyday Finder use over several days on an
earlier baseline. This series is a careful re-derivation against
ksmbd-for-next-next -- verified to build cleanly and pass
checkpatch.pl --strict, but not independently re-tested against this
exact tree.

Everything here is scoped to shares with the new
KSMBD_SHARE_FLAG_TIME_MACHINE flag, not enabled globally: the AAPL
extension is undocumented and reverse-engineered from observed
client/server behavior (cross-checked against Samba's vfs_fruit
module and the Apple Time Machine over SMB spec[1] where possible),
so this keeps the blast radius contained to shares that explicitly
opt in.

Patch 1 builds on top of the AAPL groundwork already in this tree:
`fs/smb/common/smb2pdu.h` already has the SMB2_CRTCTX_AAPL_* constant
definitions (added recently, currently unused anywhere), and
`conn->is_aapl` detection already exists for an unrelated narrow
purpose (reporting UniqueId=0 to Mac clients). This series reuses
both rather than introducing a parallel/competing implementation.

Patch order matters: 2-5 depend on the AAPL negotiation and
conn->aapl_readdir_attr flag added in patch 1.

[1] https://developer.apple.com/library/archive/releasenotes/NetworkingInternetWeb/Time_Machine_SMB_Spec/

Gael Blivet (5):
  ksmbd: add Apple AAPL kAAPL_SERVER_QUERY create context support
  ksmbd: synthesize empty AFP_AfpInfo xattr on first probe
  ksmbd: send inline FinderInfo in FIND responses when READDIR_ATTR
    negotiated
  ksmbd: defer CHANGE_NOTIFY completion instead of
    STATUS_NOT_IMPLEMENTED
  ksmbd: implement full-file copy for AAPL ChunkCount=0 COPYCHUNK

 fs/smb/common/smbglob.h       |   1 +
 fs/smb/server/connection.h    |   1 +
 fs/smb/server/ksmbd_netlink.h |   4 +-
 fs/smb/server/ksmbd_work.c    |   1 +
 fs/smb/server/ksmbd_work.h    |   2 +
 fs/smb/server/oplock.c        |  73 +++++++++
 fs/smb/server/oplock.h        |   1 +
 fs/smb/server/server.h        |   2 +
 fs/smb/server/smb2ops.c       |   4 +
 fs/smb/server/smb2pdu.c       | 275 +++++++++++++++++++++++++++++++---
 fs/smb/server/smb2pdu.h       |  60 ++++++++
 fs/smb/server/transport_ipc.c |   9 ++
 fs/smb/server/vfs.c           |  41 +++++
 fs/smb/server/vfs_cache.c     |  30 ++++
 fs/smb/server/vfs_cache.h     |   6 +
 15 files changed, 487 insertions(+), 23 deletions(-)

-- 
2.43.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.