From: Nikanth Karthikesan <knikanth@suse.de>
To: Dave Kleikamp <shaggy@austin.ibm.com>
Cc: Jens Axboe <jens.axboe@oracle.com>,
linux-kernel@vger.kernel.org,
jfs-discussion@lists.sourceforge.net
Subject: [PATCH 4/6] Handle possible bio_alloc failure in jfs
Date: Tue, 14 Apr 2009 16:36:42 +0530 [thread overview]
Message-ID: <200904141636.42874.knikanth@suse.de> (raw)
Handle bio_alloc failure in jfs.
Signed-off-by: Nikanth Karthikesan <knikanth@suse.de>
---
Index: linux-2.6/fs/jfs/jfs_logmgr.c
===================================================================
--- linux-2.6.orig/fs/jfs/jfs_logmgr.c
+++ linux-2.6/fs/jfs/jfs_logmgr.c
@@ -2003,6 +2003,8 @@ static int lbmRead(struct jfs_log * log,
bp->l_flag |= lbmREAD;
bio = bio_alloc(GFP_NOFS, 1);
+ if (unlikely(!bio))
+ return -ENOMEM;
bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
bio->bi_bdev = log->bdev;
@@ -2145,6 +2147,9 @@ static void lbmStartIO(struct lbuf * bp)
jfs_info("lbmStartIO\n");
bio = bio_alloc(GFP_NOFS, 1);
+ if (unlikely(!bio))
+ panic("Unable to allocate bio\n");
+
bio->bi_sector = bp->l_blkno << (log->l2bsize - 9);
bio->bi_bdev = log->bdev;
bio->bi_io_vec[0].bv_page = bp->l_page;
Index: linux-2.6/fs/jfs/jfs_metapage.c
===================================================================
--- linux-2.6.orig/fs/jfs/jfs_metapage.c
+++ linux-2.6/fs/jfs/jfs_metapage.c
@@ -436,6 +436,9 @@ static int metapage_writepage(struct pag
len = min(xlen, (int)JFS_SBI(inode->i_sb)->nbperpage);
bio = bio_alloc(GFP_NOFS, 1);
+ if (unlikely(!bio))
+ return -ENOMEM;
+
bio->bi_bdev = inode->i_sb->s_bdev;
bio->bi_sector = pblock << (inode->i_blkbits - 9);
bio->bi_end_io = metapage_write_end_io;
@@ -515,6 +518,9 @@ static int metapage_readpage(struct file
submit_bio(READ, bio);
bio = bio_alloc(GFP_NOFS, 1);
+ if (unlikely(!bio))
+ return -ENOMEM;
+
bio->bi_bdev = inode->i_sb->s_bdev;
bio->bi_sector = pblock << (inode->i_blkbits - 9);
bio->bi_end_io = metapage_read_end_io;
reply other threads:[~2009-04-14 11:11 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200904141636.42874.knikanth@suse.de \
--to=knikanth@suse.de \
--cc=jens.axboe@oracle.com \
--cc=jfs-discussion@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=shaggy@austin.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox