[PATCH] reiserfs: handle cnode allocation failure gracefully
From: Jeff Mahoney (jeffm_at_suse.com)
Date: 11/29/05
- Previous message: Linus Torvalds: "Re: Linux 2.6.15-rc3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Nov 2005 16:44:03 -0500 To: Andrew Morton <akpm@osdl.org>, Linus Torvalds <torvalds@osdl.org>, Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
If an external device is used for a journal, by default it will use the
entire device. The reiserfs journal code allocates structures per journal
block when it mounts the file system. If the journal device is too large, and
memory cannot be allocated for the structures, it will continue and ultimately
panic when it can't pull one off the free list.
This patch handles the allocation failure gracefully and prints an error
message at mount time.
Changes: Updated error message to be more descriptive to the user.
Discussed and approved on ReiserFS Mailing List, Nov 28.
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
diff -ruNpX dontdiff a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c
--- a/fs/reiserfs/journal.c 2005-09-16 11:42:58.000000000 -0400
+++ b/fs/reiserfs/journal.c 2005-11-23 19:14:17.000000000 -0500
@@ -2757,6 +2757,15 @@ int journal_init(struct super_block *p_s
journal->j_cnode_used = 0;
journal->j_must_wait = 0;
+ if (journal->j_cnode_free == 0) {
+ reiserfs_warning(p_s_sb, "journal-2004: Journal cnode memory "
+ "allocation failed (%ld bytes). Journal is "
+ "too large for available memory. Usually "
+ "this is due to a journal that is too large.",
+ sizeof (struct reiserfs_journal_cnode) * num_cnodes);
+ goto free_and_return;
+ }
+
init_journal_hash(p_s_sb);
jl = journal->j_current_jl;
jl->j_list_bitmap = get_list_bitmap(p_s_sb, jl);
-- Jeff Mahoney SuSE Labs - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
- Previous message: Linus Torvalds: "Re: Linux 2.6.15-rc3"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
- Re: [PATCH] ohci1394: dma_pool_destroy while in_atomic() && irqs_disabled()
... > I disagree because the impact of this bug is small. ... I have to agree
that the impact is small even for the people using ISO recv - ... OTOH, if it allocates
so much of memory while irqs disabled and holding locks, ... send the line "unsubscribe linux-kernel"
in ... (Linux-Kernel) - Re: p = kmalloc(sizeof(*p), )
... some generic type not the full space for the more complex object ... Other good
practice in many cases is a single routine which allocates ... That removes duplicate
initialisers, stops people forgetting to ... send the line "unsubscribe linux-kernel"
in ... (Linux-Kernel) - Sock leak in net/ipv4/af_inet.c - 2.4.26
... It allocates from the sock slab using sk_alloc, ... sk_freeis never called on
these sock structs. ... around the sk_alloc/sk_free calls to track allocations.
... send the line "unsubscribe linux-kernel" in ... (Linux-Kernel) - Re: [patch] IBM HDAPS accelerometer driver.
... >> You also must not use any syscall that allocates even temporary memory
in ... >> shutdown or blocked at suspend. ... send the line "unsubscribe
linux-kernel" in ... (Linux-Kernel) - Re: can device drivers return non-ram via vm_ops->nopage?
... >> Remember that we're fond of telling driver writers to use scatter gather
... > anything else that doesn't use any IOTLB and just allocates a chunk of ...
send the line "unsubscribe linux-kernel" in ... (Linux-Kernel)