File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -106,7 +106,19 @@ type MountPoint struct {
106106
107107// Setup sets up a mount point by either mounting the volume if it is
108108// configured, or creating the source directory if supplied.
109- func (m * MountPoint ) Setup (mountLabel string ) (string , error ) {
109+ func (m * MountPoint ) Setup (mountLabel string ) (path string , err error ) {
110+ defer func () {
111+ if err == nil {
112+ if label .RelabelNeeded (m .Mode ) {
113+ if err = label .Relabel (m .Source , mountLabel , label .IsShared (m .Mode )); err != nil {
114+ path = ""
115+ err = fmt .Errorf ("error setting label on mount source '%s': %v" , m .Source , err )
116+ return
117+ }
118+ }
119+ }
120+ return
121+ }()
110122 if m .Volume != nil {
111123 if m .ID == "" {
112124 m .ID = stringid .GenerateNonCryptoID ()
@@ -124,11 +136,6 @@ func (m *MountPoint) Setup(mountLabel string) (string, error) {
124136 }
125137 }
126138 }
127- if label .RelabelNeeded (m .Mode ) {
128- if err := label .Relabel (m .Source , mountLabel , label .IsShared (m .Mode )); err != nil {
129- return "" , err
130- }
131- }
132139 return m .Source , nil
133140}
134141
You can’t perform that action at this time.
0 commit comments