hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/fs/nilfs2/dat.c
....@@ -111,6 +111,13 @@
111111 kunmap_atomic(kaddr);
112112
113113 nilfs_dat_commit_entry(dat, req);
114
+
115
+ if (unlikely(req->pr_desc_bh == NULL || req->pr_bitmap_bh == NULL)) {
116
+ nilfs_error(dat->i_sb,
117
+ "state inconsistency probably due to duplicate use of vblocknr = %llu",
118
+ (unsigned long long)req->pr_entry_nr);
119
+ return;
120
+ }
114121 nilfs_palloc_commit_free_entry(dat, req);
115122 }
116123
....@@ -340,11 +347,11 @@
340347 kaddr = kmap_atomic(entry_bh->b_page);
341348 entry = nilfs_palloc_block_get_entry(dat, vblocknr, entry_bh, kaddr);
342349 if (unlikely(entry->de_blocknr == cpu_to_le64(0))) {
343
- nilfs_msg(dat->i_sb, KERN_CRIT,
344
- "%s: invalid vblocknr = %llu, [%llu, %llu)",
345
- __func__, (unsigned long long)vblocknr,
346
- (unsigned long long)le64_to_cpu(entry->de_start),
347
- (unsigned long long)le64_to_cpu(entry->de_end));
350
+ nilfs_crit(dat->i_sb,
351
+ "%s: invalid vblocknr = %llu, [%llu, %llu)",
352
+ __func__, (unsigned long long)vblocknr,
353
+ (unsigned long long)le64_to_cpu(entry->de_start),
354
+ (unsigned long long)le64_to_cpu(entry->de_end));
348355 kunmap_atomic(kaddr);
349356 brelse(entry_bh);
350357 return -EINVAL;
....@@ -471,11 +478,11 @@
471478 int err;
472479
473480 if (entry_size > sb->s_blocksize) {
474
- nilfs_msg(sb, KERN_ERR, "too large DAT entry size: %zu bytes",
481
+ nilfs_err(sb, "too large DAT entry size: %zu bytes",
475482 entry_size);
476483 return -EINVAL;
477484 } else if (entry_size < NILFS_MIN_DAT_ENTRY_SIZE) {
478
- nilfs_msg(sb, KERN_ERR, "too small DAT entry size: %zu bytes",
485
+ nilfs_err(sb, "too small DAT entry size: %zu bytes",
479486 entry_size);
480487 return -EINVAL;
481488 }
....@@ -497,7 +504,9 @@
497504 di = NILFS_DAT_I(dat);
498505 lockdep_set_class(&di->mi.mi_sem, &dat_lock_key);
499506 nilfs_palloc_setup_cache(dat, &di->palloc_cache);
500
- nilfs_mdt_setup_shadow_map(dat, &di->shadow);
507
+ err = nilfs_mdt_setup_shadow_map(dat, &di->shadow);
508
+ if (err)
509
+ goto failed;
501510
502511 err = nilfs_read_inode_common(dat, raw_inode);
503512 if (err)