librbd: diff_iterate fromsnapname after the end snap is also invalid

Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
Sage Weil 2013-03-28 15:17:19 -07:00 committed by Josh Durgin
parent a69532e864
commit f0c9a200ec
2 changed files with 6 additions and 0 deletions

View File

@ -22,6 +22,9 @@ rbd bench-write foo --io-size 4096 --io-threads 5 --io-total 4096000 --io-patter
rbd snap create foo --snap=three
rbd snap create foo.copy --snap=two
rbd export-diff foo@two --from-snap three foo.diff && exit 1 || true # wrong snap order
rm foo.diff
rbd export-diff foo@three --from-snap two foo.diff
rbd import-diff foo.diff foo.copy
rbd snap ls foo.copy | grep three

View File

@ -2305,6 +2305,9 @@ reprotect_and_return_err:
// no diff.
return 0;
}
if (from_snap_id >= end_snap_id) {
return -EINVAL;
}
// we must list snaps via the head, not end snap
head_ctx.snap_set_read(CEPH_SNAPDIR);