Skip to content

Commit 7738246

Browse files
Merge pull request containerd#5111 from ctrlaltdel121/master
mark device faulty after parent fails to suspend
2 parents da137a7 + 51a72f0 commit 7738246

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

snapshots/devmapper/pool_device.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,12 +331,6 @@ func (p *PoolDevice) CreateSnapshotDevice(ctx context.Context, deviceName string
331331
}
332332
}()
333333

334-
// Save snapshot metadata and allocate new device ID
335-
metaErr = p.metadata.AddDevice(ctx, snapInfo)
336-
if metaErr != nil {
337-
return metaErr
338-
}
339-
340334
// The base device must be suspend before taking a snapshot to
341335
// avoid corruption.
342336
// https://github.com/torvalds/linux/blob/v5.7/Documentation/admin-guide/device-mapper/thin-provisioning.rst#internal-snapshots
@@ -354,6 +348,12 @@ func (p *PoolDevice) CreateSnapshotDevice(ctx context.Context, deviceName string
354348
}()
355349
}
356350

351+
// Save snapshot metadata and allocate new device ID
352+
metaErr = p.metadata.AddDevice(ctx, snapInfo)
353+
if metaErr != nil {
354+
return metaErr
355+
}
356+
357357
// Create thin device snapshot
358358
devErr = p.createSnapshot(ctx, baseInfo, snapInfo)
359359
if devErr != nil {

0 commit comments

Comments
 (0)