c8d/prune: Remove gc.ref labels from configs of deleted images 
- Follow up to: https://github.com/moby/moby/pull/45270

Temporary workaround for: https://github.com/moby/buildkit/issues/3797

**- What I did**
Fixed snapshots of unpacked images not being deleted

**- How I did it**
Manually remove gc.ref labels from configs which are not referenced by any image.

**- How to verify it**


<details>

<summary>docker rmi</summary>

```bash
$ echo 'FROM ubuntu' | docker build -qt asdf -
docker buildx psha256:2c810c8982bab60cb661704546104727f97a31f3ad8c451e1d2e212216ceff12

$ docker buildx prune -a
WARNING! This will remove all build cache. Are you sure you want to continue? [y/N] y
ID                                              RECLAIMABLE     SIZE            LAST ACCESSED
2s5mcpdcorpvthkdfoniedjot*                      true            8.192kB         1 second ago
i82yyjvqh889nd1ua3u9iwdq8*                      true    4.096kB         1 second ago
jgghwgr5rzotfa5rzsuwa2r1o                       true    27.35MB         1 second ago
Total:  27.36MB

$ ctr snapshot ls
KEY                                                                     PARENT KIND
sha256:874b048c963ab55b06939c39d59303fb975d323822a4ea48a02ac8dc635ea371        Committed

$ docker rmi asdf
Untagged: asdf

$ ctr snapshot ls
KEY PARENT KIND
```

</details>




<details>

<summary>docker image prune</summary>

```bash
$ echo 'FROM ubuntu' | docker build -qt asdf -
sha256:8b15904a219973abd67d9ed69902053e8e07cd81ee10a88d5d93f1722cabaa13

$ docker buildx prune -a
WARNING! This will remove all build cache. Are you sure you want to continue? [y/N] y
ID                                              RECLAIMABLE     SIZE            LAST ACCESSED
y92vqiqt18vuscz15q43ee0f9*                      true            4.096kB         3 seconds ago
7e2ymvv65rtif3vabl1dt45j3*                      true    8.192kB         3 seconds ago
tymibv3erhje6pm3ucm0czln5                       true    27.35MB         3 seconds ago
Total:  27.36MB

$ ctr snapshot ls
KEY                                                                     PARENT KIND
sha256:874b048c963ab55b06939c39d59303fb975d323822a4ea48a02ac8dc635ea371        Committed

$ docker image prune -a
WARNING! This will remove all images without at least one container associated to them.
Are you sure you want to continue? [y/N] y
Deleted Images:
untagged: docker.io/library/asdf:latest

Total reclaimed space: 0B

$ ctr snapshot ls
KEY PARENT KIND
```
</details>




**- Description for the changelog**
<!--
Write a short (one line) summary that describes the changes in this
pull request for inclusion in the changelog:
-->


**- A picture of a cute animal (not mandatory but encouraged)**


daemon/containerd/handlers.go
package containerd

import (
	"context"

	"github.com/containerd/containerd/content"
	cerrdefs "github.com/containerd/containerd/errdefs"
	containerdimages "github.com/containerd/containerd/images"
	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

// presentChildrenHandler is a handler wrapper which traverses all children
// descriptors that are present in the store and calls specified handler.
func presentChildrenHandler(store content.Store, h containerdimages.HandlerFunc) containerdimages.HandlerFunc {
	return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
		_, err := store.Info(ctx, desc.Digest)
		if err != nil {
			if cerrdefs.IsNotFound(err) {
				return nil, nil
			}
			return nil, err
		}

		children, err := h(ctx, desc)
		if err != nil {
			return nil, err
		}

		c, err := containerdimages.Children(ctx, store, desc)
		if err != nil {
			return nil, err
		}
		children = append(children, c...)

		return children, nil
	}
}

package containerd

import (
	"context"

	"github.com/containerd/containerd/content"
	cerrdefs "github.com/containerd/containerd/errdefs"
	containerdimages "github.com/containerd/containerd/images"
	ocispec "github.com/opencontainers/image-spec/specs-go/v1"
)

// walkPresentChildren is a simple wrapper for containerdimages.Walk with
// presentChildrenHandler wrapping a simple handler that only operates on
// walked Descriptor and doesn't return any errror.
// This is only a convenient helper to reduce boilerplate.
func (i *ImageService) walkPresentChildren(ctx context.Context, target ocispec.Descriptor, f func(context.Context, ocispec.Descriptor)) error {
	store := i.client.ContentStore()
	return containerdimages.Walk(ctx, presentChildrenHandler(store, containerdimages.HandlerFunc(
		func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
			f(ctx, desc)
			return nil, nil
		})), target)
}

// presentChildrenHandler is a handler wrapper which traverses all children
// descriptors that are present in the store and calls specified handler.
func presentChildrenHandler(store content.Store, h containerdimages.HandlerFunc) containerdimages.HandlerFunc {
	return func(ctx context.Context, desc ocispec.Descriptor) ([]ocispec.Descriptor, error) {
		_, err := store.Info(ctx, desc.Digest)
		if err != nil {
			if cerrdefs.IsNotFound(err) {
				return nil, nil
			}
			return nil, err
		}

		children, err := h(ctx, desc)
		if err != nil {
			return nil, err
		}

		c, err := containerdimages.Children(ctx, store, desc)
		if err != nil {
			return nil, err
		}
		children = append(children, c...)

		return children, nil
	}
}

Hmm my intent there was just to have a wrapper for very simple handlers that don't make use of context.
But I think it's okay for this to be more general usage. Plumbed the context, thanks.