Skip to content

Instantly share code, notes, and snippets.

@mem
Created May 30, 2019 17:57
Show Gist options
  • Save mem/bb549849e2afccb878bfb79359cbe0df to your computer and use it in GitHub Desktop.
Save mem/bb549849e2afccb878bfb79359cbe0df to your computer and use it in GitHub Desktop.
Description of generic mount flow
@startuml
autonumber
hide footbox
participant "wrapper\n(stage 2)" as wrapper
participant "stage 1" as stage_1
participant master
participant "rpc server" as rpc_server
wrapper -> stage_1 ** : spawn
activate stage_1
note over stage_1: prepare config
stage_1 -> wrapper: send config
deactivate stage_1
note over wrapper: create socket pair A
note over wrapper: create socket pair B
wrapper -> master ** : spawn
note over wrapper: close A[0]
activate master
note over master: close A[1]
note over master: close B[0]
wrapper -> rpc_server ** : spawn
note over rpc_server: close B[1]
note over wrapper: close B[0]
note over wrapper: close B[1]
activate rpc_server
master -> rpc_server: request open over B[1]
rpc_server -> master: send fd over B[0]
note over master: mount passing\nfd as option
master -> wrapper: send fd over A[0]
note over wrapper: enter stage 2
note over wrapper: start pre-process\nuse fd
note over wrapper: start process
@enduml
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="878px" preserveAspectRatio="none" style="width:524px;height:878px;" version="1.1" viewBox="0 0 524 878" width="524px" zoomAndPan="magnify"><defs><filter height="300%" id="f17rnqlh25nd07" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><rect fill="#FFFFFF" filter="url(#f17rnqlh25nd07)" height="74.4297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="194" y="95.7266"/><rect fill="#FFFFFF" filter="url(#f17rnqlh25nd07)" height="569.4531" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="272" y="287.5547"/><rect fill="#FFFFFF" filter="url(#f17rnqlh25nd07)" height="406.7578" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="467" y="450.25"/><rect fill="#FEFECE" filter="url(#f17rnqlh25nd07)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="66" x="164" y="64.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="52" x="171" y="84.5889">stage 1</text><rect fill="#FEFECE" filter="url(#f17rnqlh25nd07)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="62" x="244" y="256.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="48" x="251" y="276.417">master</text><rect fill="#FEFECE" filter="url(#f17rnqlh25nd07)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="83" x="428.5" y="419.1172"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="69" x="435.5" y="439.1123">rpc server</text><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="84" x2="84" y1="54.5938" y2="866.0078"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="199" x2="199" y1="97.2422" y2="866.0078"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="277" x2="277" y1="289.0703" y2="866.0078"/><line style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 5.0,5.0;" x1="471.5" x2="471.5" y1="451.7656" y2="866.0078"/><rect fill="#FEFECE" filter="url(#f17rnqlh25nd07)" height="46.5938" style="stroke: #A80036; stroke-width: 1.5;" width="76" x="44" y="3"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="56" x="54" y="22.9951">wrapper</text><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="62" x="51" y="39.292">(stage 2)</text><rect fill="#FFFFFF" filter="url(#f17rnqlh25nd07)" height="74.4297" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="194" y="95.7266"/><rect fill="#FFFFFF" filter="url(#f17rnqlh25nd07)" height="569.4531" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="272" y="287.5547"/><rect fill="#FFFFFF" filter="url(#f17rnqlh25nd07)" height="406.7578" style="stroke: #A80036; stroke-width: 1.0;" width="10" x="467" y="450.25"/><polygon fill="#A80036" points="152,81.7266,162,85.7266,152,89.7266,156,85.7266" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84" x2="158" y1="85.7266" y2="85.7266"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="91" y="80.6606">1</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="40" x="104" y="80.6606">spawn</text><rect fill="#FEFECE" filter="url(#f17rnqlh25nd07)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="66" x="164" y="64.5938"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="52" x="171" y="84.5889">stage 1</text><path d="M140,114.8906 L140,139.8906 L253,139.8906 L253,124.8906 L243,114.8906 L140,114.8906 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M243,114.8906 L243,124.8906 L253,124.8906 L243,114.8906 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="92" x="146" y="131.9575">prepare config</text><polygon fill="#A80036" points="95,166.1563,85,170.1563,95,174.1563,91,170.1563" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89" x2="198" y1="170.1563" y2="170.1563"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="101" y="165.0903">2</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="73" x="114" y="165.0903">send config</text><path d="M8,183.1563 L8,208.1563 L157,208.1563 L157,193.1563 L147,183.1563 L8,183.1563 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M147,183.1563 L147,193.1563 L157,193.1563 L147,183.1563 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="14" y="200.2231">create socket pair A</text><path d="M8,222.2891 L8,247.2891 L157,247.2891 L157,232.2891 L147,222.2891 L8,222.2891 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M147,222.2891 L147,232.2891 L157,232.2891 L147,222.2891 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="128" x="14" y="239.356">create socket pair B</text><polygon fill="#A80036" points="232,273.5547,242,277.5547,232,281.5547,236,277.5547" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84" x2="238" y1="277.5547" y2="277.5547"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="91" y="272.4888">3</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="40" x="104" y="272.4888">spawn</text><rect fill="#FEFECE" filter="url(#f17rnqlh25nd07)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="62" x="244" y="256.4219"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="48" x="251" y="276.417">master</text><path d="M39,306.7188 L39,331.7188 L124,331.7188 L124,316.7188 L114,306.7188 L39,306.7188 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M114,306.7188 L114,316.7188 L124,316.7188 L114,306.7188 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="45" y="323.7856">close A[0]</text><path d="M232,345.8516 L232,370.8516 L317,370.8516 L317,355.8516 L307,345.8516 L232,345.8516 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M307,345.8516 L307,355.8516 L317,355.8516 L307,345.8516 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="238" y="362.9185">close A[1]</text><path d="M232,384.9844 L232,409.9844 L317,409.9844 L317,394.9844 L307,384.9844 L232,384.9844 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M307,384.9844 L307,394.9844 L317,394.9844 L307,384.9844 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="238" y="402.0513">close B[0]</text><polygon fill="#A80036" points="416.5,436.25,426.5,440.25,416.5,444.25,420.5,440.25" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="84" x2="422.5" y1="440.25" y2="440.25"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="91" y="435.1841">4</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="40" x="104" y="435.1841">spawn</text><rect fill="#FEFECE" filter="url(#f17rnqlh25nd07)" height="30.2969" style="stroke: #A80036; stroke-width: 1.5;" width="83" x="428.5" y="419.1172"/><text fill="#000000" font-family="sans-serif" font-size="14" lengthAdjust="spacingAndGlyphs" textLength="69" x="435.5" y="439.1123">rpc server</text><path d="M427,469.4141 L427,494.4141 L512,494.4141 L512,479.4141 L502,469.4141 L427,469.4141 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M502,469.4141 L502,479.4141 L512,479.4141 L502,469.4141 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="433" y="486.481">close B[1]</text><path d="M39,508.5469 L39,533.5469 L124,533.5469 L124,518.5469 L114,508.5469 L39,508.5469 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M114,508.5469 L114,518.5469 L124,518.5469 L114,508.5469 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="45" y="525.6138">close B[0]</text><path d="M39,547.6797 L39,572.6797 L124,572.6797 L124,557.6797 L114,547.6797 L39,547.6797 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M114,547.6797 L114,557.6797 L124,557.6797 L114,547.6797 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="64" x="45" y="564.7466">close B[1]</text><polygon fill="#A80036" points="455,598.9453,465,602.9453,455,606.9453,459,602.9453" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="282" x2="461" y1="602.9453" y2="602.9453"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="289" y="597.8794">5</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="148" x="302" y="597.8794">request open over B[1]</text><polygon fill="#A80036" points="293,628.0781,283,632.0781,293,636.0781,289,632.0781" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="287" x2="466" y1="632.0781" y2="632.0781"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="299" y="627.0122">6</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="110" x="312" y="627.0122">send fd over B[0]</text><path d="M217,645.0781 L217,685.0781 L333,685.0781 L333,655.0781 L323,645.0781 L217,645.0781 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M323,645.0781 L323,655.0781 L333,655.0781 L323,645.0781 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="95" x="223" y="662.145">mount passing</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="75" x="223" y="677.2778">fd as option</text><polygon fill="#A80036" points="95,711.4766,85,715.4766,95,719.4766,91,715.4766" style="stroke: #A80036; stroke-width: 1.0;"/><line style="stroke: #A80036; stroke-width: 1.0;" x1="89" x2="271" y1="715.4766" y2="715.4766"/><text fill="#000000" font-family="sans-serif" font-size="13" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="9" x="101" y="710.4106">7</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="110" x="114" y="710.4106">send fd over A[0]</text><path d="M28,728.4766 L28,753.4766 L135,753.4766 L135,738.4766 L125,728.4766 L28,728.4766 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M125,728.4766 L125,738.4766 L135,738.4766 L125,728.4766 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="86" x="34" y="745.5435">enter stage 2</text><path d="M16,767.6094 L16,807.6094 L147,807.6094 L147,777.6094 L137,767.6094 L16,767.6094 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M137,767.6094 L137,777.6094 L147,777.6094 L137,767.6094 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="110" x="22" y="784.6763">start pre-process</text><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="39" x="22" y="799.8091">use fd</text><path d="M29,821.875 L29,846.875 L134,846.875 L134,831.875 L124,821.875 L29,821.875 " fill="#FBFB77" filter="url(#f17rnqlh25nd07)" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M124,821.875 L124,831.875 L134,831.875 L124,821.875 " fill="#FBFB77" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="84" x="35" y="838.9419">start process</text><!--
@startuml
autonumber
hide footbox
participant "wrapper\n(stage 2)" as wrapper
participant "stage 1" as stage_1
participant master
participant "rpc server" as rpc_server
wrapper -> stage_1 ** : spawn
activate stage_1
note over stage_1: prepare config
stage_1 -> wrapper: send config
deactivate stage_1
note over wrapper: create socket pair A
note over wrapper: create socket pair B
wrapper -> master ** : spawn
note over wrapper: close A[0]
activate master
note over master: close A[1]
note over master: close B[0]
wrapper -> rpc_server ** : spawn
note over rpc_server: close B[1]
note over wrapper: close B[0]
note over wrapper: close B[1]
activate rpc_server
master -> rpc_server: request open over B[1]
rpc_server -> master: send fd over B[0]
note over master: mount passing\nfd as option
master -> wrapper: send fd over A[0]
note over wrapper: enter stage 2
note over wrapper: start pre-process\nuse fd
note over wrapper: start process
@enduml
PlantUML version 1.2019.04(Fri Mar 29 15:44:36 UTC 2019)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 1.8.0_201-heroku-b09
Operating System: Linux
OS Version: 4.4.0-1042-aws
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment