aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/ubi/eba.c
diff options
context:
space:
mode:
authorArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-08-28 14:29:32 -0400
committerArtem Bityutskiy <Artem.Bityutskiy@nokia.com>2007-10-14 06:10:20 -0400
commit33818bbb84cd371b63ed8849cc5264d24c8b3aa2 (patch)
treeecee6a8f02d2d103c6eb33cc6173e74343b1861b /drivers/mtd/ubi/eba.c
parentef6075fbfca9139f428d52d60e671da38aa2e212 (diff)
UBI: allocate memory with GFP_NOFS
Use GFP_NOFS flag when allocating memory on I/O path, because otherwise we may deadlock the filesystem which works on top of us. We observed the deadlocks with UBIFS. Example: VFS->FS lock a lock->UBI->kmalloc()->VFS writeback->FS locks the same lock again. Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Diffstat (limited to 'drivers/mtd/ubi/eba.c')
-rw-r--r--drivers/mtd/ubi/eba.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c
index 7c5e29eaf118..89193104c6c8 100644
--- a/drivers/mtd/ubi/eba.c
+++ b/drivers/mtd/ubi/eba.c
@@ -157,7 +157,7 @@ static struct ltree_entry *ltree_add_entry(struct ubi_device *ubi, int vol_id,
157{ 157{
158 struct ltree_entry *le, *le1, *le_free; 158 struct ltree_entry *le, *le1, *le_free;
159 159
160 le = kmem_cache_alloc(ltree_slab, GFP_KERNEL); 160 le = kmem_cache_alloc(ltree_slab, GFP_NOFS);
161 if (!le) 161 if (!le)
162 return ERR_PTR(-ENOMEM); 162 return ERR_PTR(-ENOMEM);
163 163
@@ -397,7 +397,7 @@ int ubi_eba_read_leb(struct ubi_device *ubi, int vol_id, int lnum, void *buf,
397 397
398retry: 398retry:
399 if (check) { 399 if (check) {
400 vid_hdr = ubi_zalloc_vid_hdr(ubi); 400 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
401 if (!vid_hdr) { 401 if (!vid_hdr) {
402 err = -ENOMEM; 402 err = -ENOMEM;
403 goto out_unlock; 403 goto out_unlock;
@@ -497,7 +497,7 @@ static int recover_peb(struct ubi_device *ubi, int pnum, int vol_id, int lnum,
497 struct ubi_vid_hdr *vid_hdr; 497 struct ubi_vid_hdr *vid_hdr;
498 unsigned char *new_buf; 498 unsigned char *new_buf;
499 499
500 vid_hdr = ubi_zalloc_vid_hdr(ubi); 500 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
501 if (!vid_hdr) { 501 if (!vid_hdr) {
502 return -ENOMEM; 502 return -ENOMEM;
503 } 503 }
@@ -627,7 +627,7 @@ int ubi_eba_write_leb(struct ubi_device *ubi, int vol_id, int lnum,
627 * The logical eraseblock is not mapped. We have to get a free physical 627 * The logical eraseblock is not mapped. We have to get a free physical
628 * eraseblock and write the volume identifier header there first. 628 * eraseblock and write the volume identifier header there first.
629 */ 629 */
630 vid_hdr = ubi_zalloc_vid_hdr(ubi); 630 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
631 if (!vid_hdr) { 631 if (!vid_hdr) {
632 leb_write_unlock(ubi, vol_id, lnum); 632 leb_write_unlock(ubi, vol_id, lnum);
633 return -ENOMEM; 633 return -ENOMEM;
@@ -738,7 +738,7 @@ int ubi_eba_write_leb_st(struct ubi_device *ubi, int vol_id, int lnum,
738 else 738 else
739 ubi_assert(len % ubi->min_io_size == 0); 739 ubi_assert(len % ubi->min_io_size == 0);
740 740
741 vid_hdr = ubi_zalloc_vid_hdr(ubi); 741 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
742 if (!vid_hdr) 742 if (!vid_hdr)
743 return -ENOMEM; 743 return -ENOMEM;
744 744
@@ -844,7 +844,7 @@ int ubi_eba_atomic_leb_change(struct ubi_device *ubi, int vol_id, int lnum,
844 if (ubi->ro_mode) 844 if (ubi->ro_mode)
845 return -EROFS; 845 return -EROFS;
846 846
847 vid_hdr = ubi_zalloc_vid_hdr(ubi); 847 vid_hdr = ubi_zalloc_vid_hdr(ubi, GFP_NOFS);
848 if (!vid_hdr) 848 if (!vid_hdr)
849 return -ENOMEM; 849 return -ENOMEM;
850 850