[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202008141549.qNtqyFco%lkp@intel.com>
Date: Fri, 14 Aug 2020 15:20:53 +0800
From: kernel test robot <lkp@...el.com>
To: David Sterba <dsterba@...e.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: fs/btrfs/raid56.c:1255 finish_rmw() error: uninitialized symbol
'has_qstripe'.
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a1d21081a60dfb7fddf4a38b66d9cef603b317a9
commit: c17af96554a8a8777cbb0fd53b8497250e548b43 btrfs: raid56: simplify tracking of Q stripe presence
date: 5 months ago
config: ia64-randconfig-m031-20200811 (attached as .config)
compiler: ia64-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@...el.com>
New smatch warnings:
fs/btrfs/raid56.c:1255 finish_rmw() error: uninitialized symbol 'has_qstripe'.
fs/btrfs/raid56.c:2390 finish_parity_scrub() error: uninitialized symbol 'has_qstripe'.
Old smatch warnings:
fs/btrfs/raid56.c:2431 finish_parity_scrub() error: memcmp() 'parity' too small (4096 vs 16384)
vim +/has_qstripe +1255 fs/btrfs/raid56.c
1183
1184 /*
1185 * this is called from one of two situations. We either
1186 * have a full stripe from the higher layers, or we've read all
1187 * the missing bits off disk.
1188 *
1189 * This will calculate the parity and then send down any
1190 * changed blocks.
1191 */
1192 static noinline void finish_rmw(struct btrfs_raid_bio *rbio)
1193 {
1194 struct btrfs_bio *bbio = rbio->bbio;
1195 void **pointers = rbio->finish_pointers;
1196 int nr_data = rbio->nr_data;
1197 int stripe;
1198 int pagenr;
1199 bool has_qstripe;
1200 struct bio_list bio_list;
1201 struct bio *bio;
1202 int ret;
1203
1204 bio_list_init(&bio_list);
1205
1206 if (rbio->real_stripes - rbio->nr_data == 1)
1207 has_qstripe = false;
1208 else if (rbio->real_stripes - rbio->nr_data == 2)
1209 has_qstripe = true;
1210 else
1211 BUG();
1212
1213 /* at this point we either have a full stripe,
1214 * or we've read the full stripe from the drive.
1215 * recalculate the parity and write the new results.
1216 *
1217 * We're not allowed to add any new bios to the
1218 * bio list here, anyone else that wants to
1219 * change this stripe needs to do their own rmw.
1220 */
1221 spin_lock_irq(&rbio->bio_list_lock);
1222 set_bit(RBIO_RMW_LOCKED_BIT, &rbio->flags);
1223 spin_unlock_irq(&rbio->bio_list_lock);
1224
1225 atomic_set(&rbio->error, 0);
1226
1227 /*
1228 * now that we've set rmw_locked, run through the
1229 * bio list one last time and map the page pointers
1230 *
1231 * We don't cache full rbios because we're assuming
1232 * the higher layers are unlikely to use this area of
1233 * the disk again soon. If they do use it again,
1234 * hopefully they will send another full bio.
1235 */
1236 index_rbio_pages(rbio);
1237 if (!rbio_is_full(rbio))
1238 cache_rbio_pages(rbio);
1239 else
1240 clear_bit(RBIO_CACHE_READY_BIT, &rbio->flags);
1241
1242 for (pagenr = 0; pagenr < rbio->stripe_npages; pagenr++) {
1243 struct page *p;
1244 /* first collect one page from each data stripe */
1245 for (stripe = 0; stripe < nr_data; stripe++) {
1246 p = page_in_rbio(rbio, stripe, pagenr, 0);
1247 pointers[stripe] = kmap(p);
1248 }
1249
1250 /* then add the parity stripe */
1251 p = rbio_pstripe_page(rbio, pagenr);
1252 SetPageUptodate(p);
1253 pointers[stripe++] = kmap(p);
1254
> 1255 if (has_qstripe) {
1256
1257 /*
1258 * raid6, add the qstripe and call the
1259 * library function to fill in our p/q
1260 */
1261 p = rbio_qstripe_page(rbio, pagenr);
1262 SetPageUptodate(p);
1263 pointers[stripe++] = kmap(p);
1264
1265 raid6_call.gen_syndrome(rbio->real_stripes, PAGE_SIZE,
1266 pointers);
1267 } else {
1268 /* raid5 */
1269 copy_page(pointers[nr_data], pointers[0]);
1270 run_xor(pointers + 1, nr_data - 1, PAGE_SIZE);
1271 }
1272
1273
1274 for (stripe = 0; stripe < rbio->real_stripes; stripe++)
1275 kunmap(page_in_rbio(rbio, stripe, pagenr, 0));
1276 }
1277
1278 /*
1279 * time to start writing. Make bios for everything from the
1280 * higher layers (the bio_list in our rbio) and our p/q. Ignore
1281 * everything else.
1282 */
1283 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
1284 for (pagenr = 0; pagenr < rbio->stripe_npages; pagenr++) {
1285 struct page *page;
1286 if (stripe < rbio->nr_data) {
1287 page = page_in_rbio(rbio, stripe, pagenr, 1);
1288 if (!page)
1289 continue;
1290 } else {
1291 page = rbio_stripe_page(rbio, stripe, pagenr);
1292 }
1293
1294 ret = rbio_add_io_page(rbio, &bio_list,
1295 page, stripe, pagenr, rbio->stripe_len);
1296 if (ret)
1297 goto cleanup;
1298 }
1299 }
1300
1301 if (likely(!bbio->num_tgtdevs))
1302 goto write_data;
1303
1304 for (stripe = 0; stripe < rbio->real_stripes; stripe++) {
1305 if (!bbio->tgtdev_map[stripe])
1306 continue;
1307
1308 for (pagenr = 0; pagenr < rbio->stripe_npages; pagenr++) {
1309 struct page *page;
1310 if (stripe < rbio->nr_data) {
1311 page = page_in_rbio(rbio, stripe, pagenr, 1);
1312 if (!page)
1313 continue;
1314 } else {
1315 page = rbio_stripe_page(rbio, stripe, pagenr);
1316 }
1317
1318 ret = rbio_add_io_page(rbio, &bio_list, page,
1319 rbio->bbio->tgtdev_map[stripe],
1320 pagenr, rbio->stripe_len);
1321 if (ret)
1322 goto cleanup;
1323 }
1324 }
1325
1326 write_data:
1327 atomic_set(&rbio->stripes_pending, bio_list_size(&bio_list));
1328 BUG_ON(atomic_read(&rbio->stripes_pending) == 0);
1329
1330 while (1) {
1331 bio = bio_list_pop(&bio_list);
1332 if (!bio)
1333 break;
1334
1335 bio->bi_private = rbio;
1336 bio->bi_end_io = raid_write_end_io;
1337 bio->bi_opf = REQ_OP_WRITE;
1338
1339 submit_bio(bio);
1340 }
1341 return;
1342
1343 cleanup:
1344 rbio_orig_end_io(rbio, BLK_STS_IOERR);
1345
1346 while ((bio = bio_list_pop(&bio_list)))
1347 bio_put(bio);
1348 }
1349
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (32052 bytes)
Powered by blists - more mailing lists