Gluster Developers Summit ● March, 2013
Copyright © 2013 Christopher R. Hertel
Samba VFS to libgfapiSamba VFS to libgfapi
Driving the BackroadsDriving the Backroads
Christopher R. Hertel
Samba Team Member
22Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
IntroductionsIntroductions
IntroductionsIntroductions
A ruminant mammal (Geekus geekus) with long legs, humped shoulders, and broadly palmated antlers.
Me
Author
Storage Architect
Network Engineer
SMB Know-It-All
Samba Team Member
(since '98)
Incurable Idealist
33Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
IntroductionsIntroductions
44Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
The opinions expressed are my own
and not necessarily those of my
employer, my spouse, my childrenz,
the dog, or “the Voices”.
IntroductionsIntroductions
55Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
You
IntroductionsIntroductions
66Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Members of the Samba Team gather at the 10th
annual
Samba eXPerience conference in Göttingen, Germany.
Them
IntroductionsIntroductions
A Note About Me
For good or ill, I have 
become...
TheThe source for 
SMBv1 
documentation,
Purveyor of 
protocol 
pedanticism, and
Chronicler of
the apopsicle.
77Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
IntroductionsIntroductions
[MS­CIFS]
Covers SMB/CIFS as 
implemented in 
Windows NT and 98.
[MS­SMB] (revised)
Rewritten to reference 
[MS­CIFS].
Details changes from 
NT4 to W2K through 
W2K12 & Win 8.
Lead author of two SMBv1 protocol 
specifications, published by Microsoft:
88Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
IntroductionsIntroductions
Let me get this straight...
Microsoft contracted with
a Samba Team member
to produce
publicly available
SMB protocol
specifications!?
Wait... What?
99Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
IntroductionsIntroductions
1010Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Where are we going?
Overview of SMB and Samba
Samba and Gluster and FUSE, oh my
The Samba VFS layer
Building Samba VFS modules
Missing Pieces
Questions
(and answers, if I have any)
IntroductionsIntroductions
1111Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Where we are not going:
We won't go into libgfapi internals
I rely on others for libgfapi know-how
What's in a Name?What's in a Name?
A Rose by Any Other NameA Rose by Any Other Name
WouldWould
Wither and DieWither and Die
1313Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
­­ Alan Swann (Peter O'Toole),
   My Favorite Year
What's in a Name?What's in a Name?
1414Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
SMBSMB: Server Message Block
Originally, a simple network file protocol
created by IBM. It grew, over time, to include
75 primary commands and an unbounded
number of secondary commands.
CIFSCIFS: Common Internet File System
A 1990's marketing upgrade. CIFS is just
another name for SMB1. Microsoft officially
dropped the CIFS name in 2012.
SMB1SMB1: A new name for SMB, as implemented in
Windows NT and still used in Windows today.
SMB2SMB2: A new protocol intended to eventually replace
SMB1. SMB2.0 was included in Windows
Vista. SMB2.1 in W2K8r2 and Windows7.
SMB3SMB3: Just another dialect of SMB2 (specifically
SMB2.2). SMB3 adds support for cluster
and multipath features.
What's in a Name?What's in a Name?
1515Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
SMBSMB = Server Message Block
DOS, OS/2, and Windows
CIFSCIFS == SMB1
SMB1SMB1 = SMB on Windows,
starting with NT
SMB2SMB2 = New SMB,
introduced in Vista
SMB2.0 = Vista
SMB2.1 = Win7 / W2K8r2
SMB3SMB3 = SMB2.2 = Win8 / W2012
The naming is confuzzeling. Keep these charts handy.
What's in a Name?What's in a Name?
1616Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Samba and CTDB
SambaSamba = SaMBa
An Open Source SMB server,
Full support of SMB1 (and older)
Partial support of SMB2/3
Samba v4 is the current production
branch.
CTDBCTDB = Cluster Trivial Database
A distributed key⇨value database,
Maintains Samba state across
a cluster
Also provides IP failover
What's in a Name?What's in a Name?
1717Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Samba
is...
An SMB protocol engine, and...
A semantic translation machine:
Different locking
Different access controls
Different timestamps
Different just about everything
Samba has to translate from
Windows to POSIX and back again.
What's in a Name?What's in a Name?
1818Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
CTDB is...
A Distributed DatabaseA Distributed Database
Tables are replicated on every node
Persistent tables are updated atomically
Volatile tables use a token-passing
scheme; the “owner” has current data:
data will be lost when a node crashes
...and that's okay!
In theory,
CTDB's functionality could be replaced...
What's in a Name?What's in a Name?
1919Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
State of the Art:
Samba and SMB2/3
Samba has full support for SMB1
Samba can negotiate SMB2
SMB2 features are limited
SMB3 cluster features are missing
What's in a Name?What's in a Name?
2020Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
State of the Art:
SMB3 cluster features
Scale-out
Transparent Failover
Client/server negotiated
CTDB does not yet support failover
CTDB (or its replacement) must support
SMB3 Persistent Handles
What's in a Name?What's in a Name?
2121Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
SummarySummary
What we need from Samba:
SMB3 cluster features
What we need from CTDB:
Persistent handle support
What we need from Gluster:
Internal support for
Windows semantics
ACLs, Leases, etc.
Persistent Handles?
Samba and Gluster
and FUSE
Samba/Gluster/FUSESamba/Gluster/FUSE
2424Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
“Samba is a semantic translation machine”
—We said that already
Samba translates from Windows to
POSIX and back again
Samba expects POSIX behaviors:
Cache Coherency
POSIX byte-range locking support
Samba also wants Linux FS features:
Extended Attributes
“POSIX” ACLs
RichACLs (would be nice)
Samba/Gluster/FUSESamba/Gluster/FUSE
2525Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Gluster
...is adaptable, and cool.
Can add support for
SMB-specific features:
Windows ACL support
OpLocks and Leases
Case-insensitive names
Can selectively enforce
semantics:
Share modes
Preallocation
Other stuff
There are possibilities to explore here.
Samba/Gluster/FUSESamba/Gluster/FUSE
2626Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
FUSE
...presents a problem.
A generic mount point
No way to enable/disable per-access
method features
Fuse provides a single
standard interface, but
effectively locks away
Gluster internals.
What's a coder to do?
2828Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
The Samba VFS layerThe Samba VFS layer
The Samba VFS LayerThe Samba VFS Layer
2929Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Samba is Built in Layers
(conceptually)
SMB messages received
and parsed
(Non-FS commands are
handled elsewhere)
Call the VFS layer
The final VFS module talks to
the File System
Upper layers may bypass
lower layers
The Samba VFS LayerThe Samba VFS Layer
3030Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
If there's no real File System,
bypass the lower VFS layers
All VFS calls must be implemented
(possibly returning ENOTSUP)
to avoid errors.
3232Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Building a Samba VFSBuilding a Samba VFS
The Samba VFS LayerThe Samba VFS Layer
3333Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
There is a guide:
Writing a Samba VFS by Richard Sharpe
Unfortunately...
The Samba VFS Interface changes as new
features are added
VFS modules must be kept in sync with
Samba releases
VFS developers need to coordinate with
Samba developers
??
3434Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
Example code and such was s'posed to go here.
I'll work out a good place to put the code and we'll start a project...
3535Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
The EndThe End
3636Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Smb gluster devmar2013

  • 1.
    Gluster Developers Summit● March, 2013 Copyright © 2013 Christopher R. Hertel Samba VFS to libgfapiSamba VFS to libgfapi Driving the BackroadsDriving the Backroads Christopher R. Hertel Samba Team Member
  • 2.
    22Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 IntroductionsIntroductions
  • 3.
    IntroductionsIntroductions A ruminant mammal(Geekus geekus) with long legs, humped shoulders, and broadly palmated antlers. Me Author Storage Architect Network Engineer SMB Know-It-All Samba Team Member (since '98) Incurable Idealist 33Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
  • 4.
    IntroductionsIntroductions 44Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 The opinions expressed are my own and not necessarily those of my employer, my spouse, my childrenz, the dog, or “the Voices”.
  • 5.
    IntroductionsIntroductions 55Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 You
  • 6.
    IntroductionsIntroductions 66Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 Members of the Samba Team gather at the 10th annual Samba eXPerience conference in Göttingen, Germany. Them
  • 7.
    IntroductionsIntroductions A Note AboutMe For good or ill, I have  become... TheThe source for  SMBv1  documentation, Purveyor of  protocol  pedanticism, and Chronicler of the apopsicle. 77Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
  • 8.
  • 9.
    IntroductionsIntroductions Let me getthis straight... Microsoft contracted with a Samba Team member to produce publicly available SMB protocol specifications!? Wait... What? 99Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013
  • 10.
    IntroductionsIntroductions 1010Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 Where are we going? Overview of SMB and Samba Samba and Gluster and FUSE, oh my The Samba VFS layer Building Samba VFS modules Missing Pieces Questions (and answers, if I have any)
  • 11.
    IntroductionsIntroductions 1111Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 Where we are not going: We won't go into libgfapi internals I rely on others for libgfapi know-how
  • 13.
    What's in aName?What's in a Name? A Rose by Any Other NameA Rose by Any Other Name WouldWould Wither and DieWither and Die 1313Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 ­­ Alan Swann (Peter O'Toole),    My Favorite Year
  • 14.
    What's in aName?What's in a Name? 1414Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 SMBSMB: Server Message Block Originally, a simple network file protocol created by IBM. It grew, over time, to include 75 primary commands and an unbounded number of secondary commands. CIFSCIFS: Common Internet File System A 1990's marketing upgrade. CIFS is just another name for SMB1. Microsoft officially dropped the CIFS name in 2012. SMB1SMB1: A new name for SMB, as implemented in Windows NT and still used in Windows today. SMB2SMB2: A new protocol intended to eventually replace SMB1. SMB2.0 was included in Windows Vista. SMB2.1 in W2K8r2 and Windows7. SMB3SMB3: Just another dialect of SMB2 (specifically SMB2.2). SMB3 adds support for cluster and multipath features.
  • 15.
    What's in aName?What's in a Name? 1515Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 SMBSMB = Server Message Block DOS, OS/2, and Windows CIFSCIFS == SMB1 SMB1SMB1 = SMB on Windows, starting with NT SMB2SMB2 = New SMB, introduced in Vista SMB2.0 = Vista SMB2.1 = Win7 / W2K8r2 SMB3SMB3 = SMB2.2 = Win8 / W2012 The naming is confuzzeling. Keep these charts handy.
  • 16.
    What's in aName?What's in a Name? 1616Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 Samba and CTDB SambaSamba = SaMBa An Open Source SMB server, Full support of SMB1 (and older) Partial support of SMB2/3 Samba v4 is the current production branch. CTDBCTDB = Cluster Trivial Database A distributed key⇨value database, Maintains Samba state across a cluster Also provides IP failover
  • 17.
    What's in aName?What's in a Name? 1717Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 Samba is... An SMB protocol engine, and... A semantic translation machine: Different locking Different access controls Different timestamps Different just about everything Samba has to translate from Windows to POSIX and back again.
  • 18.
    What's in aName?What's in a Name? 1818Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 CTDB is... A Distributed DatabaseA Distributed Database Tables are replicated on every node Persistent tables are updated atomically Volatile tables use a token-passing scheme; the “owner” has current data: data will be lost when a node crashes ...and that's okay! In theory, CTDB's functionality could be replaced...
  • 19.
    What's in aName?What's in a Name? 1919Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 State of the Art: Samba and SMB2/3 Samba has full support for SMB1 Samba can negotiate SMB2 SMB2 features are limited SMB3 cluster features are missing
  • 20.
    What's in aName?What's in a Name? 2020Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated CTDB does not yet support failover CTDB (or its replacement) must support SMB3 Persistent Handles
  • 21.
    What's in aName?What's in a Name? 2121Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 SummarySummary What we need from Samba: SMB3 cluster features What we need from CTDB: Persistent handle support What we need from Gluster: Internal support for Windows semantics ACLs, Leases, etc. Persistent Handles?
  • 23.
  • 24.
    Samba/Gluster/FUSESamba/Gluster/FUSE 2424Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 “Samba is a semantic translation machine” —We said that already Samba translates from Windows to POSIX and back again Samba expects POSIX behaviors: Cache Coherency POSIX byte-range locking support Samba also wants Linux FS features: Extended Attributes “POSIX” ACLs RichACLs (would be nice)
  • 25.
    Samba/Gluster/FUSESamba/Gluster/FUSE 2525Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 Gluster ...is adaptable, and cool. Can add support for SMB-specific features: Windows ACL support OpLocks and Leases Case-insensitive names Can selectively enforce semantics: Share modes Preallocation Other stuff There are possibilities to explore here.
  • 26.
    Samba/Gluster/FUSESamba/Gluster/FUSE 2626Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 FUSE ...presents a problem. A generic mount point No way to enable/disable per-access method features Fuse provides a single standard interface, but effectively locks away Gluster internals. What's a coder to do?
  • 28.
    2828Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 The Samba VFS layerThe Samba VFS layer
  • 29.
    The Samba VFSLayerThe Samba VFS Layer 2929Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 Samba is Built in Layers (conceptually) SMB messages received and parsed (Non-FS commands are handled elsewhere) Call the VFS layer The final VFS module talks to the File System Upper layers may bypass lower layers
  • 30.
    The Samba VFSLayerThe Samba VFS Layer 3030Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 If there's no real File System, bypass the lower VFS layers All VFS calls must be implemented (possibly returning ENOTSUP) to avoid errors.
  • 32.
    3232Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 Building a Samba VFSBuilding a Samba VFS
  • 33.
    The Samba VFSLayerThe Samba VFS Layer 3333Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013 There is a guide: Writing a Samba VFS by Richard Sharpe Unfortunately... The Samba VFS Interface changes as new features are added VFS modules must be kept in sync with Samba releases VFS developers need to coordinate with Samba developers
  • 34.
    ?? 3434Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013 Example code and such was s'posed to go here. I'll work out a good place to put the code and we'll start a project...
  • 35.
    3535Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013
  • 36.
    The EndThe End 3636Gluster Dev Summit– March 2013Gluster Dev Summit – March 2013