Fix tx closed error when upperdirlabel specified
When upperdirLabel specified, overlay Update will throw tx closed error since Commit is invoked before GetInfo Signed-off-by: cardy.tang <zuniorone@gmail.com>
This commit is contained in:
parent
b5107a8984
commit
9f9ebbd991
@ -160,10 +160,6 @@ func (o *snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpath
|
|||||||
return snapshots.Info{}, err
|
return snapshots.Info{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := t.Commit(); err != nil {
|
|
||||||
return snapshots.Info{}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
if o.upperdirLabel {
|
if o.upperdirLabel {
|
||||||
id, _, _, err := storage.GetInfo(ctx, info.Name)
|
id, _, _, err := storage.GetInfo(ctx, info.Name)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -175,6 +171,10 @@ func (o *snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpath
|
|||||||
info.Labels[upperdirKey] = o.upperPath(id)
|
info.Labels[upperdirKey] = o.upperPath(id)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err := t.Commit(); err != nil {
|
||||||
|
return snapshots.Info{}, err
|
||||||
|
}
|
||||||
|
|
||||||
return info, nil
|
return info, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user