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 tag 'gfs2-4.20.fixes3' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2

Pull bfs2 fixes from Andreas Gruenbacher:
"Fix two bugs leading to leaked buffer head references:

- gfs2: Put bitmap buffers in put_super
- gfs2: Fix iomap buffer head reference counting bug

And one bug leading to significant slow-downs when deleting large
files:

- gfs2: Fix metadata read-ahead during truncate (2)"

* tag 'gfs2-4.20.fixes3' of git://git.kernel.org/pub/scm/linux/kernel/git/gfs2/linux-gfs2:
gfs2: Fix iomap buffer head reference counting bug
gfs2: Fix metadata read-ahead during truncate (2)
gfs2: Put bitmap buffers in put_super

+29 -28
+27 -27
fs/gfs2/bmap.c
··· 826 826 ret = gfs2_meta_inode_buffer(ip, &dibh); 827 827 if (ret) 828 828 goto unlock; 829 - iomap->private = dibh; 829 + mp->mp_bh[0] = dibh; 830 830 831 831 if (gfs2_is_stuffed(ip)) { 832 832 if (flags & IOMAP_WRITE) { ··· 863 863 len = lblock_stop - lblock + 1; 864 864 iomap->length = len << inode->i_blkbits; 865 865 866 - get_bh(dibh); 867 - mp->mp_bh[0] = dibh; 868 - 869 866 height = ip->i_height; 870 867 while ((lblock + 1) * sdp->sd_sb.sb_bsize > sdp->sd_heightsize[height]) 871 868 height++; ··· 895 898 iomap->bdev = inode->i_sb->s_bdev; 896 899 unlock: 897 900 up_read(&ip->i_rw_mutex); 898 - if (ret && dibh) 899 - brelse(dibh); 900 901 return ret; 901 902 902 903 do_alloc: ··· 975 980 976 981 static int gfs2_iomap_begin_write(struct inode *inode, loff_t pos, 977 982 loff_t length, unsigned flags, 978 - struct iomap *iomap) 983 + struct iomap *iomap, 984 + struct metapath *mp) 979 985 { 980 - struct metapath mp = { .mp_aheight = 1, }; 981 986 struct gfs2_inode *ip = GFS2_I(inode); 982 987 struct gfs2_sbd *sdp = GFS2_SB(inode); 983 988 unsigned int data_blocks = 0, ind_blocks = 0, rblocks; ··· 991 996 unstuff = gfs2_is_stuffed(ip) && 992 997 pos + length > gfs2_max_stuffed_size(ip); 993 998 994 - ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); 999 + ret = gfs2_iomap_get(inode, pos, length, flags, iomap, mp); 995 1000 if (ret) 996 - goto out_release; 1001 + goto out_unlock; 997 1002 998 1003 alloc_required = unstuff || iomap->type == IOMAP_HOLE; 999 1004 ··· 1008 1013 1009 1014 ret = gfs2_quota_lock_check(ip, &ap); 1010 1015 if (ret) 1011 - goto out_release; 1016 + goto out_unlock; 1012 1017 1013 1018 ret = gfs2_inplace_reserve(ip, &ap); 1014 1019 if (ret) ··· 1033 1038 ret = gfs2_unstuff_dinode(ip, NULL); 1034 1039 if (ret) 1035 1040 goto out_trans_end; 1036 - release_metapath(&mp); 1037 - brelse(iomap->private); 1038 - iomap->private = NULL; 1041 + release_metapath(mp); 1039 1042 ret = gfs2_iomap_get(inode, iomap->offset, iomap->length, 1040 - flags, iomap, &mp); 1043 + flags, iomap, mp); 1041 1044 if (ret) 1042 1045 goto out_trans_end; 1043 1046 } 1044 1047 1045 1048 if (iomap->type == IOMAP_HOLE) { 1046 - ret = gfs2_iomap_alloc(inode, iomap, flags, &mp); 1049 + ret = gfs2_iomap_alloc(inode, iomap, flags, mp); 1047 1050 if (ret) { 1048 1051 gfs2_trans_end(sdp); 1049 1052 gfs2_inplace_release(ip); ··· 1049 1056 goto out_qunlock; 1050 1057 } 1051 1058 } 1052 - release_metapath(&mp); 1053 1059 if (!gfs2_is_stuffed(ip) && gfs2_is_jdata(ip)) 1054 1060 iomap->page_done = gfs2_iomap_journaled_page_done; 1055 1061 return 0; ··· 1061 1069 out_qunlock: 1062 1070 if (alloc_required) 1063 1071 gfs2_quota_unlock(ip); 1064 - out_release: 1065 - if (iomap->private) 1066 - brelse(iomap->private); 1067 - release_metapath(&mp); 1072 + out_unlock: 1068 1073 gfs2_write_unlock(inode); 1069 1074 return ret; 1070 1075 } ··· 1077 1088 1078 1089 trace_gfs2_iomap_start(ip, pos, length, flags); 1079 1090 if ((flags & IOMAP_WRITE) && !(flags & IOMAP_DIRECT)) { 1080 - ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap); 1091 + ret = gfs2_iomap_begin_write(inode, pos, length, flags, iomap, &mp); 1081 1092 } else { 1082 1093 ret = gfs2_iomap_get(inode, pos, length, flags, iomap, &mp); 1083 - release_metapath(&mp); 1094 + 1084 1095 /* 1085 1096 * Silently fall back to buffered I/O for stuffed files or if 1086 1097 * we've hot a hole (see gfs2_file_direct_write). ··· 1089 1100 iomap->type != IOMAP_MAPPED) 1090 1101 ret = -ENOTBLK; 1091 1102 } 1103 + if (!ret) { 1104 + get_bh(mp.mp_bh[0]); 1105 + iomap->private = mp.mp_bh[0]; 1106 + } 1107 + release_metapath(&mp); 1092 1108 trace_gfs2_iomap_end(ip, iomap, ret); 1093 1109 return ret; 1094 1110 } ··· 1902 1908 if (ret < 0) 1903 1909 goto out; 1904 1910 1905 - /* issue read-ahead on metadata */ 1906 - if (mp.mp_aheight > 1) { 1907 - for (; ret > 1; ret--) { 1908 - metapointer_range(&mp, mp.mp_aheight - ret, 1911 + /* On the first pass, issue read-ahead on metadata. */ 1912 + if (mp.mp_aheight > 1 && strip_h == ip->i_height - 1) { 1913 + unsigned int height = mp.mp_aheight - 1; 1914 + 1915 + /* No read-ahead for data blocks. */ 1916 + if (mp.mp_aheight - 1 == strip_h) 1917 + height--; 1918 + 1919 + for (; height >= mp.mp_aheight - ret; height--) { 1920 + metapointer_range(&mp, height, 1909 1921 start_list, start_aligned, 1910 1922 end_list, end_aligned, 1911 1923 &start, &end);
+2 -1
fs/gfs2/rgrp.c
··· 733 733 734 734 if (gl) { 735 735 glock_clear_object(gl, rgd); 736 + gfs2_rgrp_brelse(rgd); 736 737 gfs2_glock_put(gl); 737 738 } 738 739 ··· 1175 1174 * @rgd: the struct gfs2_rgrpd describing the RG to read in 1176 1175 * 1177 1176 * Read in all of a Resource Group's header and bitmap blocks. 1178 - * Caller must eventually call gfs2_rgrp_relse() to free the bitmaps. 1177 + * Caller must eventually call gfs2_rgrp_brelse() to free the bitmaps. 1179 1178 * 1180 1179 * Returns: errno 1181 1180 */