From: Sage Weil Date: Thu, 28 Mar 2013 22:17:19 +0000 (-0700) Subject: librbd: diff_iterate fromsnapname after the end snap is also invalid X-Git-Tag: v0.62~118^2~29 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f0c9a200ec0ea0b0721b30d6e40ad32058e4cebd;p=ceph.git librbd: diff_iterate fromsnapname after the end snap is also invalid Signed-off-by: Sage Weil --- diff --git a/qa/workunits/rbd/diff.sh b/qa/workunits/rbd/diff.sh index 6f9cd27ae42..1e79d7cf9d3 100755 --- a/qa/workunits/rbd/diff.sh +++ b/qa/workunits/rbd/diff.sh @@ -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 diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 1ab839fe3c1..8cc777b5d0f 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -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);