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 branch 'for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
"Filipe hit two problems in my block group cache patches. We finalized
the fixes last week and ran through more tests"

* 'for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
Btrfs: prevent list corruption during free space cache processing
Btrfs: fix inode cache writeout

+25 -17
+25 -17
fs/btrfs/free-space-cache.c
··· 1119 1119 } 1120 1120 1121 1121 static void noinline_for_stack 1122 - cleanup_write_cache_enospc(struct inode *inode, 1123 - struct btrfs_io_ctl *io_ctl, 1124 - struct extent_state **cached_state, 1125 - struct list_head *bitmap_list) 1122 + cleanup_bitmap_list(struct list_head *bitmap_list) 1126 1123 { 1127 1124 struct list_head *pos, *n; 1128 1125 ··· 1128 1131 list_entry(pos, struct btrfs_free_space, list); 1129 1132 list_del_init(&entry->list); 1130 1133 } 1134 + } 1135 + 1136 + static void noinline_for_stack 1137 + cleanup_write_cache_enospc(struct inode *inode, 1138 + struct btrfs_io_ctl *io_ctl, 1139 + struct extent_state **cached_state, 1140 + struct list_head *bitmap_list) 1141 + { 1131 1142 io_ctl_drop_pages(io_ctl); 1132 1143 unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, 1133 1144 i_size_read(inode) - 1, cached_state, ··· 1154 1149 if (!inode) 1155 1150 return 0; 1156 1151 1157 - root = root->fs_info->tree_root; 1152 + if (block_group) 1153 + root = root->fs_info->tree_root; 1158 1154 1159 1155 /* Flush the dirty pages in the cache file. */ 1160 1156 ret = flush_dirty_cache(inode); ··· 1271 1265 ret = write_cache_extent_entries(io_ctl, ctl, 1272 1266 block_group, &entries, &bitmaps, 1273 1267 &bitmap_list); 1274 - spin_unlock(&ctl->tree_lock); 1275 - if (ret) { 1276 - mutex_unlock(&ctl->cache_writeout_mutex); 1277 - goto out_nospc; 1278 - } 1268 + if (ret) 1269 + goto out_nospc_locked; 1279 1270 1280 1271 /* 1281 1272 * Some spaces that are freed in the current transaction are pinned, ··· 1283 1280 * the dirty list and redo it. No locking needed 1284 1281 */ 1285 1282 ret = write_pinned_extent_entries(root, block_group, io_ctl, &entries); 1286 - if (ret) { 1287 - mutex_unlock(&ctl->cache_writeout_mutex); 1288 - goto out_nospc; 1289 - } 1283 + if (ret) 1284 + goto out_nospc_locked; 1290 1285 1291 1286 /* 1292 1287 * At last, we write out all the bitmaps and keep cache_writeout_mutex 1293 1288 * locked while doing it because a concurrent trim can be manipulating 1294 1289 * or freeing the bitmap. 1295 1290 */ 1296 - spin_lock(&ctl->tree_lock); 1297 1291 ret = write_bitmap_entries(io_ctl, &bitmap_list); 1298 1292 spin_unlock(&ctl->tree_lock); 1299 1293 mutex_unlock(&ctl->cache_writeout_mutex); ··· 1342 1342 if (must_iput) 1343 1343 iput(inode); 1344 1344 return ret; 1345 + 1346 + out_nospc_locked: 1347 + cleanup_bitmap_list(&bitmap_list); 1348 + spin_unlock(&ctl->tree_lock); 1349 + mutex_unlock(&ctl->cache_writeout_mutex); 1345 1350 1346 1351 out_nospc: 1347 1352 cleanup_write_cache_enospc(inode, io_ctl, &cached_state, &bitmap_list); ··· 3468 3463 if (!btrfs_test_opt(root, INODE_MAP_CACHE)) 3469 3464 return 0; 3470 3465 3466 + memset(&io_ctl, 0, sizeof(io_ctl)); 3471 3467 ret = __btrfs_write_out_cache(root, inode, ctl, NULL, &io_ctl, 3472 - trans, path, 0) || 3473 - btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); 3468 + trans, path, 0); 3469 + if (!ret) 3470 + ret = btrfs_wait_cache_io(root, trans, NULL, &io_ctl, path, 0); 3471 + 3474 3472 if (ret) { 3475 3473 btrfs_delalloc_release_metadata(inode, inode->i_size); 3476 3474 #ifdef DEBUG