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 'bcachefs-2025-02-26' of git://evilpiepirate.org/bcachefs

Pull bcachefs fixes from Kent Overstreet:
"A couple small ones, the main user visible changes/fixes are:

- Fix a bug where truncate would rarely fail and return 1

- Revert the directory i_size code: this turned out to have a number
of issues that weren't noticed because the fsck code wasn't
correctly reporting errors (ouch), and we're late enough in the
cycle that it can just wait until 6.15"

* tag 'bcachefs-2025-02-26' of git://evilpiepirate.org/bcachefs:
bcachefs: Fix truncate sometimes failing and returning 1
bcachefs: Fix deadlock
bcachefs: Check for -BCH_ERR_open_buckets_empty in journal resize
bcachefs: Revert directory i_size
bcachefs: fix bch2_extent_ptr_eq()
bcachefs: Fix memmove when move keys down
bcachefs: print op->nonce on data update inconsistency

+25 -57
+5 -4
fs/bcachefs/btree_cache.c
··· 203 203 return NULL; 204 204 } 205 205 206 - bch2_btree_lock_init(&b->c, 0); 206 + bch2_btree_lock_init(&b->c, 0, GFP_KERNEL); 207 207 208 208 __bch2_btree_node_to_freelist(bc, b); 209 209 return b; ··· 795 795 } 796 796 797 797 b = __btree_node_mem_alloc(c, GFP_NOWAIT|__GFP_NOWARN); 798 - if (!b) { 798 + if (b) { 799 + bch2_btree_lock_init(&b->c, pcpu_read_locks ? SIX_LOCK_INIT_PCPU : 0, GFP_NOWAIT); 800 + } else { 799 801 mutex_unlock(&bc->lock); 800 802 bch2_trans_unlock(trans); 801 803 b = __btree_node_mem_alloc(c, GFP_KERNEL); 802 804 if (!b) 803 805 goto err; 806 + bch2_btree_lock_init(&b->c, pcpu_read_locks ? SIX_LOCK_INIT_PCPU : 0, GFP_KERNEL); 804 807 mutex_lock(&bc->lock); 805 808 } 806 - 807 - bch2_btree_lock_init(&b->c, pcpu_read_locks ? SIX_LOCK_INIT_PCPU : 0); 808 809 809 810 BUG_ON(!six_trylock_intent(&b->c.lock)); 810 811 BUG_ON(!six_trylock_write(&b->c.lock));
+1 -1
fs/bcachefs/btree_io.c
··· 996 996 } 997 997 got_good_key: 998 998 le16_add_cpu(&i->u64s, -next_good_key); 999 - memmove_u64s_down(k, bkey_p_next(k), (u64 *) vstruct_end(i) - (u64 *) k); 999 + memmove_u64s_down(k, (u64 *) k + next_good_key, (u64 *) vstruct_end(i) - (u64 *) k); 1000 1000 set_btree_node_need_rewrite(b); 1001 1001 } 1002 1002 fsck_err:
+1 -1
fs/bcachefs/btree_key_cache.c
··· 156 156 } 157 157 158 158 if (ck) { 159 - bch2_btree_lock_init(&ck->c, pcpu_readers ? SIX_LOCK_INIT_PCPU : 0); 159 + bch2_btree_lock_init(&ck->c, pcpu_readers ? SIX_LOCK_INIT_PCPU : 0, GFP_KERNEL); 160 160 ck->c.cached = true; 161 161 goto lock; 162 162 }
+3 -2
fs/bcachefs/btree_locking.c
··· 7 7 static struct lock_class_key bch2_btree_node_lock_key; 8 8 9 9 void bch2_btree_lock_init(struct btree_bkey_cached_common *b, 10 - enum six_lock_init_flags flags) 10 + enum six_lock_init_flags flags, 11 + gfp_t gfp) 11 12 { 12 - __six_lock_init(&b->lock, "b->c.lock", &bch2_btree_node_lock_key, flags); 13 + __six_lock_init(&b->lock, "b->c.lock", &bch2_btree_node_lock_key, flags, gfp); 13 14 lockdep_set_notrack_class(&b->lock); 14 15 } 15 16
+1 -1
fs/bcachefs/btree_locking.h
··· 13 13 #include "btree_iter.h" 14 14 #include "six.h" 15 15 16 - void bch2_btree_lock_init(struct btree_bkey_cached_common *, enum six_lock_init_flags); 16 + void bch2_btree_lock_init(struct btree_bkey_cached_common *, enum six_lock_init_flags, gfp_t gfp); 17 17 18 18 void bch2_trans_unlock_noassert(struct btree_trans *); 19 19 void bch2_trans_unlock_write(struct btree_trans *);
+1
fs/bcachefs/data_update.c
··· 340 340 struct printbuf buf = PRINTBUF; 341 341 342 342 prt_str(&buf, "about to insert invalid key in data update path"); 343 + prt_printf(&buf, "\nop.nonce: %u", m->op.nonce); 343 344 prt_str(&buf, "\nold: "); 344 345 bch2_bkey_val_to_text(&buf, c, old); 345 346 prt_str(&buf, "\nk: ");
-5
fs/bcachefs/dirent.h
··· 31 31 sizeof(u64)); 32 32 } 33 33 34 - static inline unsigned int dirent_occupied_size(const struct qstr *name) 35 - { 36 - return (BKEY_U64s + dirent_val_u64s(name->len)) * sizeof(u64); 37 - } 38 - 39 34 int bch2_dirent_read_target(struct btree_trans *, subvol_inum, 40 35 struct bkey_s_c_dirent, subvol_inum *); 41 36
+1 -1
fs/bcachefs/extents.h
··· 704 704 ptr1.unwritten == ptr2.unwritten && 705 705 ptr1.offset == ptr2.offset && 706 706 ptr1.dev == ptr2.dev && 707 - ptr1.dev == ptr2.dev); 707 + ptr1.gen == ptr2.gen); 708 708 } 709 709 710 710 void bch2_ptr_swab(struct bkey_s);
-11
fs/bcachefs/fs-common.c
··· 152 152 if (is_subdir_for_nlink(new_inode)) 153 153 dir_u->bi_nlink++; 154 154 dir_u->bi_mtime = dir_u->bi_ctime = now; 155 - dir_u->bi_size += dirent_occupied_size(name); 156 155 157 156 ret = bch2_inode_write(trans, &dir_iter, dir_u); 158 157 if (ret) ··· 220 221 } 221 222 222 223 dir_u->bi_mtime = dir_u->bi_ctime = now; 223 - dir_u->bi_size += dirent_occupied_size(name); 224 224 225 225 dir_hash = bch2_hash_info_init(c, dir_u); 226 226 ··· 322 324 323 325 dir_u->bi_mtime = dir_u->bi_ctime = inode_u->bi_ctime = now; 324 326 dir_u->bi_nlink -= is_subdir_for_nlink(inode_u); 325 - dir_u->bi_size -= dirent_occupied_size(name); 326 327 327 328 ret = bch2_hash_delete_at(trans, bch2_dirent_hash_desc, 328 329 &dir_hash, &dirent_iter, ··· 459 462 ret = -EXDEV; 460 463 goto err; 461 464 } 462 - 463 - if (mode == BCH_RENAME) { 464 - src_dir_u->bi_size -= dirent_occupied_size(src_name); 465 - dst_dir_u->bi_size += dirent_occupied_size(dst_name); 466 - } 467 - 468 - if (mode == BCH_RENAME_OVERWRITE) 469 - src_dir_u->bi_size -= dirent_occupied_size(src_name); 470 465 471 466 if (src_inode_u->bi_parent_subvol) 472 467 src_inode_u->bi_parent_subvol = dst_dir.subvol;
+1
fs/bcachefs/fs-io.c
··· 466 466 ret = bch2_truncate_folio(inode, iattr->ia_size); 467 467 if (unlikely(ret < 0)) 468 468 goto err; 469 + ret = 0; 469 470 470 471 truncate_setsize(&inode->v, iattr->ia_size); 471 472
-21
fs/bcachefs/fsck.c
··· 1978 1978 return ret; 1979 1979 } 1980 1980 1981 - static int check_dir_i_size_notnested(struct btree_trans *trans, struct inode_walker *w) 1982 - { 1983 - struct bch_fs *c = trans->c; 1984 - int ret = 0; 1985 - 1986 - darray_for_each(w->inodes, i) 1987 - if (fsck_err_on(i->inode.bi_size != i->i_size, 1988 - trans, inode_dir_wrong_nlink, 1989 - "directory %llu:%u with wrong i_size: got %llu, should be %llu", 1990 - w->last_pos.inode, i->snapshot, i->inode.bi_size, i->i_size)) { 1991 - i->inode.bi_size = i->i_size; 1992 - ret = bch2_fsck_write_inode(trans, &i->inode); 1993 - if (ret) 1994 - break; 1995 - } 1996 - fsck_err: 1997 - bch_err_fn(c, ret); 1998 - return ret; 1999 - } 2000 - 2001 1981 static int check_subdir_dirents_count(struct btree_trans *trans, struct inode_walker *w) 2002 1982 { 2003 1983 u32 restart_count = trans->restart_count; 2004 1984 return check_subdir_count_notnested(trans, w) ?: 2005 - check_dir_i_size_notnested(trans, w) ?: 2006 1985 trans_was_restarted(trans, restart_count); 2007 1986 } 2008 1987
+3 -1
fs/bcachefs/journal.c
··· 1194 1194 1195 1195 closure_sync(&cl); 1196 1196 1197 - if (ret && ret != -BCH_ERR_bucket_alloc_blocked) 1197 + if (ret && 1198 + ret != -BCH_ERR_bucket_alloc_blocked && 1199 + ret != -BCH_ERR_open_buckets_empty) 1198 1200 break; 1199 1201 } 1200 1202
+1 -4
fs/bcachefs/sb-downgrade.c
··· 90 90 BIT_ULL(BCH_RECOVERY_PASS_check_allocations), \ 91 91 BCH_FSCK_ERR_accounting_mismatch, \ 92 92 BCH_FSCK_ERR_accounting_key_replicas_nr_devs_0, \ 93 - BCH_FSCK_ERR_accounting_key_junk_at_end) \ 94 - x(directory_size, \ 95 - BIT_ULL(BCH_RECOVERY_PASS_check_dirents), \ 96 - BCH_FSCK_ERR_directory_size_mismatch) \ 93 + BCH_FSCK_ERR_accounting_key_junk_at_end) 97 94 98 95 #define DOWNGRADE_TABLE() \ 99 96 x(bucket_stripe_sectors, \
+3 -2
fs/bcachefs/six.c
··· 850 850 EXPORT_SYMBOL_GPL(six_lock_exit); 851 851 852 852 void __six_lock_init(struct six_lock *lock, const char *name, 853 - struct lock_class_key *key, enum six_lock_init_flags flags) 853 + struct lock_class_key *key, enum six_lock_init_flags flags, 854 + gfp_t gfp) 854 855 { 855 856 atomic_set(&lock->state, 0); 856 857 raw_spin_lock_init(&lock->wait_lock); ··· 874 873 * failure if they wish by checking lock->readers, but generally 875 874 * will not want to treat it as an error. 876 875 */ 877 - lock->readers = alloc_percpu(unsigned); 876 + lock->readers = alloc_percpu_gfp(unsigned, gfp); 878 877 } 879 878 #endif 880 879 }
+4 -3
fs/bcachefs/six.h
··· 164 164 }; 165 165 166 166 void __six_lock_init(struct six_lock *lock, const char *name, 167 - struct lock_class_key *key, enum six_lock_init_flags flags); 167 + struct lock_class_key *key, enum six_lock_init_flags flags, 168 + gfp_t gfp); 168 169 169 170 /** 170 171 * six_lock_init - initialize a six lock 171 172 * @lock: lock to initialize 172 173 * @flags: optional flags, i.e. SIX_LOCK_INIT_PCPU 173 174 */ 174 - #define six_lock_init(lock, flags) \ 175 + #define six_lock_init(lock, flags, gfp) \ 175 176 do { \ 176 177 static struct lock_class_key __key; \ 177 178 \ 178 - __six_lock_init((lock), #lock, &__key, flags); \ 179 + __six_lock_init((lock), #lock, &__key, flags, gfp); \ 179 180 } while (0) 180 181 181 182 /**