return 1;
                }
        } else {
-               pnum = seb->pnum;
+               if (!seb->copy_flag) {
+                       /* It is not a copy, so it is newer */
+                       dbg_bld("first PEB %d is newer, copy_flag is unset",
+                               pnum);
+                       return bitflips << 1;
+               }
 
                vh = ubi_zalloc_vid_hdr(ubi, GFP_KERNEL);
                if (!vh)
                        return -ENOMEM;
 
+               pnum = seb->pnum;
                err = ubi_io_read_vid_hdr(ubi, pnum, vh, 0);
                if (err) {
                        if (err == UBI_IO_BITFLIPS)
                        }
                }
 
-               if (!vh->copy_flag) {
-                       /* It is not a copy, so it is newer */
-                       dbg_bld("first PEB %d is newer, copy_flag is unset",
-                               pnum);
-                       err = bitflips << 1;
-                       goto out_free_vidh;
-               }
-
                vid_hdr = vh;
        }
 
                        seb->ec = ec;
                        seb->pnum = pnum;
                        seb->scrub = ((cmp_res & 2) || bitflips);
+                       seb->copy_flag = vid_hdr->copy_flag;
                        seb->sqnum = sqnum;
 
                        if (sv->highest_lnum == lnum)
        seb->ec = ec;
        seb->pnum = pnum;
        seb->lnum = lnum;
-       seb->sqnum = sqnum;
        seb->scrub = bitflips;
+       seb->copy_flag = vid_hdr->copy_flag;
+       seb->sqnum = sqnum;
 
        if (sv->highest_lnum <= lnum) {
                sv->highest_lnum = lnum;
 
  * @pnum: physical eraseblock number
  * @lnum: logical eraseblock number
  * @scrub: if this physical eraseblock needs scrubbing
+ * @copy_flag: this LEB is a copy (@copy_flag is set in VID header of this LEB)
  * @sqnum: sequence number
  * @u: unions RB-tree or @list links
  * @u.rb: link in the per-volume RB-tree of &struct ubi_scan_leb objects
        int ec;
        int pnum;
        int lnum;
-       int scrub;
+       unsigned int scrub:1;
+       unsigned int copy_flag:1;
        unsigned long long sqnum;
        union {
                struct rb_node rb;