Skip to content

Commit a033ab4

Browse files
Zhihao Chengrichardweinberger
authored andcommitted
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>
1 parent 08a4267 commit a033ab4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/mtd/ubi/fastmap.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static inline unsigned long *init_seen(struct ubi_device *ubi)
2020
if (!ubi_dbg_chk_fastmap(ubi))
2121
return NULL;
2222

23-
ret = bitmap_zalloc(ubi->peb_count, GFP_KERNEL);
23+
ret = bitmap_zalloc(ubi->peb_count, GFP_NOFS);
2424
if (!ret)
2525
return ERR_PTR(-ENOMEM);
2626

@@ -105,7 +105,7 @@ static struct ubi_vid_io_buf *new_fm_vbuf(struct ubi_device *ubi, int vol_id)
105105
struct ubi_vid_io_buf *new;
106106
struct ubi_vid_hdr *vh;
107107

108-
new = ubi_alloc_vid_buf(ubi, GFP_KERNEL);
108+
new = ubi_alloc_vid_buf(ubi, GFP_NOFS);
109109
if (!new)
110110
goto out;
111111

@@ -1403,7 +1403,7 @@ static int erase_block(struct ubi_device *ubi, struct ubi_wl_entry *e)
14031403
struct ubi_ec_hdr *ec_hdr;
14041404
long long ec = e->ec;
14051405

1406-
ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_KERNEL);
1406+
ec_hdr = kzalloc(ubi->ec_hdr_alsize, GFP_NOFS);
14071407
if (!ec_hdr)
14081408
return -ENOMEM;
14091409

@@ -1459,7 +1459,7 @@ static int invalidate_fastmap(struct ubi_device *ubi)
14591459
ubi->fm = NULL;
14601460

14611461
ret = -ENOMEM;
1462-
fm = kzalloc(sizeof(*fm), GFP_KERNEL);
1462+
fm = kzalloc(sizeof(*fm), GFP_NOFS);
14631463
if (!fm)
14641464
goto out;
14651465

@@ -1548,7 +1548,7 @@ int ubi_update_fastmap(struct ubi_device *ubi)
15481548
return 0;
15491549
}
15501550

1551-
new_fm = kzalloc(sizeof(*new_fm), GFP_KERNEL);
1551+
new_fm = kzalloc(sizeof(*new_fm), GFP_NOFS);
15521552
if (!new_fm) {
15531553
up_write(&ubi->fm_eba_sem);
15541554
up_write(&ubi->work_sem);

0 commit comments

Comments
 (0)