26
INTRODUCE IN - KERNEL SMB3 SERVER CALLED CIFSD Namjae Jeon Samsung Electronics June 5, 2019

INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

  • Upload
    others

  • View
    11

  • Download
    0

Embed Size (px)

Citation preview

Page 1: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

INTRODUCE IN-KERNEL

SMB3 SERVER CALLED CIFSD

Namjae Jeon

Samsung Electronics

June 5, 2019

Page 2: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

About me

Linux kernel contributor since 2011

Co-Creator of Samsung internal NTFS Filesystem

Introduce collapse and insert range syscall

Creator and maintainer of linux-cifsd project

Page 3: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Topic

Introduction

Architecture

Components

Performance/Stability/Compatibility

Plan

Proposal

Page 4: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

What is cifsd ?

SMB Server for Linux kernel

Kernel and Userspace daemons

All SMB Ver. (SMB1 ~ SMB3.1.1)

Authentication

• NTLM

• NTLMv2

Performance feature

• Oplock/lease

• compound request

• Copy offload

Security feature

• Signing

• encryption

NFSganesha

NFS

SAMBA

KERNEL

USERSPACE

NFSD CIFS CIFSD?

Page 5: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

linux-cifsd project

Github Repo

• https://github.com/cifsd-team/cifsd

• https://github.com/cifsd-team/cifsd-tools

Mailing-list

[email protected]

5 active developers

SMB2 notify(In progress, Yunjae Lim)

SMBDirect (In progress, Hyunchul Lee)

Page 6: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Key Concepts

Can gain the performance in kernel ?

No system call (less TLB miss, less context switching)

Shorter path to use VFS and network functions in kernel

no duplicate memory allocation for inode and superblock

Page 7: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Key Concepts

Optimized SMB over RDMA support

Page 8: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Key Concepts

Simple/light file share for embedded device

Reported by Andy Walsh(OpenWRT)

Binary Size Main Extra Total

cifsd 128KB(cifsdkmod, tools)

61KB(crypto kmods) + 872KB(glib2)

1061KB

samba4 6MB(samba libs, server package)

64KB(libtirpc, etc)

6064KB

Page 9: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Key Concepts

Client 1 Client 2

Kernel Space SMB Server (CIFSD)(Uniform Address Space)

kcifsd/1

Open “File”

Open OK – Oplock granted

Open “File”

Oplock Break Request

Oplock Break Response

kcifsd/2

Global data

Open OK – Oplock granted

Client 1 Client 2

User Space SMB Server (SAMBA)

smbd/1 smbd/2

Open “File”

Open OK – Oplock granted

Open “File”IPC Message –Oplock Break Request

IPC Message –Oplock Break Done Open OK – Oplock granted

Oplock Break Request

Oplock Break Response

Different Address Space

Oplock/lease better handling(page 20)

Page 10: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Architecture

Separate kernel space and user space daemon Works related to performance in kernel space

Works related to non-performance in user space

Co-work cifsd and kcifsd in each space When cifsd is launched, kcifsd is activated

They exchange information necessary for each other

SMB Engine

SHARE MANAGEMENT

SERVER VFS

ID/PW MANAGEMENT

KERNEL

USER

DCERPC

Page 11: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Architecture

How to communicate between kernel and userspace Use Netlink interface

Specify a few commands

Name Purpose

CIFSD_EVENT_HEARTBEAT_REQUEST Monitor cifsd is alive

CIFSD_EVENT_STARTING_UPCIFSD_EVENT_SHUTTING_DOWN

Transfer the initial information necessary for the start and shutdown

CIFSD_EVENT_LOGIN_REQUESTCIFSD_EVENT_LOGIN_RESPONSE

Transfer the user account / password information necessary for login

CIFSD_EVENT_SHARE_CONFIG_REQUESTCIFSD_EVENT_SHARE_CONFIG_RESPONSE

Transfer the share configuration

CIFSD_EVENT_TREE_CONNECT_RESPONSECIFSD_EVENT_TREE_DISCONNECT_REQUEST

