diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-19 13:12:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-05-19 13:12:17 -0400 |
commit | 14e931a264498fbd4baef07ee0644e347252393b (patch) | |
tree | c202cd976f478fed3d7d786521ab3e32abdc0f9e /fs | |
parent | a2ae9787568ac50978c03ce67bfb79ad2e100cca (diff) | |
parent | 05c69d298c96703741cac9a5cbbf6c53bd55a6e2 (diff) |
Merge branch 'for-linus' of git://git.kernel.dk/linux-block
Pull block layer fixes from Jens Axboe:
"A few small, but important fixes. Most of them are marked for stable
as well
- Fix failure to release a semaphore on error path in mtip32xx.
- Fix crashable condition in bio_get_nr_vecs().
- Don't mark end-of-disk buffers as mapped, limit it to i_size.
- Fix for build problem with CONFIG_BLOCK=n on arm at least.
- Fix for a buffer overlow on UUID partition printing.
- Trivial removal of unused variables in dac960."
* 'for-linus' of git://git.kernel.dk/linux-block:
block: fix buffer overflow when printing partition UUIDs
Fix blkdev.h build errors when BLOCK=n
bio allocation failure due to bio_get_nr_vecs()
block: don't mark buffers beyond end of disk as mapped
mtip32xx: release the semaphore on an error path
dac960: Remove unused variables from DAC960_CreateProcEntries()
Diffstat (limited to 'fs')
-rw-r--r-- | fs/bio.c | 7 | ||||
-rw-r--r-- | fs/block_dev.c | 6 | ||||
-rw-r--r-- | fs/buffer.c | 4 |
3 files changed, 12 insertions, 5 deletions
@@ -505,9 +505,14 @@ EXPORT_SYMBOL(bio_clone); | |||
505 | int bio_get_nr_vecs(struct block_device *bdev) | 505 | int bio_get_nr_vecs(struct block_device *bdev) |
506 | { | 506 | { |
507 | struct request_queue *q = bdev_get_queue(bdev); | 507 | struct request_queue *q = bdev_get_queue(bdev); |
508 | return min_t(unsigned, | 508 | int nr_pages; |
509 | |||
510 | nr_pages = min_t(unsigned, | ||
509 | queue_max_segments(q), | 511 | queue_max_segments(q), |
510 | queue_max_sectors(q) / (PAGE_SIZE >> 9) + 1); | 512 | queue_max_sectors(q) / (PAGE_SIZE >> 9) + 1); |
513 | |||
514 | return min_t(unsigned, nr_pages, BIO_MAX_PAGES); | ||
515 | |||
511 | } | 516 | } |
512 | EXPORT_SYMBOL(bio_get_nr_vecs); | 517 | EXPORT_SYMBOL(bio_get_nr_vecs); |
513 | 518 | ||
diff --git a/fs/block_dev.c b/fs/block_dev.c index e08f6a20a5bb..ba11c30f302d 100644 --- a/fs/block_dev.c +++ b/fs/block_dev.c | |||
@@ -70,7 +70,7 @@ static void bdev_inode_switch_bdi(struct inode *inode, | |||
70 | spin_unlock(&dst->wb.list_lock); | 70 | spin_unlock(&dst->wb.list_lock); |
71 | } | 71 | } |
72 | 72 | ||
73 | static sector_t max_block(struct block_device *bdev) | 73 | sector_t blkdev_max_block(struct block_device *bdev) |
74 | { | 74 | { |
75 | sector_t retval = ~((sector_t)0); | 75 | sector_t retval = ~((sector_t)0); |
76 | loff_t sz = i_size_read(bdev->bd_inode); | 76 | loff_t sz = i_size_read(bdev->bd_inode); |
@@ -163,7 +163,7 @@ static int | |||
163 | blkdev_get_block(struct inode *inode, sector_t iblock, | 163 | blkdev_get_block(struct inode *inode, sector_t iblock, |
164 | struct buffer_head *bh, int create) | 164 | struct buffer_head *bh, int create) |
165 | { | 165 | { |
166 | if (iblock >= max_block(I_BDEV(inode))) { | 166 | if (iblock >= blkdev_max_block(I_BDEV(inode))) { |
167 | if (create) | 167 | if (create) |
168 | return -EIO; | 168 | return -EIO; |
169 | 169 | ||
@@ -185,7 +185,7 @@ static int | |||
185 | blkdev_get_blocks(struct inode *inode, sector_t iblock, | 185 | blkdev_get_blocks(struct inode *inode, sector_t iblock, |
186 | struct buffer_head *bh, int create) | 186 | struct buffer_head *bh, int create) |
187 | { | 187 | { |
188 | sector_t end_block = max_block(I_BDEV(inode)); | 188 | sector_t end_block = blkdev_max_block(I_BDEV(inode)); |
189 | unsigned long max_blocks = bh->b_size >> inode->i_blkbits; | 189 | unsigned long max_blocks = bh->b_size >> inode->i_blkbits; |
190 | 190 | ||
191 | if ((iblock + max_blocks) > end_block) { | 191 | if ((iblock + max_blocks) > end_block) { |
diff --git a/fs/buffer.c b/fs/buffer.c index 351e18ea2e53..ad5938ca357c 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -921,6 +921,7 @@ init_page_buffers(struct page *page, struct block_device *bdev, | |||
921 | struct buffer_head *head = page_buffers(page); | 921 | struct buffer_head *head = page_buffers(page); |
922 | struct buffer_head *bh = head; | 922 | struct buffer_head *bh = head; |
923 | int uptodate = PageUptodate(page); | 923 | int uptodate = PageUptodate(page); |
924 | sector_t end_block = blkdev_max_block(I_BDEV(bdev->bd_inode)); | ||
924 | 925 | ||
925 | do { | 926 | do { |
926 | if (!buffer_mapped(bh)) { | 927 | if (!buffer_mapped(bh)) { |
@@ -929,7 +930,8 @@ init_page_buffers(struct page *page, struct block_device *bdev, | |||
929 | bh->b_blocknr = block; | 930 | bh->b_blocknr = block; |
930 | if (uptodate) | 931 | if (uptodate) |
931 | set_buffer_uptodate(bh); | 932 | set_buffer_uptodate(bh); |
932 | set_buffer_mapped(bh); | 933 | if (block < end_block) |
934 | set_buffer_mapped(bh); | ||
933 | } | 935 | } |
934 | block++; | 936 | block++; |
935 | bh = bh->b_this_page; | 937 | bh = bh->b_this_page; |