]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: diff_iterate fromsnapname after the end snap is also invalid
authorSage Weil <sage@inktank.com>
Thu, 28 Mar 2013 22:17:19 +0000 (15:17 -0700)
committerJosh Durgin <josh.durgin@inktank.com>
Mon, 1 Apr 2013 06:32:41 +0000 (23:32 -0700)
Signed-off-by: Sage Weil <sage@inktank.com>
qa/workunits/rbd/diff.sh
src/librbd/internal.cc

index 6f9cd27ae42cb511e69211b823d3dfb8fd0446e7..1e79d7cf9d3c93080b94c0faec21488d17fe33bc 100755 (executable)
@@ -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
index 1ab839fe3c1400e8083c6c21a5ee452bacaf8c37..8cc777b5d0f51f5fdd51f7de199c89c19d6ca8b5 100644 (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);