diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:28:14 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-20 13:28:14 -0400 |
commit | adfefb551517a0d0d1645e94f464817b8fb1a07f (patch) | |
tree | 5fce9d0ac131311b5d90a55d6132fbec6aa38dbe | |
parent | d2c5f06e361f18be0d7b75988ce6a9e8800a8113 (diff) | |
parent | b7d8ac3e1779c30ddef0a8f38042076c5007a23d (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes
* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-2.6-fixes:
[GFS2] gfs2_dir_read_data(): fix uninitialized variable usage
[GFS2] fs/gfs2/ops_fstype.c:fill_super_meta(): fix NULL dereference
[GFS2] fs/gfs2/dir.c:gfs2_dir_write_data(): don't use an uninitialized variable
[GFS2] fs/gfs2/ops_fstype.c:gfs2_get_sb_meta(): remove unused variable
[GFS2] fs/gfs2/dir.c:gfs2_dir_write_data(): remove dead code
[GFS2] gfs2 endianness bug: be16 assigned to be32 field
[GFS2] Fix bmap to map extents properly
[DLM] fix iovec length in recvmsg
-rw-r--r-- | fs/dlm/lowcomms.c | 1 | ||||
-rw-r--r-- | fs/gfs2/bmap.c | 13 | ||||
-rw-r--r-- | fs/gfs2/bmap.h | 2 | ||||
-rw-r--r-- | fs/gfs2/dir.c | 10 | ||||
-rw-r--r-- | fs/gfs2/log.c | 6 | ||||
-rw-r--r-- | fs/gfs2/ops_address.c | 6 | ||||
-rw-r--r-- | fs/gfs2/ops_fstype.c | 7 | ||||
-rw-r--r-- | fs/gfs2/quota.c | 5 | ||||
-rw-r--r-- | fs/gfs2/recovery.c | 5 |
9 files changed, 27 insertions, 28 deletions
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c index 867f93d0417e..6da6b14d5a61 100644 --- a/fs/dlm/lowcomms.c +++ b/fs/dlm/lowcomms.c | |||
@@ -519,6 +519,7 @@ static int receive_from_sock(void) | |||
519 | msg.msg_flags = 0; | 519 | msg.msg_flags = 0; |
520 | msg.msg_control = incmsg; | 520 | msg.msg_control = incmsg; |
521 | msg.msg_controllen = sizeof(incmsg); | 521 | msg.msg_controllen = sizeof(incmsg); |
522 | msg.msg_iovlen = 1; | ||
522 | 523 | ||
523 | /* I don't see why this circular buffer stuff is necessary for SCTP | 524 | /* I don't see why this circular buffer stuff is necessary for SCTP |
524 | * which is a packet-based protocol, but the whole thing breaks under | 525 | * which is a packet-based protocol, but the whole thing breaks under |
diff --git a/fs/gfs2/bmap.c b/fs/gfs2/bmap.c index cc57f2ecd219..06e9a8cb45e9 100644 --- a/fs/gfs2/bmap.c +++ b/fs/gfs2/bmap.c | |||
@@ -434,8 +434,7 @@ static int lookup_block(struct gfs2_inode *ip, struct buffer_head *bh, | |||
434 | */ | 434 | */ |
435 | 435 | ||
436 | static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create, | 436 | static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create, |
437 | struct buffer_head *bh_map, struct metapath *mp, | 437 | struct buffer_head *bh_map, struct metapath *mp) |
438 | unsigned int maxlen) | ||
439 | { | 438 | { |
440 | struct gfs2_inode *ip = GFS2_I(inode); | 439 | struct gfs2_inode *ip = GFS2_I(inode); |
441 | struct gfs2_sbd *sdp = GFS2_SB(inode); | 440 | struct gfs2_sbd *sdp = GFS2_SB(inode); |
@@ -448,6 +447,7 @@ static int gfs2_block_pointers(struct inode *inode, u64 lblock, int create, | |||
448 | int new = 0; | 447 | int new = 0; |
449 | u64 dblock = 0; | 448 | u64 dblock = 0; |
450 | int boundary; | 449 | int boundary; |
450 | unsigned int maxlen = bh_map->b_size >> inode->i_blkbits; | ||
451 | 451 | ||
452 | BUG_ON(maxlen == 0); | 452 | BUG_ON(maxlen == 0); |
453 | 453 | ||
@@ -541,13 +541,13 @@ static inline void bmap_unlock(struct inode *inode, int create) | |||
541 | } | 541 | } |
542 | 542 | ||
543 | int gfs2_block_map(struct inode *inode, u64 lblock, int create, | 543 | int gfs2_block_map(struct inode *inode, u64 lblock, int create, |
544 | struct buffer_head *bh, unsigned int maxlen) | 544 | struct buffer_head *bh) |
545 | { | 545 | { |
546 | struct metapath mp; | 546 | struct metapath mp; |
547 | int ret; | 547 | int ret; |
548 | 548 | ||
549 | bmap_lock(inode, create); | 549 | bmap_lock(inode, create); |
550 | ret = gfs2_block_pointers(inode, lblock, create, bh, &mp, maxlen); | 550 | ret = gfs2_block_pointers(inode, lblock, create, bh, &mp); |
551 | bmap_unlock(inode, create); | 551 | bmap_unlock(inode, create); |
552 | return ret; | 552 | return ret; |
553 | } | 553 | } |
@@ -555,7 +555,7 @@ int gfs2_block_map(struct inode *inode, u64 lblock, int create, | |||
555 | int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen) | 555 | int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen) |
556 | { | 556 | { |
557 | struct metapath mp; | 557 | struct metapath mp; |
558 | struct buffer_head bh = { .b_state = 0, .b_blocknr = 0, .b_size = 0 }; | 558 | struct buffer_head bh = { .b_state = 0, .b_blocknr = 0 }; |
559 | int ret; | 559 | int ret; |
560 | int create = *new; | 560 | int create = *new; |
561 | 561 | ||
@@ -563,8 +563,9 @@ int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsi | |||
563 | BUG_ON(!dblock); | 563 | BUG_ON(!dblock); |
564 | BUG_ON(!new); | 564 | BUG_ON(!new); |
565 | 565 | ||
566 | bh.b_size = 1 << (inode->i_blkbits + 5); | ||
566 | bmap_lock(inode, create); | 567 | bmap_lock(inode, create); |
567 | ret = gfs2_block_pointers(inode, lblock, create, &bh, &mp, 32); | 568 | ret = gfs2_block_pointers(inode, lblock, create, &bh, &mp); |
568 | bmap_unlock(inode, create); | 569 | bmap_unlock(inode, create); |
569 | *extlen = bh.b_size >> inode->i_blkbits; | 570 | *extlen = bh.b_size >> inode->i_blkbits; |
570 | *dblock = bh.b_blocknr; | 571 | *dblock = bh.b_blocknr; |
diff --git a/fs/gfs2/bmap.h b/fs/gfs2/bmap.h index 0fd379b4cd9e..ac2fd04370dc 100644 --- a/fs/gfs2/bmap.h +++ b/fs/gfs2/bmap.h | |||
@@ -15,7 +15,7 @@ struct gfs2_inode; | |||
15 | struct page; | 15 | struct page; |
16 | 16 | ||
17 | int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); | 17 | int gfs2_unstuff_dinode(struct gfs2_inode *ip, struct page *page); |
18 | int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh, unsigned int maxlen); | 18 | int gfs2_block_map(struct inode *inode, u64 lblock, int create, struct buffer_head *bh); |
19 | int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen); | 19 | int gfs2_extent_map(struct inode *inode, u64 lblock, int *new, u64 *dblock, unsigned *extlen); |
20 | 20 | ||
21 | int gfs2_truncatei(struct gfs2_inode *ip, u64 size); | 21 | int gfs2_truncatei(struct gfs2_inode *ip, u64 size); |
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 459498cac93b..e24af28b1a12 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c | |||
@@ -184,7 +184,7 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf, | |||
184 | while (copied < size) { | 184 | while (copied < size) { |
185 | unsigned int amount; | 185 | unsigned int amount; |
186 | struct buffer_head *bh; | 186 | struct buffer_head *bh; |
187 | int new; | 187 | int new = 0; |
188 | 188 | ||
189 | amount = size - copied; | 189 | amount = size - copied; |
190 | if (amount > sdp->sd_sb.sb_bsize - o) | 190 | if (amount > sdp->sd_sb.sb_bsize - o) |
@@ -212,8 +212,6 @@ static int gfs2_dir_write_data(struct gfs2_inode *ip, const char *buf, | |||
212 | gfs2_trans_add_bh(ip->i_gl, bh, 1); | 212 | gfs2_trans_add_bh(ip->i_gl, bh, 1); |
213 | memcpy(bh->b_data + o, buf, amount); | 213 | memcpy(bh->b_data + o, buf, amount); |
214 | brelse(bh); | 214 | brelse(bh); |
215 | if (error) | ||
216 | goto fail; | ||
217 | 215 | ||
218 | buf += amount; | 216 | buf += amount; |
219 | copied += amount; | 217 | copied += amount; |
@@ -317,8 +315,7 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset, | |||
317 | if (!ra) | 315 | if (!ra) |
318 | extlen = 1; | 316 | extlen = 1; |
319 | bh = gfs2_meta_ra(ip->i_gl, dblock, extlen); | 317 | bh = gfs2_meta_ra(ip->i_gl, dblock, extlen); |
320 | } | 318 | } else { |
321 | if (!bh) { | ||
322 | error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, &bh); | 319 | error = gfs2_meta_read(ip->i_gl, dblock, DIO_WAIT, &bh); |
323 | if (error) | 320 | if (error) |
324 | goto fail; | 321 | goto fail; |
@@ -332,7 +329,6 @@ static int gfs2_dir_read_data(struct gfs2_inode *ip, char *buf, u64 offset, | |||
332 | extlen--; | 329 | extlen--; |
333 | memcpy(buf, bh->b_data + o, amount); | 330 | memcpy(buf, bh->b_data + o, amount); |
334 | brelse(bh); | 331 | brelse(bh); |
335 | bh = NULL; | ||
336 | buf += amount; | 332 | buf += amount; |
337 | copied += amount; | 333 | copied += amount; |
338 | lblock++; | 334 | lblock++; |
@@ -815,7 +811,7 @@ static struct gfs2_leaf *new_leaf(struct inode *inode, struct buffer_head **pbh, | |||
815 | leaf = (struct gfs2_leaf *)bh->b_data; | 811 | leaf = (struct gfs2_leaf *)bh->b_data; |
816 | leaf->lf_depth = cpu_to_be16(depth); | 812 | leaf->lf_depth = cpu_to_be16(depth); |
817 | leaf->lf_entries = 0; | 813 | leaf->lf_entries = 0; |
818 | leaf->lf_dirent_format = cpu_to_be16(GFS2_FORMAT_DE); | 814 | leaf->lf_dirent_format = cpu_to_be32(GFS2_FORMAT_DE); |
819 | leaf->lf_next = 0; | 815 | leaf->lf_next = 0; |
820 | memset(leaf->lf_reserved, 0, sizeof(leaf->lf_reserved)); | 816 | memset(leaf->lf_reserved, 0, sizeof(leaf->lf_reserved)); |
821 | dent = (struct gfs2_dirent *)(leaf+1); | 817 | dent = (struct gfs2_dirent *)(leaf+1); |
diff --git a/fs/gfs2/log.c b/fs/gfs2/log.c index 72eec6542d6a..0cace3da9dbb 100644 --- a/fs/gfs2/log.c +++ b/fs/gfs2/log.c | |||
@@ -312,10 +312,12 @@ void gfs2_log_release(struct gfs2_sbd *sdp, unsigned int blks) | |||
312 | 312 | ||
313 | static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) | 313 | static u64 log_bmap(struct gfs2_sbd *sdp, unsigned int lbn) |
314 | { | 314 | { |
315 | struct inode *inode = sdp->sd_jdesc->jd_inode; | ||
315 | int error; | 316 | int error; |
316 | struct buffer_head bh_map; | 317 | struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; |
317 | 318 | ||
318 | error = gfs2_block_map(sdp->sd_jdesc->jd_inode, lbn, 0, &bh_map, 1); | 319 | bh_map.b_size = 1 << inode->i_blkbits; |
320 | error = gfs2_block_map(inode, lbn, 0, &bh_map); | ||
319 | if (error || !bh_map.b_blocknr) | 321 | if (error || !bh_map.b_blocknr) |
320 | printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, bh_map.b_blocknr, lbn); | 322 | printk(KERN_INFO "error=%d, dbn=%llu lbn=%u", error, bh_map.b_blocknr, lbn); |
321 | gfs2_assert_withdraw(sdp, !error && bh_map.b_blocknr); | 323 | gfs2_assert_withdraw(sdp, !error && bh_map.b_blocknr); |
diff --git a/fs/gfs2/ops_address.c b/fs/gfs2/ops_address.c index e0599fed99ce..8d5963c7e123 100644 --- a/fs/gfs2/ops_address.c +++ b/fs/gfs2/ops_address.c | |||
@@ -65,7 +65,7 @@ static void gfs2_page_add_databufs(struct gfs2_inode *ip, struct page *page, | |||
65 | int gfs2_get_block(struct inode *inode, sector_t lblock, | 65 | int gfs2_get_block(struct inode *inode, sector_t lblock, |
66 | struct buffer_head *bh_result, int create) | 66 | struct buffer_head *bh_result, int create) |
67 | { | 67 | { |
68 | return gfs2_block_map(inode, lblock, create, bh_result, 32); | 68 | return gfs2_block_map(inode, lblock, create, bh_result); |
69 | } | 69 | } |
70 | 70 | ||
71 | /** | 71 | /** |
@@ -83,7 +83,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock, | |||
83 | { | 83 | { |
84 | int error; | 84 | int error; |
85 | 85 | ||
86 | error = gfs2_block_map(inode, lblock, 0, bh_result, 1); | 86 | error = gfs2_block_map(inode, lblock, 0, bh_result); |
87 | if (error) | 87 | if (error) |
88 | return error; | 88 | return error; |
89 | if (bh_result->b_blocknr == 0) | 89 | if (bh_result->b_blocknr == 0) |
@@ -94,7 +94,7 @@ static int gfs2_get_block_noalloc(struct inode *inode, sector_t lblock, | |||
94 | static int gfs2_get_block_direct(struct inode *inode, sector_t lblock, | 94 | static int gfs2_get_block_direct(struct inode *inode, sector_t lblock, |
95 | struct buffer_head *bh_result, int create) | 95 | struct buffer_head *bh_result, int create) |
96 | { | 96 | { |
97 | return gfs2_block_map(inode, lblock, 0, bh_result, 32); | 97 | return gfs2_block_map(inode, lblock, 0, bh_result); |
98 | } | 98 | } |
99 | 99 | ||
100 | /** | 100 | /** |
diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 178b33911843..882873a6bd69 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c | |||
@@ -794,8 +794,8 @@ static int fill_super_meta(struct super_block *sb, struct super_block *new, | |||
794 | fs_err(sdp, "can't get root dentry\n"); | 794 | fs_err(sdp, "can't get root dentry\n"); |
795 | error = -ENOMEM; | 795 | error = -ENOMEM; |
796 | iput(inode); | 796 | iput(inode); |
797 | } | 797 | } else |
798 | new->s_root->d_op = &gfs2_dops; | 798 | new->s_root->d_op = &gfs2_dops; |
799 | 799 | ||
800 | return error; | 800 | return error; |
801 | } | 801 | } |
@@ -854,7 +854,6 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, | |||
854 | int error = 0; | 854 | int error = 0; |
855 | struct super_block *sb = NULL, *new; | 855 | struct super_block *sb = NULL, *new; |
856 | struct gfs2_sbd *sdp; | 856 | struct gfs2_sbd *sdp; |
857 | char *gfs2mnt = NULL; | ||
858 | 857 | ||
859 | sb = get_gfs2_sb(dev_name); | 858 | sb = get_gfs2_sb(dev_name); |
860 | if (!sb) { | 859 | if (!sb) { |
@@ -892,8 +891,6 @@ static int gfs2_get_sb_meta(struct file_system_type *fs_type, int flags, | |||
892 | atomic_inc(&sdp->sd_gfs2mnt->mnt_count); | 891 | atomic_inc(&sdp->sd_gfs2mnt->mnt_count); |
893 | return simple_set_mnt(mnt, new); | 892 | return simple_set_mnt(mnt, new); |
894 | error: | 893 | error: |
895 | if (gfs2mnt) | ||
896 | kfree(gfs2mnt); | ||
897 | return error; | 894 | return error; |
898 | } | 895 | } |
899 | 896 | ||
diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index c69b94a55588..a3deae7416c9 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c | |||
@@ -251,7 +251,7 @@ static int bh_get(struct gfs2_quota_data *qd) | |||
251 | unsigned int block, offset; | 251 | unsigned int block, offset; |
252 | struct buffer_head *bh; | 252 | struct buffer_head *bh; |
253 | int error; | 253 | int error; |
254 | struct buffer_head bh_map; | 254 | struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; |
255 | 255 | ||
256 | mutex_lock(&sdp->sd_quota_mutex); | 256 | mutex_lock(&sdp->sd_quota_mutex); |
257 | 257 | ||
@@ -263,7 +263,8 @@ static int bh_get(struct gfs2_quota_data *qd) | |||
263 | block = qd->qd_slot / sdp->sd_qc_per_block; | 263 | block = qd->qd_slot / sdp->sd_qc_per_block; |
264 | offset = qd->qd_slot % sdp->sd_qc_per_block;; | 264 | offset = qd->qd_slot % sdp->sd_qc_per_block;; |
265 | 265 | ||
266 | error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map, 1); | 266 | bh_map.b_size = 1 << ip->i_inode.i_blkbits; |
267 | error = gfs2_block_map(&ip->i_inode, block, 0, &bh_map); | ||
267 | if (error) | 268 | if (error) |
268 | goto fail; | 269 | goto fail; |
269 | error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh); | 270 | error = gfs2_meta_read(ip->i_gl, bh_map.b_blocknr, DIO_WAIT, &bh); |
diff --git a/fs/gfs2/recovery.c b/fs/gfs2/recovery.c index 0a8a4b87dcc6..62cd223819b7 100644 --- a/fs/gfs2/recovery.c +++ b/fs/gfs2/recovery.c | |||
@@ -372,11 +372,12 @@ static int clean_journal(struct gfs2_jdesc *jd, struct gfs2_log_header *head) | |||
372 | u32 hash; | 372 | u32 hash; |
373 | struct buffer_head *bh; | 373 | struct buffer_head *bh; |
374 | int error; | 374 | int error; |
375 | struct buffer_head bh_map; | 375 | struct buffer_head bh_map = { .b_state = 0, .b_blocknr = 0 }; |
376 | 376 | ||
377 | lblock = head->lh_blkno; | 377 | lblock = head->lh_blkno; |
378 | gfs2_replay_incr_blk(sdp, &lblock); | 378 | gfs2_replay_incr_blk(sdp, &lblock); |
379 | error = gfs2_block_map(&ip->i_inode, lblock, 0, &bh_map, 1); | 379 | bh_map.b_size = 1 << ip->i_inode.i_blkbits; |
380 | error = gfs2_block_map(&ip->i_inode, lblock, 0, &bh_map); | ||
380 | if (error) | 381 | if (error) |
381 | return error; | 382 | return error; |
382 | if (!bh_map.b_blocknr) { | 383 | if (!bh_map.b_blocknr) { |