Fixes for 2 brown-paperbag bugs introduced this merge window by the fastmap

code:
 
 1. The UBI background thread got stuck when a bit-flip happened because free
    LEBs was not removed from the "free" tree when we started using it.
 2. I/O debugging checks did not work because we called a sleeping function in
    atomic context.
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQvgPKAAoJECmIfjd9wqK0JgQQAKVMRSmE1GehkcqtOG+binQQ
 FeasewaarkyRhZzkLy0Mw25c/1csjZ8bL/rbht75yjrhPM72Lu5S6pTYmnqQ2kFX
 phVIyDNeMeGxmI55s3rlTc8HMVvwIpFUHQEYgWiXfse4R2I2Du9NY2G9UWJ3hvUL
 X4x039YSLrI+SawnF5cxe59FV54aS0cbZ6Dlltvyw7oKqt0lStt/RG2V5MaUOpx+
 DW7qCXJm3VJ2TkUb/Goyop1R5BznOtFEdRJXeXfefJ6+sMyQCO+5WBMq3JMF0x5K
 RmlJ4ebsk5oqerKDFmtjE7TwFiaMvGpFOxcomIJuP5kyoDKtv7VqczkGtIegGJ0+
 cAKBLSUQP4tTWoq066soEJmGKpIqyrqrhdGTMJdKSRKNIzCdRkUtY/GUhAxZmSEz
 Pszmy1Dbfo8Vw8aAgoMSzSiHTbLX1e1GbwXNDHA/SMKq5drMfa+mvSWSOEfcoYBV
 PXcUETOfTIHvNBiSlTeyx3W4BFC74kwHizqdIqpCWSC9GrUG/ckC2FEQcDFe1Lqf
 PfavXn1VM6IyDAnjaCPh+ZycA9YtIb0eV7RSiT5F/nI7FAXH1+/2YHMYnnUz+BUM
 cdS4DR7bsy3a1QGG+M1OZOZlxy8brWrH3tBEeWRRVeywr/Ij24g7mcG3SHS4uEuF
 JCevqZJ069/xxCSiRpoy
 =fs+0
 -----END PGP SIGNATURE-----

Merge tag 'upstream-3.7-rc9' of git://git.infradead.org/linux-ubi

Pull UBI changes from Artem Bityutskiy:
 "Fixes for 2 brown-paperbag bugs introduced this merge window by the
  fastmap code:

   1.  The UBI background thread got stuck when a bit-flip happened
       because free LEBs was not removed from the "free" tree when we
       started using it.
   2.  I/O debugging checks did not work because we called a sleeping
       function in atomic context."

* tag 'upstream-3.7-rc9' of git://git.infradead.org/linux-ubi:
  UBI: dont call ubi_self_check_all_ff() in __wl_get_peb()
  UBI: remove PEB from free tree in get_peb_for_wl()
This commit is contained in:
Linus Torvalds 2012-12-04 09:15:51 -08:00
Родитель ca50496eb4 894aef2157
Коммит 70dcc535bd
1 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -498,7 +498,7 @@ out:
* @ubi: UBI device description object
*
* This function returns a physical eraseblock in case of success and a
* negative error code in case of failure. Might sleep.
* negative error code in case of failure.
*/
static int __wl_get_peb(struct ubi_device *ubi)
{
@ -540,13 +540,6 @@ retry:
* ubi_wl_get_peb() after removing e from the pool. */
prot_queue_add(ubi, e);
#endif
err = ubi_self_check_all_ff(ubi, e->pnum, ubi->vid_hdr_aloffset,
ubi->peb_size - ubi->vid_hdr_aloffset);
if (err) {
ubi_err("new PEB %d does not contain all 0xFF bytes", e->pnum);
return err;
}
return e->pnum;
}
@ -679,17 +672,30 @@ static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi)
#else
static struct ubi_wl_entry *get_peb_for_wl(struct ubi_device *ubi)
{
return find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF);
struct ubi_wl_entry *e;
e = find_wl_entry(ubi, &ubi->free, WL_FREE_MAX_DIFF);
self_check_in_wl_tree(ubi, e, &ubi->free);
rb_erase(&e->u.rb, &ubi->free);
return e;
}
int ubi_wl_get_peb(struct ubi_device *ubi)
{
int peb;
int peb, err;
spin_lock(&ubi->wl_lock);
peb = __wl_get_peb(ubi);
spin_unlock(&ubi->wl_lock);
err = ubi_self_check_all_ff(ubi, peb, ubi->vid_hdr_aloffset,
ubi->peb_size - ubi->vid_hdr_aloffset);
if (err) {
ubi_err("new PEB %d does not contain all 0xFF bytes", peb);
return err;
}
return peb;
}
#endif