Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes

Pull gfs2 fixes from Steven Whitehouse:
"Here are a number of GFS2 bug fixes. There are three from Andy Price
which fix various issues spotted by automated code analysis. There
are two from Lukas Czerner fixing my mistaken assumptions as to how
FITRIM should work. Finally Ben Marzinski has fixed a bug relating to
mmap and atime and also a bug relating to a locking issue in the
transaction code."

* git://git.kernel.org/pub/scm/linux/kernel/git/steve/gfs2-3.0-fixes:
GFS2: Test bufdata with buffer locked and gfs2_log_lock held
GFS2: Don't call file_accessed() with a shared glock
GFS2: Fix FITRIM argument handling
GFS2: Require user to provide argument for FITRIM
GFS2: Clean up some unused assignments
GFS2: Fix possible null pointer deref in gfs2_rs_alloc
GFS2: Fix an unchecked error from gfs2_rs_alloc

+43 -38
+5 -9
fs/gfs2/file.c
··· 516 516 struct gfs2_holder i_gh; 517 517 int error; 518 518 519 - gfs2_holder_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh); 520 - error = gfs2_glock_nq(&i_gh); 521 - if (error == 0) { 522 - file_accessed(file); 523 - gfs2_glock_dq(&i_gh); 524 - } 525 - gfs2_holder_uninit(&i_gh); 519 + error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, 520 + &i_gh); 526 521 if (error) 527 522 return error; 523 + /* grab lock to update inode */ 524 + gfs2_glock_dq_uninit(&i_gh); 525 + file_accessed(file); 528 526 } 529 527 vma->vm_ops = &gfs2_vm_ops; 530 528 ··· 675 677 size_t writesize = iov_length(iov, nr_segs); 676 678 struct dentry *dentry = file->f_dentry; 677 679 struct gfs2_inode *ip = GFS2_I(dentry->d_inode); 678 - struct gfs2_sbd *sdp; 679 680 int ret; 680 681 681 - sdp = GFS2_SB(file->f_mapping->host); 682 682 ret = gfs2_rs_alloc(ip); 683 683 if (ret) 684 684 return ret;
+2 -14
fs/gfs2/lops.c
··· 393 393 struct gfs2_meta_header *mh; 394 394 struct gfs2_trans *tr; 395 395 396 - lock_buffer(bd->bd_bh); 397 - gfs2_log_lock(sdp); 398 396 tr = current->journal_info; 399 397 tr->tr_touched = 1; 400 398 if (!list_empty(&bd->bd_list)) 401 - goto out; 399 + return; 402 400 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); 403 401 set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags); 404 402 mh = (struct gfs2_meta_header *)bd->bd_bh->b_data; ··· 412 414 sdp->sd_log_num_buf++; 413 415 list_add(&bd->bd_list, &sdp->sd_log_le_buf); 414 416 tr->tr_num_buf_new++; 415 - out: 416 - gfs2_log_unlock(sdp); 417 - unlock_buffer(bd->bd_bh); 418 417 } 419 418 420 419 static void gfs2_check_magic(struct buffer_head *bh) ··· 616 621 617 622 static void revoke_lo_before_commit(struct gfs2_sbd *sdp) 618 623 { 619 - struct gfs2_log_descriptor *ld; 620 624 struct gfs2_meta_header *mh; 621 625 unsigned int offset; 622 626 struct list_head *head = &sdp->sd_log_le_revoke; ··· 628 634 629 635 length = gfs2_struct2blk(sdp, sdp->sd_log_num_revoke, sizeof(u64)); 630 636 page = gfs2_get_log_desc(sdp, GFS2_LOG_DESC_REVOKE, length, sdp->sd_log_num_revoke); 631 - ld = page_address(page); 632 637 offset = sizeof(struct gfs2_log_descriptor); 633 638 634 639 list_for_each_entry(bd, head, bd_list) { ··· 770 777 struct address_space *mapping = bd->bd_bh->b_page->mapping; 771 778 struct gfs2_inode *ip = GFS2_I(mapping->host); 772 779 773 - lock_buffer(bd->bd_bh); 774 - gfs2_log_lock(sdp); 775 780 if (tr) 776 781 tr->tr_touched = 1; 777 782 if (!list_empty(&bd->bd_list)) 778 - goto out; 783 + return; 779 784 set_bit(GLF_LFLUSH, &bd->bd_gl->gl_flags); 780 785 set_bit(GLF_DIRTY, &bd->bd_gl->gl_flags); 781 786 if (gfs2_is_jdata(ip)) { ··· 784 793 } else { 785 794 list_add_tail(&bd->bd_list, &sdp->sd_log_le_ordered); 786 795 } 787 - out: 788 - gfs2_log_unlock(sdp); 789 - unlock_buffer(bd->bd_bh); 790 796 } 791 797 792 798 /**
+5 -2
fs/gfs2/quota.c
··· 497 497 struct gfs2_quota_data **qd; 498 498 int error; 499 499 500 - if (ip->i_res == NULL) 501 - gfs2_rs_alloc(ip); 500 + if (ip->i_res == NULL) { 501 + error = gfs2_rs_alloc(ip); 502 + if (error) 503 + return error; 504 + } 502 505 503 506 qd = ip->i_res->rs_qa_qd; 504 507
+21 -12
fs/gfs2/rgrp.c
··· 553 553 */ 554 554 int gfs2_rs_alloc(struct gfs2_inode *ip) 555 555 { 556 - int error = 0; 557 556 struct gfs2_blkreserv *res; 558 557 559 558 if (ip->i_res) ··· 560 561 561 562 res = kmem_cache_zalloc(gfs2_rsrv_cachep, GFP_NOFS); 562 563 if (!res) 563 - error = -ENOMEM; 564 + return -ENOMEM; 564 565 565 566 RB_CLEAR_NODE(&res->rs_node); 566 567 ··· 570 571 else 571 572 ip->i_res = res; 572 573 up_write(&ip->i_rw_mutex); 573 - return error; 574 + return 0; 574 575 } 575 576 576 577 static void dump_rs(struct seq_file *seq, const struct gfs2_blkreserv *rs) ··· 1262 1263 int ret = 0; 1263 1264 u64 amt; 1264 1265 u64 trimmed = 0; 1266 + u64 start, end, minlen; 1265 1267 unsigned int x; 1268 + unsigned bs_shift = sdp->sd_sb.sb_bsize_shift; 1266 1269 1267 1270 if (!capable(CAP_SYS_ADMIN)) 1268 1271 return -EPERM; ··· 1272 1271 if (!blk_queue_discard(q)) 1273 1272 return -EOPNOTSUPP; 1274 1273 1275 - if (argp == NULL) { 1276 - r.start = 0; 1277 - r.len = ULLONG_MAX; 1278 - r.minlen = 0; 1279 - } else if (copy_from_user(&r, argp, sizeof(r))) 1274 + if (copy_from_user(&r, argp, sizeof(r))) 1280 1275 return -EFAULT; 1281 1276 1282 1277 ret = gfs2_rindex_update(sdp); 1283 1278 if (ret) 1284 1279 return ret; 1285 1280 1286 - rgd = gfs2_blk2rgrpd(sdp, r.start, 0); 1287 - rgd_end = gfs2_blk2rgrpd(sdp, r.start + r.len, 0); 1281 + start = r.start >> bs_shift; 1282 + end = start + (r.len >> bs_shift); 1283 + minlen = max_t(u64, r.minlen, 1284 + q->limits.discard_granularity) >> bs_shift; 1285 + 1286 + rgd = gfs2_blk2rgrpd(sdp, start, 0); 1287 + rgd_end = gfs2_blk2rgrpd(sdp, end - 1, 0); 1288 + 1289 + if (end <= start || 1290 + minlen > sdp->sd_max_rg_data || 1291 + start > rgd_end->rd_data0 + rgd_end->rd_data) 1292 + return -EINVAL; 1288 1293 1289 1294 while (1) { 1290 1295 ··· 1302 1295 /* Trim each bitmap in the rgrp */ 1303 1296 for (x = 0; x < rgd->rd_length; x++) { 1304 1297 struct gfs2_bitmap *bi = rgd->rd_bits + x; 1305 - ret = gfs2_rgrp_send_discards(sdp, rgd->rd_data0, NULL, bi, r.minlen, &amt); 1298 + ret = gfs2_rgrp_send_discards(sdp, 1299 + rgd->rd_data0, NULL, bi, minlen, 1300 + &amt); 1306 1301 if (ret) { 1307 1302 gfs2_glock_dq_uninit(&gh); 1308 1303 goto out; ··· 1333 1324 1334 1325 out: 1335 1326 r.len = trimmed << 9; 1336 - if (argp && copy_to_user(argp, &r, sizeof(r))) 1327 + if (copy_to_user(argp, &r, sizeof(r))) 1337 1328 return -EFAULT; 1338 1329 1339 1330 return ret;
+2 -1
fs/gfs2/super.c
··· 810 810 return; 811 811 } 812 812 need_unlock = 1; 813 - } 813 + } else if (WARN_ON_ONCE(ip->i_gl->gl_state != LM_ST_EXCLUSIVE)) 814 + return; 814 815 815 816 if (current->journal_info == NULL) { 816 817 ret = gfs2_trans_begin(sdp, RES_DINODE, 0);
+8
fs/gfs2/trans.c
··· 155 155 struct gfs2_sbd *sdp = gl->gl_sbd; 156 156 struct gfs2_bufdata *bd; 157 157 158 + lock_buffer(bh); 159 + gfs2_log_lock(sdp); 158 160 bd = bh->b_private; 159 161 if (bd) 160 162 gfs2_assert(sdp, bd->bd_gl == gl); 161 163 else { 164 + gfs2_log_unlock(sdp); 165 + unlock_buffer(bh); 162 166 gfs2_attach_bufdata(gl, bh, meta); 163 167 bd = bh->b_private; 168 + lock_buffer(bh); 169 + gfs2_log_lock(sdp); 164 170 } 165 171 lops_add(sdp, bd); 172 + gfs2_log_unlock(sdp); 173 + unlock_buffer(bh); 166 174 } 167 175 168 176 void gfs2_trans_add_revoke(struct gfs2_sbd *sdp, struct gfs2_bufdata *bd)