Merge branch 'master'
[powerpc.git] / drivers / md / dm-snap.c
index 7e691ab..ab54f99 100644 (file)
@@ -777,7 +777,7 @@ static int snapshot_map(struct dm_target *ti, struct bio *bio,
 
        /* Full snapshots are not usable */
        if (!s->valid)
-               return -1;
+               return -EIO;
 
        /*
         * Write to snapshot - higher level takes care of RW/RO
@@ -931,6 +931,10 @@ static int __origin_write(struct list_head *snapshots, struct bio *bio)
                if (!snap->valid)
                        continue;
 
+               /* Nothing to do if writing beyond end of snapshot */
+               if (bio->bi_sector >= dm_table_get_size(snap->table))
+                       continue;
+
                down_write(&snap->lock);
 
                /*