《SNIA-SDC23-Lendecke-Reparse-Points-in-SMB.pdf》由会员分享,可在线阅读,更多相关《SNIA-SDC23-Lendecke-Reparse-Points-in-SMB.pdf(12页珍藏版)》请在三个皮匠报告上搜索。
1、Reparse Points in SMBStorage Developer Conference 2023FremontVolker LendeckeSamba Team/SerNet2023-09-20SMB3 Posix ExtensionsMake SMB a competitor to NFSExtend SMB with behavior Posix clients expectClient can ask for Posix Extensions in NegProt requestNew negotiate contextFile Name handlingCase Sensi
2、tive,no reserved names and streamsNew Posix Create ContextPosix MetadataNew file information classpermissions,ownership,all of struct statThis talk is NOT about any of thishttps:/codeberg.org/SMB3UNIX by David MulderVolker LendeckeReparse Points(2/12)File types in SUSV4Opengroup defines 7 types of f
3、ilesS IFBLK Block special.S IFCHR Character special.S IFIFO FIFO special.S IFREG Regular.S IFDIR Directory.S IFLNK Symbolic link.S IFSOCK Socket.SMB3 in Samba handles S IFREG and S DIR well.What about the others?Volker LendeckeReparse Points(3/12)Sambas role for Posix special filesSamba has to prese
4、nt special files it finds to clientsNormal files and directories are taken care ofFIFOs are broken right nowClients can open a FIFO,but read/write failsSamba removed SMB VFS READ and SMB VFS WRITEFIFOs dont like pread/pwriteSockets only work for named pipe(MS-RPC)servers,such assamba-dcerpcdBlock an
5、d character devices dont make sense over SMB,but shouldbe visible for clients to use locallyVolker LendeckeReparse Points(4/12)NTFS reparse pointsWikipedia:Reparse points provide a way to extend the NTFSfilesystem.A reparse point contains a reparse tag and data that areinterpreted by a filesystem fi
6、lter driver identified by the tag.Applications can set an arbitrary blob as a reparse pointWhen opening a file,NTFS filters can interpret the contentsA reparse point not handled by any filter givesSTATUS IO REPARSE TAG NOT HANDLEDMS-FSCC defines a few dozen reparse tags,most of them as“notmeaningful
7、 over the wire”SMB clients can still access them,“not meaningful over the wire”just means“we wont document them”Volker LendeckeReparse Points(5/12)Windows Subsystem for LinuxWSL v1 used NTFS to represent Linux special filesIO REPARSE TAG AF UNIX used for socketsIO REPARSE TAG LX BLK,CHR FIFO for the
8、 obvious LinuxcounterpartsNone of them are documentedWSL v2 uses ext4 on a block device,it does not need NTFS reparsepoints anymoreVolker LendeckeReparse Points(6/12)Windows NFS ServerOnce you install the Windows NFS server,the Properties of adirectory offer“NFS Sharing”next to“Sharing”Windows NFS e
9、xports normal NTFS files and directoriesIt has to store the NFS special files somewhereMS-FSCC defines IO REPARSE TAG NFS to be used by the NFSserver.Also“not meaningful over the wire”,but.2.1.2.6 defines NFS SPECFILE LNK and others for BLK,CHR,FIFOand SOCK.BLK and CHR have 32-bit major and minor nu
10、mbers as dataSYMLINK has the target as Unicode(UTF-16)Windows properties show“L”for all reparse points created over NFSVolker LendeckeReparse Points(7/12)WSL vs NFS reparse pointsWSL defines distinct reparse tags per typeFormat is undocumented,although probably not rocket science to findoutNFS only
11、uses one reparse tagDistinguishes object types within the reparse point contentsPro NFS:Documentation availableProtocol-Level tests with NFS possiblemkfifo over SMB will create a valid entry for NFS to serve a FIFOPro WSL:NFS reparse points require another round-trip when listing a directoryQUERY DI
12、RECTORY gives the reparse tag,with WSL thats sufficient forFIFOs and SOCKsMy vote:Use NFS reparse tags due to their interop storyVolker LendeckeReparse Points(8/12)SymlinksWith symlinks,we have 3 optionsWSL IO REPARSE TAG LX SYMLINKNFS NFS SPECFILE LNKNative NTFS IO REPARSE TAG SYMLINKIO REPARSE TAG
13、 SYMLINK is the only one properly interpreted by theSMB serverTrying to cross a symlink when opening a file givesNT STATUS STOPPED ON SYMLINKAdditional error information shows symlink targetEasy to follow symlinks client-sideSamba should present existing symlinks as IO REPARSE TAG SYMLINKand return
14、NT STATUS STOPPED ON SYMLINKVolker LendeckeReparse Points(9/12)Creating special files over SMBTwo steps:Just create a file with OPEN REPARSE POINTIssue FSCTL SET REPARSE POINT to set the content blobsmbd does the same:Create files with REPARSE POINT attributeSecurity:You dont want to create a block
15、device with 777 permissionsSemantics:You cant turn a file atomically into anything elseVolker LendeckeReparse Points(10/12)Status/Next steps?Most of the server code is in MR2887How and when to activate server-side code?Bind NT STATUS STOPPED ON SYMLINK to follow symlinks=no?Set follow symlinks=no on
16、 SMB3 Posix opens?How to deal with(currently broken)FIFOs?Always report as reparse points?Other special files?Incomplete:Reparse points over SMB1Chicken-and-Egg problem:We dont have clients yetRight now working on libsmbclient to include in user-space clients(KIO,gvfs)Volker LendeckeReparse Points(11/12)Thanks for your attentionvlsamba.org/vlsernet.dehttps:/www.sernet.de/https:/www.samba.org/Volker LendeckeReparse Points(12/12)