Commit 1398199d authored by Vishal Verma's avatar Vishal Verma Committed by Dan Williams

libnvdimm, btt: ensure that flags were also unchanged during a map_read

In btt_map_read, we read the map twice to make sure that the map entry
didn't change after we added it to the read tracking table. In
anticipation of expanding the use of the error bit, also make sure that
the error and zero flags are constant across the two map reads.
Signed-off-by: default avatarVishal Verma <vishal.l.verma@intel.com>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
parent 0595d539
...@@ -1032,6 +1032,7 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip, ...@@ -1032,6 +1032,7 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,
*/ */
while (1) { while (1) {
u32 new_map; u32 new_map;
int new_t, new_e;
if (t_flag) { if (t_flag) {
zero_fill_data(page, off, cur_len); zero_fill_data(page, off, cur_len);
...@@ -1050,15 +1051,18 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip, ...@@ -1050,15 +1051,18 @@ static int btt_read_pg(struct btt *btt, struct bio_integrity_payload *bip,
*/ */
barrier(); barrier();
ret = btt_map_read(arena, premap, &new_map, &t_flag, ret = btt_map_read(arena, premap, &new_map, &new_t,
&e_flag, NVDIMM_IO_ATOMIC); &new_e, NVDIMM_IO_ATOMIC);
if (ret) if (ret)
goto out_rtt; goto out_rtt;
if (postmap == new_map) if ((postmap == new_map) && (t_flag == new_t) &&
(e_flag == new_e))
break; break;
postmap = new_map; postmap = new_map;
t_flag = new_t;
e_flag = new_e;
} }
ret = btt_data_read(arena, page, off, postmap, cur_len); ret = btt_data_read(arena, page, off, postmap, cur_len);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment