backport of commit 0b0b15f968bb243b29544d6a7f2652137e07d632 (#21839)
Co-authored-by: Hamid Ghaf <83242695+hghaf099@users.noreply.github.com>
This commit is contained in:
parent
da49fe9db5
commit
a0dca58c44
|
@ -81,9 +81,13 @@ func (c *Core) enableCredentialInternal(ctx context.Context, entry *MountEntry,
|
|||
|
||||
c.mountsLock.Lock()
|
||||
c.authLock.Lock()
|
||||
locked := true
|
||||
unlock := func() {
|
||||
c.authLock.Unlock()
|
||||
c.mountsLock.Unlock()
|
||||
if locked {
|
||||
c.authLock.Unlock()
|
||||
c.mountsLock.Unlock()
|
||||
locked = false
|
||||
}
|
||||
}
|
||||
defer unlock()
|
||||
|
||||
|
@ -224,7 +228,6 @@ func (c *Core) enableCredentialInternal(ctx context.Context, entry *MountEntry,
|
|||
c.logger.Error("failed to evaluate filtered paths", "error", err)
|
||||
|
||||
unlock()
|
||||
unlock = func() {}
|
||||
// We failed to evaluate filtered paths so we are undoing the mount operation
|
||||
if disableCredentialErr := c.disableCredentialInternal(ctx, entry.Path, MountTableUpdateStorage); disableCredentialErr != nil {
|
||||
c.logger.Error("failed to disable credential", "error", disableCredentialErr)
|
||||
|
|
|
@ -573,9 +573,13 @@ func (c *Core) mount(ctx context.Context, entry *MountEntry) error {
|
|||
func (c *Core) mountInternal(ctx context.Context, entry *MountEntry, updateStorage bool) error {
|
||||
c.mountsLock.Lock()
|
||||
c.authLock.Lock()
|
||||
locked := true
|
||||
unlock := func() {
|
||||
c.authLock.Unlock()
|
||||
c.mountsLock.Unlock()
|
||||
if locked {
|
||||
c.authLock.Unlock()
|
||||
c.mountsLock.Unlock()
|
||||
locked = false
|
||||
}
|
||||
}
|
||||
defer unlock()
|
||||
|
||||
|
@ -738,7 +742,6 @@ func (c *Core) mountInternal(ctx context.Context, entry *MountEntry, updateStora
|
|||
c.logger.Error("failed to evaluate filtered paths", "error", err)
|
||||
|
||||
unlock()
|
||||
unlock = func() {}
|
||||
// We failed to evaluate filtered paths so we are undoing the mount operation
|
||||
if unmountInternalErr := c.unmountInternal(ctx, entry.Path, MountTableUpdateStorage); unmountInternalErr != nil {
|
||||
c.logger.Error("failed to unmount", "error", unmountInternalErr)
|
||||
|
|
Loading…
Reference in New Issue