Transfer the tree connect info

CIFSD_EVENT_RPC_REQUESTCIFSD_EVENT_RPC_RESPONSE

Transfer DCERPC requests

Page 12: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Architecture

NETLINK/SYSFS Interface

SOCKET(445)

kcifsd/0 (forker thread)

kcifsd/2

kcifsd/1

kcifsd/N

NTLM NTLMv2

Kerberous

Authentication

SMB1 SMB2

SMB2.1

SMB3.1.1

SMB3

Dialects

VFS

Local Filesystem

CLIENT

cifsd

DCE/RPC

Share configuration ID/PW configuration

smb.conf (config file)

cifspwd.db (ID/PW file)cifsadmin

Page 13: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Architecture

NETLINK INTERFACE

SO

CKET

Virtu

al F

ilesy

stem

EXT4

XFS

NTFS

TRANSPORT TCP

TRANSPORT IPC

Oplock/lease

AUTH

VFS ABSTRACTION

SMB Engine VFS CACHE(File, INODE)

KERNEL

KCIFSD

KCIFSD Components

SERVER

Page 14: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Architecture

Minimum DCERPC implementation

The parameter format of smb.conf

compatible with samba’s one

Minimum implementation

List up of supported parameters in smb.conf.example

SMB1 is disable at default

Smart phone apps(ES File Explorer) support only SMB1

Can easily remove it when merging into mainline

Page 15: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Performance comparison

Tool : Iozone, fileop, bench-oplock(smbtorture)

Mount share tmpfs

Direct connection on two PC

Oplock / lease is disable

SMB client is a kernel cifs

Page 16: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Performance comparison

Record length (KB)

Single Writer Iozone Throught

0

20000

40000

60000

80000

100000

4 8 16 32 64 128

samba write

cifsd write

Kilo

byte

/se

co

nd

Page 17: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Performance comparison

0

10000

20000

30000

40000

50000

60000

70000

80000

90000

4 8 16 32 64 128

samba read

cifsd read

Record length (KB)

Single Reader Iozone Throught

Kilo

byte

/se

co

nd

Page 18: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Fileops Result

0

500

1000

1500

2000

2500

3000

3500

4000

4500

samba

cifsd

Op

s/s

eco

nd

Page 19: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

File lookup Performance(ls –l)

0

200

400

600

800

1000

1200

1400

1000 5000 10000 50000

samba

cifsd

Number of files

Tim

e (

mill

ise

co

nd

)

Page 20: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Bench oplock

0

200

400

600

800

1000

1200

1400

1600

1800

bench-oplock

samba

cifsd

Op

s/s

eco

nd

Page 21: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Compatibility

SMB CLIENT VERSIONS CIFSD SUPPORTED

Windows XP (SMB 1.0)

Windows Vista (SMB 2 .0)

Windows 7 (SMB 2.1)

Windows 8 (SMB 3.0)

Windows 10 (SMB 3.1.1)

MacOS(~ High Sierra)

Ubuntu File Explorer

Linux CIFS Client(linux 4.16)

Page 22: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Stability

95%

5%

SMB TORTURE(SMB2/3)

PASS

FAIL

97%

3

XFSTESTS(SMB2/3)

PASS

FAIL

Page 23: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Plan

SMB Direct Support (~ Sep)

Writing by Hyunchul Lee(LGE)

Share the status at SDC 2019

Oplock/Lease is enable at default

Send the patch-set to LKML(~ Sep)

Page 24: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Proposal

How about make kcifsd & samba running together ?

Page 25: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Proposal

Define new parameter in smb.conf

Kcifsd can be a kernel helper of samba

Use SMBDirect in kcifsd through ioctl or netlink

Page 26: INTRODUCE IN-KERNEL SMB3 SERVER CALLED CIFSD · User Space SMB Server (SAMBA) smbd/1 smbd/2 ... cifsd DCE/RPC Share configuration ID/PW configuration smb.conf (configfile) cifsadmin

Thank you!