Merge pull request #5111 from ctrlaltdel121/master

mark device faulty after parent fails to suspend
This commit is contained in:
Michael Crosby 2021-03-08 14:13:25 -05:00 committed by GitHub
commit 7738246cd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -331,12 +331,6 @@ func (p *PoolDevice) CreateSnapshotDevice(ctx context.Context, deviceName string
}
}()
// Save snapshot metadata and allocate new device ID
metaErr = p.metadata.AddDevice(ctx, snapInfo)
if metaErr != nil {
return metaErr
}
// The base device must be suspend before taking a snapshot to
// avoid corruption.
// 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
}()
}
// Save snapshot metadata and allocate new device ID
metaErr = p.metadata.AddDevice(ctx, snapInfo)
if metaErr != nil {
return metaErr
}
// Create thin device snapshot
devErr = p.createSnapshot(ctx, baseInfo, snapInfo)
if devErr != nil {