ubi: fastmap: Allocate memory with GFP_NOFS in ubi_update_fastmap
Function ubi_update_fastmap could be called in IO context, for example:
ubifs_writepage
do_writepage
ubifs_jnl_write_data
write_head
ubifs_wbuf_write_nolock
ubifs_leb_write
ubi_leb_write
ubi_eba_write_leb
try_write_vid_and_data
ubi_wl_get_peb
ubi_update_fastmap
erase_block
So it's better to allocate memory with GFP_NOFS mode, in case waiting
page writeback(dead loop).
Signed-off-by: Zhihao Cheng <chengzhihao1@huawei.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
This commit is contained in:
committed by
Richard Weinberger
parent
08a4267874
commit
a033ab4fec
@@ -20,7 +20,7 @@ static inline unsigned long *init_seen(struct ubi_device *ubi)
|
||||
if (!ubi_dbg_chk_fastmap(ubi))
|
||||
return NULL;
|
||||
|
||||
ret = bitmap_zalloc(ubi->peb_count, GFP_KERNEL);
|
||||
ret = bitmap_zalloc(ubi->peb_count, GFP_NOFS);
|
||||
if (!ret)
|
||||
return ERR_PTR(-ENOMEM);
|
||||
|
||||
@@ -105,7 +105,7 @@ static struct ubi_vid_io_buf *new_fm_vbuf(struct ubi_device *ubi, int vol_id)
|
||||
struct ubi_vid_io_buf *new;
|
||||
struct ubi_vid_hdr *vh;
|
||||
|
||||
new = ubi_alloc_vid_buf(ubi, GFP_KERNEL);
|
||||
new = ubi_alloc_vid_buf(ubi, GFP_NOFS);
|
||||
if (!new)
|
||||
goto out;
|
||||
|
||||
@@ -1403,7 +1403,7 @@ static int erase_block(struct ubi_device *ubi, struct ubi_wl_entry *e)
|
||||
struct ubi_ec_hdr *ec_hdr;
|
||||
long long ec = e->ec;
|
||||
|
||||
ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_KERNEL);
|
||||
ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS);
|
||||
if (!ec_hdr)
|
||||
return -ENOMEM;
|
||||
|
||||
@@ -1459,7 +1459,7 @@ static int invalidate_fastmap(struct ubi_device *ubi)
|
||||
ubi->fm = NULL;
|
||||
|
||||
ret = -ENOMEM;
|
||||
fm = kzalloc(sizeof(*fm), GFP_KERNEL);
|
||||
fm = kzalloc(sizeof(*fm), GFP_NOFS);
|
||||
if (!fm)
|
||||
goto out;
|
||||
|
||||
@@ -1548,7 +1548,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
|
||||
return 0;
|
||||
}
|
||||
|
||||
new_fm = kzalloc(sizeof(*new_fm), GFP_KERNEL);
|
||||
new_fm = kzalloc(sizeof(*new_fm), GFP_NOFS);
|
||||
if (!new_fm) {
|
||||
up_write(&ubi->fm_eba_sem);
|
||||
up_write(&ubi->work_sem);
|
||||
|
||||
Reference in New Issue
Block a user