endpoint abstr: use userrefs to only issue zfs holds if there is at least one hold

This commit is contained in:
Christian Schwarz 2020-04-05 20:10:37 +02:00
parent 568a112519
commit 8cab6e95ad

View File

@ -595,7 +595,7 @@ func listAbstractionsImplFS(ctx context.Context, fs string, query *ListZFSHoldsA
if v.Type == zfs.Bookmark && bmE != nil { if v.Type == zfs.Bookmark && bmE != nil {
a = bmE(fsp, v) a = bmE(fsp, v)
} }
if v.Type == zfs.Snapshot && holdE != nil && query.CreateTXG.Contains(v.GetCreateTXG()) { if v.Type == zfs.Snapshot && holdE != nil && query.CreateTXG.Contains(v.GetCreateTXG()) && (!v.UserRefs.Valid || v.UserRefs.Value > 0) {
holds, err := zfs.ZFSHolds(ctx, fsp.ToString(), v.Name) holds, err := zfs.ZFSHolds(ctx, fsp.ToString(), v.Name)
if err != nil { if err != nil {
errCb(err, v.ToAbsPath(fsp), "get hold on snap") errCb(err, v.ToAbsPath(fsp), "get hold on snap")