Patchs 1-6 fix some problems recently. Patchs 7-8 backport from mainline.
Darrick J. Wong (1): xfs: fix uninitialized variable access
Dave Chinner (1): xfs: set XFS_FEAT_NLINK correctly
Long Li (4): xfs: factor out xfs_defer_pending_abort xfs: don't leak intent item when recovery intents fail xfs: factor out xfs_destroy_perag() xfs: don't leak perag when growfs fails
Ye Bin (1): xfs: fix warning in xfs_vm_writepages()
yangerkun (1): xfs: fix mounting failed caused by sequencing problem in the log records
fs/xfs/libxfs/xfs_defer.c | 26 +++++++++++++++++--------- fs/xfs/libxfs/xfs_defer.h | 1 + fs/xfs/libxfs/xfs_log_recover.h | 1 + fs/xfs/libxfs/xfs_sb.c | 2 ++ fs/xfs/xfs_buf_item_recover.c | 2 ++ fs/xfs/xfs_fsmap.c | 1 + fs/xfs/xfs_fsops.c | 5 ++++- fs/xfs/xfs_icache.c | 6 ++++++ fs/xfs/xfs_log_recover.c | 27 ++++++++++++++++++++++++--- fs/xfs/xfs_mount.c | 30 ++++++++++++++++++++++-------- fs/xfs/xfs_mount.h | 2 ++ 11 files changed, 82 insertions(+), 21 deletions(-)
From: yangerkun yangerkun@huawei.com
Offering: HULK hulk inclusion category: bugfix bugzilla: 188870, https://gitee.com/openeuler/kernel/issues/I76JSK
--------------------------------
During the test of growfs + power-off, we encountered a mounting failure issue. The specific call stack is as follows:
[584505.210179] XFS (loop0): xfs_buf_find: daddr 0x6d6002 out of range, EOFS 0x6d6000 ... [584505.210739] Call Trace: [584505.210776] xfs_buf_get_map+0x44/0x230 [xfs] [584505.210780] ? trace_event_buffer_commit+0x57/0x140 [584505.210818] xfs_buf_read_map+0x54/0x280 [xfs] [584505.210858] ? xlog_recover_items_pass2+0x53/0xb0 [xfs] [584505.210899] xlog_recover_buf_commit_pass2+0x112/0x440 [xfs] [584505.210939] ? xlog_recover_items_pass2+0x53/0xb0 [xfs] [584505.210980] xlog_recover_items_pass2+0x53/0xb0 [xfs] [584505.211020] xlog_recover_commit_trans+0x2ca/0x320 [xfs] [584505.211061] xlog_recovery_process_trans+0xc6/0xf0 [xfs] [584505.211101] xlog_recover_process_data+0x9e/0x110 [xfs] [584505.211141] xlog_do_recovery_pass+0x3b4/0x5c0 [xfs] [584505.211181] xlog_do_log_recovery+0x5e/0x80 [xfs] [584505.211223] xlog_do_recover+0x33/0x1a0 [xfs] [584505.211262] xlog_recover+0xd7/0x170 [xfs] [584505.211303] xfs_log_mount+0x217/0x2b0 [xfs] [584505.211341] xfs_mountfs+0x3da/0x870 [xfs] [584505.211384] xfs_fc_fill_super+0x3fa/0x7a0 [xfs] [584505.211428] ? xfs_setup_devices+0x80/0x80 [xfs] [584505.211432] get_tree_bdev+0x16f/0x260 [584505.211434] vfs_get_tree+0x25/0xc0 [584505.211436] do_new_mount+0x156/0x1b0 [584505.211438] __se_sys_mount+0x165/0x1d0 [584505.211440] do_syscall_64+0x33/0x40 [584505.211442] entry_SYSCALL_64_after_hwframe+0x61/0xc6
After analyzing the log records, we have discovered the following content:
============================================================================ cycle: 173 version: 2 lsn: 173,2742 tail_lsn: 173,1243 length of Log Record: 25600 prev offset: 2702 num ops: 258 uuid: fb958458-48a3-4c76-ae23-7a1cf3053065 format: little endian linux h_size: 32768 ---------------------------------------------------------------------------- ... ---------------------------------------------------------------------------- Oper (100): tid: 1c010724 len: 24 clientid: TRANS flags: none BUF: #regs: 2 start blkno: 7168002 (0x6d6002) len: 1 bmap size: 1 flags: 0x3800 Oper (101): tid: 1c010724 len: 128 clientid: TRANS flags: none AGI Buffer: XAGI ver: 1 seq#: 28 len: 2048 cnt: 0 root: 3 level: 1 free#: 0x0 newino: 0x140 bucket[0 - 3]: 0xffffffff 0xffffffff 0xffffffff 0xffffffff bucket[4 - 7]: 0xffffffff 0xffffffff 0xffffffff 0xffffffff bucket[8 - 11]: 0xffffffff 0xffffffff 0xffffffff 0xffffffff bucket[12 - 15]: 0xffffffff 0xffffffff 0xffffffff 0xffffffff bucket[16 - 19]: 0xffffffff ---------------------------------------------------------------------------- ... ---------------------------------------------------------------------------- Oper (108): tid: 1c010724 len: 24 clientid: TRANS flags: none BUF: #regs: 2 start blkno: 0 (0x0) len: 1 bmap size: 1 flags: 0x9000 Oper (109): tid: 1c010724 len: 384 clientid: TRANS flags: none SUPER BLOCK Buffer: icount: 6360863066640355328 ifree: 898048 fdblks: 0 frext: 0 ---------------------------------------------------------------------------- ...
We found that in the log records, the modification transaction for the expanded block is before the growfs transaction, which leads to verification failure during log replay.
We need to ensure that when replaying logs, transactions related to the superblock are replayed first.
Signed-off-by: Wu Guanghao wuguanghao3@huawei.com Signed-off-by: yangerkun yangerkun@huawei.com Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/libxfs/xfs_log_recover.h | 1 + fs/xfs/xfs_buf_item_recover.c | 2 ++ fs/xfs/xfs_log_recover.c | 26 +++++++++++++++++++++++--- 3 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_log_recover.h b/fs/xfs/libxfs/xfs_log_recover.h index 32a8ab3da183..27732685b8ae 100644 --- a/fs/xfs/libxfs/xfs_log_recover.h +++ b/fs/xfs/libxfs/xfs_log_recover.h @@ -18,6 +18,7 @@ enum xlog_recover_reorder { XLOG_REORDER_ITEM_LIST, XLOG_REORDER_INODE_BUFFER_LIST, XLOG_REORDER_CANCEL_LIST, + XLOG_REORDER_SB_BUFFER_LIST, };
struct xlog_recover_item_ops { diff --git a/fs/xfs/xfs_buf_item_recover.c b/fs/xfs/xfs_buf_item_recover.c index 368937745f80..9cb79a494d06 100644 --- a/fs/xfs/xfs_buf_item_recover.c +++ b/fs/xfs/xfs_buf_item_recover.c @@ -162,6 +162,8 @@ xlog_recover_buf_reorder( return XLOG_REORDER_CANCEL_LIST; if (buf_f->blf_flags & XFS_BLF_INODE_BUF) return XLOG_REORDER_INODE_BUFFER_LIST; + if (buf_f->blf_blkno == XFS_SB_DADDR) + return XLOG_REORDER_SB_BUFFER_LIST; return XLOG_REORDER_BUFFER_LIST; }
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 7d2a788b3e7e..8235a1e05ee8 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -1879,6 +1879,9 @@ xlog_recover_reorder_trans( case XLOG_REORDER_BUFFER_LIST: list_move_tail(&item->ri_list, &buffer_list); break; + case XLOG_REORDER_SB_BUFFER_LIST: + list_move(&item->ri_list, &buffer_list); + break; case XLOG_REORDER_CANCEL_LIST: trace_xfs_log_recover_item_reorder_head(log, trans, item, pass); @@ -1942,6 +1945,25 @@ xlog_recover_items_pass2( return error; }
+#define XLOG_RECOVER_COMMIT_QUEUE_MAX 100 +static inline bool +xlog_recover_should_pass2( + struct xlog_recover_item *item, + int items_queued) +{ + struct xfs_buf_log_format *buf_f; + + if (items_queued >= XLOG_RECOVER_COMMIT_QUEUE_MAX) + return true; + if (ITEM_TYPE(item) == XFS_LI_BUF) { + buf_f = item->ri_buf[0].i_addr; + if (buf_f->blf_blkno == XFS_SB_DADDR) + return true; + } + + return false; +} + /* * Perform the transaction. * @@ -1962,8 +1984,6 @@ xlog_recover_commit_trans( LIST_HEAD (ra_list); LIST_HEAD (done_list);
- #define XLOG_RECOVER_COMMIT_QUEUE_MAX 100 - hlist_del_init(&trans->r_list);
error = xlog_recover_reorder_trans(log, trans, pass); @@ -1983,7 +2003,7 @@ xlog_recover_commit_trans( item->ri_ops->ra_pass2(log, item); list_move_tail(&item->ri_list, &ra_list); items_queued++; - if (items_queued >= XLOG_RECOVER_COMMIT_QUEUE_MAX) { + if (xlog_recover_should_pass2(item, items_queued)) { error = xlog_recover_items_pass2(log, trans, buffer_list, &ra_list); list_splice_tail_init(&ra_list, &done_list);
Offering: HULK hulk inclusion category: bugfix bugzilla: 188865, https://gitee.com/openeuler/kernel/issues/I76JSK
--------------------------------
Factor out xfs_defer_pending_abort() from xfs_defer_trans_abort(), which not use transaction parameter, so it can be used after the transaction life cycle.
Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/libxfs/xfs_defer.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index eff4a127188e..ab474d99b084 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -210,21 +210,18 @@ xfs_defer_create_intents( } }
-/* Abort all the intents that were committed. */ -STATIC void -xfs_defer_trans_abort( - struct xfs_trans *tp, - struct list_head *dop_pending) +void +xfs_defer_pending_abort( + struct xfs_mount *mp, + struct list_head *dop_list) { struct xfs_defer_pending *dfp; const struct xfs_defer_op_type *ops;
- trace_xfs_defer_trans_abort(tp, _RET_IP_); - /* Abort intent items that don't have a done item. */ - list_for_each_entry(dfp, dop_pending, dfp_list) { + list_for_each_entry(dfp, dop_list, dfp_list) { ops = defer_op_types[dfp->dfp_type]; - trace_xfs_defer_pending_abort(tp->t_mountp, dfp); + trace_xfs_defer_pending_abort(mp, dfp); if (dfp->dfp_intent && !dfp->dfp_done) { ops->abort_intent(dfp->dfp_intent); dfp->dfp_intent = NULL; @@ -232,6 +229,16 @@ xfs_defer_trans_abort( } }
+/* Abort all the intents that were committed. */ +STATIC void +xfs_defer_trans_abort( + struct xfs_trans *tp, + struct list_head *dop_pending) +{ + trace_xfs_defer_trans_abort(tp, _RET_IP_); + xfs_defer_pending_abort(tp->t_mountp, dop_pending); +} + /* Roll a transaction so we can do some deferred op processing. */ STATIC int xfs_defer_trans_roll(
Offering: HULK hulk inclusion category: bugfix bugzilla: 188865, https://gitee.com/openeuler/kernel/issues/I76JSK
--------------------------------
When recovery intents, it may capture some deferred ops and commit the new intent items, if recovery intents fails, there will be no done item drop the reference to the new intent item. This leads to a memory leak as fllows:
unreferenced object 0xffff888016719108 (size 432): comm "mount", pid 529, jiffies 4294706839 (age 144.463s) hex dump (first 32 bytes): 08 91 71 16 80 88 ff ff 08 91 71 16 80 88 ff ff ..q.......q..... 18 91 71 16 80 88 ff ff 18 91 71 16 80 88 ff ff ..q.......q..... backtrace: [<ffffffff8230c68f>] xfs_efi_init+0x18f/0x1d0 [<ffffffff8230c720>] xfs_extent_free_create_intent+0x50/0x150 [<ffffffff821b671a>] xfs_defer_create_intents+0x16a/0x340 [<ffffffff821bac3e>] xfs_defer_ops_capture_and_commit+0x8e/0xad0 [<ffffffff82322bb9>] xfs_cui_item_recover+0x819/0x980 [<ffffffff823289b6>] xlog_recover_process_intents+0x246/0xb70 [<ffffffff8233249a>] xlog_recover_finish+0x8a/0x9a0 [<ffffffff822eeafb>] xfs_log_mount_finish+0x2bb/0x4a0 [<ffffffff822c0f4f>] xfs_mountfs+0x14bf/0x1e70 [<ffffffff822d1f80>] xfs_fs_fill_super+0x10d0/0x1b20 [<ffffffff81a21fa2>] get_tree_bdev+0x3d2/0x6d0 [<ffffffff81a1ee09>] vfs_get_tree+0x89/0x2c0 [<ffffffff81a9f35f>] path_mount+0xecf/0x1800 [<ffffffff81a9fd83>] do_mount+0xf3/0x110 [<ffffffff81aa00e4>] __x64_sys_mount+0x154/0x1f0 [<ffffffff83968739>] do_syscall_64+0x39/0x80
Fix it by abort intent items in capture list that don't have a done item when recovery intents fail. If transaction that have deferred ops is commmit fails in xfs_defer_ops_capture_and_commit(), defer capture would not added to capture list, it also need abort too.
Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/libxfs/xfs_defer.c | 1 + fs/xfs/libxfs/xfs_defer.h | 1 + fs/xfs/xfs_log_recover.c | 1 + 3 files changed, 3 insertions(+)
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c index ab474d99b084..168b8798625f 100644 --- a/fs/xfs/libxfs/xfs_defer.c +++ b/fs/xfs/libxfs/xfs_defer.c @@ -713,6 +713,7 @@ xfs_defer_ops_capture_and_commit( /* Commit the transaction and add the capture structure to the list. */ error = xfs_trans_commit(tp); if (error) { + xfs_defer_pending_abort(mp, &dfc->dfc_dfops); xfs_defer_ops_release(mp, dfc); return error; } diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h index 05472f71fffe..df0312679ca7 100644 --- a/fs/xfs/libxfs/xfs_defer.h +++ b/fs/xfs/libxfs/xfs_defer.h @@ -36,6 +36,7 @@ struct xfs_defer_pending { enum xfs_defer_ops_type dfp_type; };
+void xfs_defer_pending_abort(struct xfs_mount *mp, struct list_head *dop_list); void xfs_defer_add(struct xfs_trans *tp, enum xfs_defer_ops_type type, struct list_head *h); int xfs_defer_finish_noroll(struct xfs_trans **tp); diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c index 8235a1e05ee8..1ce9700ea68c 100644 --- a/fs/xfs/xfs_log_recover.c +++ b/fs/xfs/xfs_log_recover.c @@ -2514,6 +2514,7 @@ xlog_abort_defer_ops(
list_for_each_entry_safe(dfc, next, capture_list, dfc_list) { list_del_init(&dfc->dfc_list); + xfs_defer_pending_abort(mp, &dfc->dfc_dfops); xfs_defer_ops_release(mp, dfc); } }
From: Ye Bin yebin10@huawei.com
Offering: HULK hulk inclusion category: bugfix bugzilla: 188782, https://gitee.com/openeuler/kernel/issues/I76JSK
-----------------------------------------------
When do BULKSTAT test got issues as follows: WARNING: CPU: 3 PID: 8425 at fs/xfs/xfs_aops.c:509 xfs_vm_writepages+0x184/0x1c0 Modules linked in: CPU: 3 PID: 8425 Comm: xfs_bulkstat Not tainted 6.3.0-next-20230505-00003-gf3329adf5424-dirty #456 RIP: 0010:xfs_vm_writepages+0x184/0x1c0 RSP: 0018:ffffc90014bb7088 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 1ffff92002976e11 RCX: ffff88817aef8000 RDX: 0000000000000000 RSI: ffff88817aef8000 RDI: 0000000000000002 RBP: ffff888267dd2ad8 R08: ffffffff8313f414 R09: ffffed1022377c18 R10: ffff888111bbe0bb R11: ffffed1022377c17 R12: ffff88817aef8000 R13: ffffc90014bb7358 R14: dffffc0000000000 R15: ffffffff8313f290 FS: 00007f9568bb0440(0000) GS:ffff88882fc80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000d7a008 CR3: 000000024e11f000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> do_writepages+0x1a8/0x630 __writeback_single_inode+0x126/0xe00 writeback_single_inode+0x2ae/0x530 write_inode_now+0x16e/0x1e0 iput.part.0+0x46c/0x730 iput+0x60/0x80 xfs_bulkstat_one_int+0xd87/0x1580 xfs_bulkstat_iwalk+0x6e/0xd0 xfs_iwalk_ag_recs+0x449/0x770 xfs_iwalk_run_callbacks+0x305/0x630 xfs_iwalk_ag+0x819/0xae0 xfs_iwalk+0x2d5/0x4e0 xfs_bulkstat+0x358/0x520 xfs_ioc_bulkstat.isra.0+0x242/0x340 xfs_file_ioctl+0x1d6/0x1ba0 __x64_sys_ioctl+0x197/0x210 do_syscall_64+0x39/0xb0 entry_SYSCALL_64_after_hwframe+0x63/0xcd
Above issue may happens as follows: Porcess1 Process2 process3 process4 xfs_bulkstat xfs_trans_alloc_empty xfs_bulkstat_one_int xfs_iget(XFS_IGET_DONTCACHE) ->Get inode from disk and mark inode with I_DONTCACHE
xfs_lookup xfs_iget ->Hold inode refcount xfs_irele
xfs_file_write_iter ->Write file made some dirty pages close file
xfs_bulkstat xfs_trans_alloc_empty xfs_bulkstat_one_int xfs_iget(XFS_IGET_DONTCACHE)
-> process4 close file
******Trigger dentry reclaim, inode refcount is 1****** xfs_irele iput ->Put the last refcount iput_final write_inode_now xfs_vm_writepages WARN_ON_ONCE(current->journal_info) ->Trigger warning
As commit a6343e4d9278 grab an empty transaction when do BULKSTAT. If put the last refcount of inode maybe cause writepages will trigger warning, and also lead to data loss. To solve above issue if xfs_iget_cache_hit() just clear inode's I_DONTCACHE flags.
Fixes: a6343e4d9278 ("xfs: avoid buffer deadlocks when walking fs inodes") Signed-off-by: Ye Bin yebin10@huawei.com Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/xfs_icache.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c index 14e55a5e39b7..6847bbb5a735 100644 --- a/fs/xfs/xfs_icache.c +++ b/fs/xfs/xfs_icache.c @@ -534,6 +534,12 @@ xfs_iget_cache_hit( if (!igrab(inode)) goto out_skip;
+ if (!(flags & XFS_IGET_DONTCACHE)) { + spin_lock(&inode->i_lock); + inode->i_state &= ~I_DONTCACHE; + spin_unlock(&inode->i_lock); + } + /* We've got a live one. */ spin_unlock(&ip->i_flags_lock); rcu_read_unlock();
Offering: HULK hulk inclusion category: bugfix bugzilla: 188878, https://gitee.com/openeuler/kernel/issues/I76JSK
--------------------------------
Factor out xfs_destroy_perag() from xfs_initialize_perag() for error handle, delete perag from radix tree requires lock protection, just like any other places where perag tree are modified.
Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/xfs_mount.c | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/fs/xfs/xfs_mount.c b/fs/xfs/xfs_mount.c index 69888dd863d7..8346441985b0 100644 --- a/fs/xfs/xfs_mount.c +++ b/fs/xfs/xfs_mount.c @@ -173,6 +173,27 @@ xfs_sb_validate_fsb_count( return 0; }
+void +xfs_destroy_perag( + xfs_mount_t *mp, + xfs_agnumber_t agstart, + xfs_agnumber_t agend) +{ + xfs_agnumber_t index; + xfs_perag_t *pag; + + for (index = agstart; index < agend; index++) { + spin_lock(&mp->m_perag_lock); + pag = radix_tree_delete(&mp->m_perag_tree, index); + spin_unlock(&mp->m_perag_lock); + if (!pag) + break; + xfs_buf_hash_destroy(pag); + xfs_iunlink_destroy(pag); + kmem_free(pag); + } +} + int xfs_initialize_perag( xfs_mount_t *mp, @@ -252,14 +273,7 @@ xfs_initialize_perag( kmem_free(pag); out_unwind_new_pags: /* unwind any prior newly initialized pags */ - for (index = first_initialised; index < agcount; index++) { - pag = radix_tree_delete(&mp->m_perag_tree, index); - if (!pag) - break; - xfs_buf_hash_destroy(pag); - xfs_iunlink_destroy(pag); - kmem_free(pag); - } + xfs_destroy_perag(mp, first_initialised, agcount); return error; }
Offering: HULK hulk inclusion category: bugfix bugzilla: 188878, https://gitee.com/openeuler/kernel/issues/I76JSK
--------------------------------
During growfs, if new ag in memory has been initialized, however sb_agcount has not been updated, if an error occurs at this time it will cause ag leaks as follows, these new ags will not been freed during umount because of sb_agcount is not been updated.
unreferenced object 0xffff88810751b000 (size 1024): comm "xfs_growfs", pid 123624, jiffies 4300733989 (age 124294.081s) hex dump (first 32 bytes): 00 a0 38 16 81 88 ff ff 05 00 00 00 00 00 00 00 ..8............. 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00 00 ................ backtrace: [<00000000725c8ae4>] kmem_alloc+0x92/0x1d0 [xfs] [<000000005c32d74e>] xfs_initialize_perag+0x8d/0x3b0 [xfs] [<00000000830354cf>] xfs_growfs_data_private.isra.0+0x2af/0x610 [xfs] [<0000000038a29cb1>] xfs_growfs_data+0x228/0x300 [xfs] [<0000000004937dd2>] xfs_file_ioctl+0x8f3/0x10d0 [xfs] [<000000001a5d29a8>] __se_sys_ioctl+0xeb/0x120 [<00000000cf30385a>] do_syscall_64+0x30/0x40 [<00000000e4a6fd2f>] entry_SYSCALL_64_after_hwframe+0x61/0xc6
When growfs fails, use xfs_destroy_perag() to destroy newly initialized ag in error handle path.
Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/xfs_fsops.c | 5 ++++- fs/xfs/xfs_mount.h | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index e81e052dcb75..68ad7113ac39 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -76,7 +76,7 @@ xfs_growfs_data_private( error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, XFS_GROWFS_SPACE_RES(mp), 0, XFS_TRANS_RESERVE, &tp); if (error) - return error; + goto destroy_perag;
/* * Write new AG headers to disk. Non-transactional, but need to be @@ -167,6 +167,9 @@ xfs_growfs_data_private(
out_trans_cancel: xfs_trans_cancel(tp); +destroy_perag: + if (nagcount > oagcount) + xfs_destroy_perag(mp, oagcount, nagcount); return error; }
diff --git a/fs/xfs/xfs_mount.h b/fs/xfs/xfs_mount.h index a4bdf24a070c..21547ff97b5a 100644 --- a/fs/xfs/xfs_mount.h +++ b/fs/xfs/xfs_mount.h @@ -564,6 +564,8 @@ extern void xfs_uuid_table_free(void); extern int xfs_log_sbcount(xfs_mount_t *); extern uint64_t xfs_default_resblks(xfs_mount_t *mp); extern int xfs_mountfs(xfs_mount_t *mp); +extern void xfs_destroy_perag(xfs_mount_t *mp, xfs_agnumber_t agstart, + xfs_agnumber_t agend); extern int xfs_initialize_perag(xfs_mount_t *mp, xfs_agnumber_t agcount, xfs_agnumber_t *maxagi); extern void xfs_unmountfs(xfs_mount_t *);
From: Dave Chinner dchinner@redhat.com
mainline inclusion from mainline-v5.18-rc2 commit dd0d2f9755191690541b09e6385d0f8cd8bc9d8f category: bugfix bugzilla: 188220, https://gitee.com/openeuler/kernel/issues/I4KIAO
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
While xfs_has_nlink() is not used in kernel, it is used in userspace (e.g. by xfs_db) so we need to set the XFS_FEAT_NLINK flag correctly in xfs_sb_version_to_features().
Signed-off-by: Dave Chinner dchinner@redhat.com Reviewed-by: Christoph Hellwig hch@lst.de Reviewed-by: Darrick J. Wong djwong@kernel.org Signed-off-by: Dave Chinner david@fromorbit.com Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/libxfs/xfs_sb.c | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/fs/xfs/libxfs/xfs_sb.c b/fs/xfs/libxfs/xfs_sb.c index d7ac96b137bd..af313e9bf55e 100644 --- a/fs/xfs/libxfs/xfs_sb.c +++ b/fs/xfs/libxfs/xfs_sb.c @@ -70,6 +70,8 @@ xfs_sb_version_to_features( /* optional V4 features */ if (sbp->sb_rblocks > 0) features |= XFS_FEAT_REALTIME; + if (sbp->sb_versionnum & XFS_SB_VERSION_NLINKBIT) + features |= XFS_FEAT_NLINK; if (sbp->sb_versionnum & XFS_SB_VERSION_ATTRBIT) features |= XFS_FEAT_ATTR; if (sbp->sb_versionnum & XFS_SB_VERSION_QUOTABIT)
From: "Darrick J. Wong" djwong@kernel.org
mainline inclusion from mainline-v6.2-rc6 commit 60b730a40c43fbcc034970d3e77eb0f25b8cc1cf category: bugfix bugzilla: 188220, https://gitee.com/openeuler/kernel/issues/I4KIAO
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
If the end position of a GETFSMAP query overlaps an allocated space and we're using the free space info to generate fsmap info, the akeys information gets fed into the fsmap formatter with bad results. Zero-init the space.
Reported-by: syzbot+090ae72d552e6bd93cfe@syzkaller.appspotmail.com Signed-off-by: Darrick J. Wong djwong@kernel.org Signed-off-by: Long Li leo.lilong@huawei.com --- fs/xfs/xfs_fsmap.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/fs/xfs/xfs_fsmap.c b/fs/xfs/xfs_fsmap.c index 4ca3a7fcc001..595450a99ae2 100644 --- a/fs/xfs/xfs_fsmap.c +++ b/fs/xfs/xfs_fsmap.c @@ -746,6 +746,7 @@ xfs_getfsmap_datadev_bnobt( { struct xfs_alloc_rec_incore akeys[2];
+ memset(akeys, 0, sizeof(akeys)); info->missing_owner = XFS_FMR_OWN_UNKNOWN; return __xfs_getfsmap_datadev(tp, keys, info, xfs_getfsmap_datadev_bnobt_query, &akeys[0]);
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/1272 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/W...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/1272 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/W...