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 'ext4_for_linus-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4

Pull ext4 fixes from Ted Ts'o:
"Fix some ext4 bugs and regressions relating to oneline resize and fast
commits"

* tag 'ext4_for_linus-5.12-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
ext4: fix off by one issue in alloc_flex_gd()
ext4: mark fc as ineligible using an handle in ext4_xattr_set()
ext4: use handle to mark fc as ineligible in __track_dentry_update()

+23 -17
+11 -8
fs/ext4/fast_commit.c
··· 379 379 */ 380 380 static int ext4_fc_track_template( 381 381 handle_t *handle, struct inode *inode, 382 - int (*__fc_track_fn)(struct inode *, void *, bool), 382 + int (*__fc_track_fn)(handle_t *handle, struct inode *, void *, bool), 383 383 void *args, int enqueue) 384 384 { 385 385 bool update = false; ··· 396 396 ext4_fc_reset_inode(inode); 397 397 ei->i_sync_tid = tid; 398 398 } 399 - ret = __fc_track_fn(inode, args, update); 399 + ret = __fc_track_fn(handle, inode, args, update); 400 400 mutex_unlock(&ei->i_fc_lock); 401 401 402 402 if (!enqueue) ··· 420 420 }; 421 421 422 422 /* __track_fn for directory entry updates. Called with ei->i_fc_lock. */ 423 - static int __track_dentry_update(struct inode *inode, void *arg, bool update) 423 + static int __track_dentry_update(handle_t *handle, struct inode *inode, 424 + void *arg, bool update) 424 425 { 425 426 struct ext4_fc_dentry_update *node; 426 427 struct ext4_inode_info *ei = EXT4_I(inode); ··· 436 435 437 436 if (IS_ENCRYPTED(dir)) { 438 437 ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_ENCRYPTED_FILENAME, 439 - NULL); 438 + handle); 440 439 mutex_lock(&ei->i_fc_lock); 441 440 return -EOPNOTSUPP; 442 441 } 443 442 444 443 node = kmem_cache_alloc(ext4_fc_dentry_cachep, GFP_NOFS); 445 444 if (!node) { 446 - ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, NULL); 445 + ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, handle); 447 446 mutex_lock(&ei->i_fc_lock); 448 447 return -ENOMEM; 449 448 } ··· 455 454 node->fcd_name.name = kmalloc(dentry->d_name.len, GFP_NOFS); 456 455 if (!node->fcd_name.name) { 457 456 kmem_cache_free(ext4_fc_dentry_cachep, node); 458 - ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, NULL); 457 + ext4_fc_mark_ineligible(sb, EXT4_FC_REASON_NOMEM, handle); 459 458 mutex_lock(&ei->i_fc_lock); 460 459 return -ENOMEM; 461 460 } ··· 577 576 } 578 577 579 578 /* __track_fn for inode tracking */ 580 - static int __track_inode(struct inode *inode, void *arg, bool update) 579 + static int __track_inode(handle_t *handle, struct inode *inode, void *arg, 580 + bool update) 581 581 { 582 582 if (update) 583 583 return -EEXIST; ··· 616 614 }; 617 615 618 616 /* __track_fn for tracking data updates */ 619 - static int __track_range(struct inode *inode, void *arg, bool update) 617 + static int __track_range(handle_t *handle, struct inode *inode, void *arg, 618 + bool update) 620 619 { 621 620 struct ext4_inode_info *ei = EXT4_I(inode); 622 621 ext4_lblk_t oldstart;
+10 -8
fs/ext4/resize.c
··· 230 230 #define MAX_RESIZE_BG 16384 231 231 232 232 /* 233 - * alloc_flex_gd() allocates a ext4_new_flex_group_data with size of 234 - * @flexbg_size. 233 + * alloc_flex_gd() allocates an ext4_new_flex_group_data that satisfies the 234 + * resizing from @o_group to @n_group, its size is typically @flexbg_size. 235 235 * 236 236 * Returns NULL on failure otherwise address of the allocated structure. 237 237 */ ··· 239 239 ext4_group_t o_group, ext4_group_t n_group) 240 240 { 241 241 ext4_group_t last_group; 242 + unsigned int max_resize_bg; 242 243 struct ext4_new_flex_group_data *flex_gd; 243 244 244 245 flex_gd = kmalloc(sizeof(*flex_gd), GFP_NOFS); 245 246 if (flex_gd == NULL) 246 247 goto out3; 247 248 248 - if (unlikely(flexbg_size > MAX_RESIZE_BG)) 249 - flex_gd->resize_bg = MAX_RESIZE_BG; 250 - else 251 - flex_gd->resize_bg = flexbg_size; 249 + max_resize_bg = umin(flexbg_size, MAX_RESIZE_BG); 250 + flex_gd->resize_bg = max_resize_bg; 252 251 253 252 /* Avoid allocating large 'groups' array if not needed */ 254 253 last_group = o_group | (flex_gd->resize_bg - 1); 255 254 if (n_group <= last_group) 256 - flex_gd->resize_bg = 1 << fls(n_group - o_group + 1); 255 + flex_gd->resize_bg = 1 << fls(n_group - o_group); 257 256 else if (n_group - last_group < flex_gd->resize_bg) 258 - flex_gd->resize_bg = 1 << max(fls(last_group - o_group + 1), 257 + flex_gd->resize_bg = 1 << max(fls(last_group - o_group), 259 258 fls(n_group - last_group)); 259 + 260 + if (WARN_ON_ONCE(flex_gd->resize_bg > max_resize_bg)) 261 + flex_gd->resize_bg = max_resize_bg; 260 262 261 263 flex_gd->groups = kmalloc_array(flex_gd->resize_bg, 262 264 sizeof(struct ext4_new_group_data),
+2 -1
fs/ext4/xattr.c
··· 2559 2559 2560 2560 error = ext4_xattr_set_handle(handle, inode, name_index, name, 2561 2561 value, value_len, flags); 2562 + ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR, 2563 + handle); 2562 2564 error2 = ext4_journal_stop(handle); 2563 2565 if (error == -ENOSPC && 2564 2566 ext4_should_retry_alloc(sb, &retries)) ··· 2568 2566 if (error == 0) 2569 2567 error = error2; 2570 2568 } 2571 - ext4_fc_mark_ineligible(inode->i_sb, EXT4_FC_REASON_XATTR, NULL); 2572 2569 2573 2570 return error; 2574 2571 }