Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State...

36
Gluster Developers Summit ● March, 2013 Copyright © 2013 Christopher R. Hertel Samba VFS to libgfapi Samba VFS to libgfapi Driving the Backroads Driving the Backroads Christopher R. Hertel Samba Team Member

Transcript of Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State...

Page 1: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

Gluster Developers Summit ● March, 2013Copyright © 2013 Christopher R. Hertel

Samba VFS to libgfapiSamba VFS to libgfapi

Driving the BackroadsDriving the Backroads

Christopher R. HertelSamba Team Member

Page 2: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

22Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

IntroductionsIntroductions

Page 3: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

IntroductionsIntroductions

A ruminant mammal (Geekus geekus) with long legs, humped shoulders, and broadly palmated antlers.

Me

AuthorStorage ArchitectNetwork EngineerSMB Know-It-AllSamba Team Member(since '98)

Incurable Idealist

33Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Page 4: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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”.

Page 5: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

IntroductionsIntroductions

55Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

You

Page 6: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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

Page 7: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

IntroductionsIntroductionsA Note About Me

For good or ill, I have become...

TheThe source for SMBv1 documentation,

Purveyor of protocol pedanticism, and

Chronicler ofthe apopsicle.

77Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Page 8: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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

Page 9: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

IntroductionsIntroductionsLet me get this straight...

Microsoft contracted with

a Samba Team member

to producepublicly available

SMB protocolspecifications!?

Wait... What?99Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Page 10: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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)

Page 11: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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

Page 12: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated
Page 13: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

What's in a Name?What's in a Name?A Rose by Any Other NameA Rose by Any Other Name

Would Would Wither and DieWither and Die

1313Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

­­ Alan Swann (Peter O'Toole),   My Favorite Year

Page 14: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

What's in a Name?What's in a Name?

1414Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

SMBSMB: Server Message BlockOriginally, 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 SystemA 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 clusterand multipath features.

Page 15: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

What's in a Name?What's in a Name?

1515Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

SMBSMB = Server Message BlockDOS, 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.

Page 16: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

What's in a Name?What's in a Name?

1616Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Samba and CTDB

Samba Samba = SaMBaAn Open Source SMB server,

Full support of SMB1 (and older)Partial support of SMB2/3

Samba v4 is the current production branch.

CTDB CTDB = Cluster Trivial DatabaseA distributed key⇨value database,

Maintains Samba state acrossa clusterAlso provides IP failover

Page 17: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

What's in a Name?What's in a Name?

1717Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Sambais...

An SMB protocol engine, and...A semantic translation machine:

Different lockingDifferent access controlsDifferent timestampsDifferent just about everything

Samba has to translate fromWindows to POSIX and back again.

Page 18: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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 nodePersistent tables are updated atomicallyVolatile 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...

Page 19: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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

Page 20: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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

Page 21: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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 forWindows semantics

ACLs, Leases, etc.

Persistent Handles?

Page 22: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated
Page 23: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

Samba and Glusterand FUSE

Page 24: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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 againSamba expects POSIX behaviors:

Cache CoherencyPOSIX byte-range locking support

Samba also wants Linux FS features:Extended Attributes“POSIX” ACLsRichACLs (would be nice)

Page 25: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

Samba/Gluster/FUSESamba/Gluster/FUSE

2525Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Gluster

...is adaptable, and cool.Can add support forSMB-specific features:

Windows ACL supportOpLocks and LeasesCase-insensitive names

Can selectively enforcesemantics:

Share modesPreallocationOther stuff

There are possibilities to explore here.

Page 26: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

Samba/Gluster/FUSESamba/Gluster/FUSE

2626Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

FUSE

...presents a problem.A generic mount pointNo way to enable/disable per-access method features

Fuse provides a singlestandard interface, buteffectively locks awayGluster internals.

What's a coder to do?

Page 27: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated
Page 28: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

2828Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

The Samba VFS layerThe Samba VFS layer

Page 29: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

The Samba VFS LayerThe Samba VFS Layer

2929Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Samba is Built in Layers(conceptually)

SMB messages receivedand 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

Page 30: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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.

Page 31: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated
Page 32: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

3232Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Building a Samba VFSBuilding a Samba VFS

Page 33: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

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 addedVFS modules must be kept in sync with Samba releasesVFS developers need to coordinate with Samba developers

Page 34: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

??

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...

Page 35: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

3535Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013

Page 36: Samba VFS to libgfapi - Gluster › en › latest › ...Gluster Dev Summit – March 2013 20 State of the Art: SMB3 cluster features Scale-out Transparent Failover Client/server negotiated

The EndThe End

3636Gluster Dev Summit – March 2013Gluster Dev Summit – March 2013