xfs stable candidate patches for 5.10.y (part 3)
Subsystems (2)
cover xfs stable candidate patches for 5.10.y (part 3)
Hi all!
This is the 3rd part of a collection of stable patch candidates that I collected from xfs releases v5.11..v5.18.
Part #1 is already in 5.10.120 and part #2 has been posted to stable.
The patches in this part are from circa v5.12..v5.13.
They have been soaking in kdevops for over a week with no regressions from baseline observed.
There are four user visible fixes in this part, one patch for dependency ("rename variable mp") and two patches to improve testability of LTS.
Specifically, I selected the fix ("use current->journal_info for detecting transaction recursion") after I got a false positive assert while testing LTS kernel with XFS_DEBUG and at another incident, it helped me triage a regression that would have been harder to trace back to the offending code otherwise.
It is worth noting that one patch from v5.13 did cause a regression and was removed from the stable candidates queue during early testing - 0fe0bbe00a6f ("xfs: bunmapi has unnecessary AG lock ordering issues").
When I did a post mortem on a patch that I missed for part #2, I started off on the wrong foot with Dave, so it is important for me to say this:
Although I had wrongly selected this fix, all the information I needed to make the right decision was in the commit message, I just did not understand it at the time that I selected the patch.
But when my tests had detected hangs on test xfs/299, that quickly lead me to the mention of xfs/299 in the commit message and then I understood that the fix was incorrect without "deferred inode inactivation" series from 5.13-rc1.
I would like to thank Samsung and Luis for the resources and efforts that make this work possible.
Your inputs on these stable candidates are most welcome!
Thanks,
Amir.
Anthony Iliopoulos (1):
xfs: fix xfs_trans slab cache name
Darrick J. Wong (1):
xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range
Dave Chinner (2):
xfs: use current->journal_info for detecting transaction recursion
xfs: update superblock counters correctly for !lazysbcount
Gao Xiang (1):
xfs: ensure xfs_errortag_random_default matches XFS_ERRTAG_MAX
Pavel Reichl (2):
xfs: rename variable mp to parsing_mp
xfs: Skip repetitive warnings about mount options
fs/iomap/buffered-io.c | 7 --- fs/xfs/libxfs/xfs_btree.c | 12 +++- fs/xfs/libxfs/xfs_sb.c | 16 ++++- fs/xfs/xfs_aops.c | 17 +++++- fs/xfs/xfs_error.c | 2 + fs/xfs/xfs_reflink.c | 3 +- fs/xfs/xfs_super.c | 120 +++++++++++++++++++++----------------- fs/xfs/xfs_trans.c | 23 +++----- fs/xfs/xfs_trans.h | 30 ++++++++++ 9 files changed, 148 insertions(+), 82 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/7 xfs: use current->journal_info for detecting transaction recursion
From: Dave Chinner <[email protected]>
commit 756b1c343333a5aefcc26b0409f3fd16f72281bf upstream.
Because the iomap code using PF_MEMALLOC_NOFS to detect transaction recursion in XFS is just wrong. Remove it from the iomap code and replace it with XFS specific internal checks using current->journal_info instead.
[djwong: This change also realigns the lifetime of NOFS flag changes to match the incore transaction, instead of the inconsistent scheme we have now.]
--- fs/iomap/buffered-io.c | 7 ------- fs/xfs/libxfs/xfs_btree.c | 12 ++++++++++-- fs/xfs/xfs_aops.c | 17 +++++++++++++++-- fs/xfs/xfs_trans.c | 20 +++++--------------- fs/xfs/xfs_trans.h | 30 ++++++++++++++++++++++++++++++ 5 files changed, 60 insertions(+), 26 deletions(-)
fs/iomap/buffered-io.c +0 -7
@@ -1459,13 +1459,6 @@ iomap_do_writepage(struct page *page, struct writeback_control *wbc, void *data) PF_MEMALLOC)) goto redirty; -/* -* Given that we do not allow direct reclaim to call us, we should -* never be called in a recursive filesystem reclaim context. -*/ -if (WARN_ON_ONCE (current->flags &PF_MEMALLOC_NOFS )) - goto redirty; -/* * Is this page beyond the end of the file? *
fs/xfs/libxfs/xfs_btree.c +10 -2
@@ -2811,7 +2811,7 @@ xfs_btree_split_worker(struct xfs_btree_split_args *args =container_of (work, struct xfs_btree_split_args, work);unsigned long pflags; -unsigned long new_pflags =PF_MEMALLOC_NOFS ; +unsigned long new_pflags =0 ;/* * we are in a transaction context here, but may also be doing work
@@ -2823,12 +2823,20 @@ xfs_btree_split_worker( new_pflags |=PF_MEMALLOC |PF_SWAPWRITE |PF_KSWAPD ;current_set_flags_nested (&pflags, new_pflags); +xfs_trans_set_context (args->cur->bc_tp); args->result =__xfs_btree_split (args->cur, args->level, args->ptrp, args->key, args->curp, args->stat); -complete (args->done); +xfs_trans_clear_context (args->cur->bc_tp);current_restore_flags_nested (&pflags, new_pflags); + +/* +* Do not access args after complete() has run here. We don't own args +* and the owner may run and free args before we return here. +*/ +complete (args->done); + }/*
fs/xfs/xfs_aops.c +15 -2
@@ -62,7 +62,7 @@ xfs_setfilesize_trans_alloc(* We hand off the transaction to the completion thread now, so * clear the flag here. */ -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +xfs_trans_clear_context (tp);return 0 ; }
@@ -125,7 +125,7 @@ xfs_setfilesize_ioend(* thus we need to mark ourselves as being in a transaction manually. * Similarly for freeze protection. */ -current_set_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +xfs_trans_set_context (tp);__sb_writers_acquired (VFS_I (ip)->i_sb,SB_FREEZE_FS );/* we abort the update if there was an IO error */
@@ -568,6 +568,12 @@ xfs_vm_writepage( {struct xfs_writepage_ctx wpc = { }; +if (WARN_ON_ONCE (current->journal_info)) { +redirty_page_for_writepage (wbc, page); +unlock_page (page); +return 0 ; + } +return iomap_writepage (page, wbc, &wpc.ctx, &xfs_writeback_ops); }
@@ -578,6 +584,13 @@ xfs_vm_writepages( {struct xfs_writepage_ctx wpc = { }; +/* +* Writing back data in a transaction context can result in recursive +* transactions. This is bad, so issue a warning and get out of here. +*/ +if (WARN_ON_ONCE (current->journal_info)) +return 0 ; +xfs_iflags_clear (XFS_I (mapping->host),XFS_ITRUNCATED );return iomap_writepages (mapping, wbc, &wpc.ctx, &xfs_writeback_ops); }
fs/xfs/xfs_trans.c +5 -15
@@ -68,6 +68,7 @@ xfs_trans_free(xfs_extent_busy_clear (tp->t_mountp, &tp->t_busy, false);trace_xfs_trans_free (tp, _RET_IP_); +xfs_trans_clear_context (tp);if (!(tp->t_flags &XFS_TRANS_NO_WRITECOUNT ))sb_end_intwrite (tp->t_mountp->m_super);xfs_trans_free_dqinfo (tp);
@@ -119,7 +120,8 @@ xfs_trans_dup( ntp->t_rtx_res = tp->t_rtx_res - tp->t_rtx_res_used; tp->t_rtx_res = tp->t_rtx_res_used; - ntp->t_pflags = tp->t_pflags; + +xfs_trans_switch_context (tp, ntp);/* move deferred ops over to the new tp */ xfs_defer_move (ntp, tp);
@@ -153,9 +155,6 @@ xfs_trans_reserve(int error =0 ;bool rsvd = (tp->t_flags &XFS_TRANS_RESERVE ) !=0 ; -/* Mark this thread as being in a transaction */ -current_set_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); -/* * Attempt to reserve the needed disk blocks by decrementing * the number needed from the number available. This will
@@ -163,10 +162,8 @@ xfs_trans_reserve(*/ if (blocks >0 ) { error =xfs_mod_fdblocks (mp, -((int64_t )blocks), rsvd); -if (error !=0 ) { -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +if (error !=0 )return -ENOSPC ; - } tp->t_blk_res += blocks; }
@@ -240,9 +237,6 @@ xfs_trans_reserve(xfs_mod_fdblocks (mp, (int64_t )blocks, rsvd); tp->t_blk_res =0 ; } - -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); -return error; }
@@ -266,6 +260,7 @@ xfs_trans_alloc( tp =kmem_cache_zalloc (xfs_trans_zone,GFP_KERNEL | __GFP_NOFAIL);if (!(flags &XFS_TRANS_NO_WRITECOUNT ))sb_start_intwrite (mp->m_super); +xfs_trans_set_context (tp);/* * Zero-reservation ("empty") transactions can't modify anything, so
@@ -878,7 +873,6 @@ __xfs_trans_commit(xfs_log_commit_cil (mp, tp, &commit_lsn, regrant); -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS );xfs_trans_free (tp);/*
@@ -910,7 +904,6 @@ __xfs_trans_commit(xfs_log_ticket_ungrant (mp->m_log, tp->t_ticket); tp->t_ticket =NULL ; } -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS );xfs_trans_free_items (tp, !!error);xfs_trans_free (tp);
@@ -970,9 +963,6 @@ xfs_trans_cancel( tp->t_ticket =NULL ; } -/* mark this thread as no longer being in a transaction */ -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); -xfs_trans_free_items (tp, dirty);xfs_trans_free (tp); }
fs/xfs/xfs_trans.h +30 -0
@@ -268,4 +268,34 @@ xfs_trans_item_relog( return lip->li_ops->iop_relog(lip, tp); } +static inline void +xfs_trans_set_context ( +struct xfs_trans *tp) +{ +ASSERT (current->journal_info ==NULL ); + tp->t_pflags =memalloc_nofs_save (); + current->journal_info = tp; +} + +static inline void +xfs_trans_clear_context ( +struct xfs_trans *tp) +{ +if (current->journal_info == tp) { +memalloc_nofs_restore (tp->t_pflags); + current->journal_info =NULL ; + } +} + +static inline void +xfs_trans_switch_context ( +struct xfs_trans *old_tp, +struct xfs_trans *new_tp) +{ +ASSERT (current->journal_info == old_tp); + new_tp->t_pflags = old_tp->t_pflags; + old_tp->t_pflags =0 ; + current->journal_info = new_tp; +} +#endif /* __XFS_TRANS_H__ */
Signature · 1 line
2.25.1
PATCH 2/7 xfs: rename variable mp to parsing_mp
In reply to Amir GoldsteinFrom: Pavel Reichl <[email protected]>
commit 0f98b4ece18da9d8287bb4cc4e8f78b8760ea0d0 upstream.
Rename mp variable to parsisng_mp so it is easy to distinguish between current mount point handle and handle for mount point which mount options are being parsed.
--- fs/xfs/xfs_super.c | 102 ++++++++++++++++++++++----------------------- 1 file changed, 51 insertions(+), 51 deletions(-)
fs/xfs/xfs_super.c +51 -51
@@ -1165,7 +1165,7 @@ xfs_fc_parse_param(struct fs_context *fc, struct fs_parameter *param) { - struct xfs_mount *mp = fc->s_fs_info; + struct xfs_mount *parsing_mp = fc->s_fs_info;struct fs_parse_result result;int size =0 ;int opt;
@@ -1176,142 +1176,142 @@ xfs_fc_parse_param(switch (opt) {case Opt_logbufs: - mp->m_logbufs = result.uint_32; + parsing_mp->m_logbufs = result.uint_32;return 0 ;case Opt_logbsize: -if (suffix_kstrtoint (param->string,10 , &mp->m_logbsize)) +if (suffix_kstrtoint (param->string,10 , &parsing_mp->m_logbsize))return -EINVAL ;return 0 ;case Opt_logdev: -kfree (mp->m_logname); - mp->m_logname =kstrdup (param->string,GFP_KERNEL ); -if (!mp->m_logname) +kfree (parsing_mp->m_logname); + parsing_mp->m_logname =kstrdup (param->string,GFP_KERNEL ); +if (!parsing_mp->m_logname)return -ENOMEM ;return 0 ;case Opt_rtdev: -kfree (mp->m_rtname); - mp->m_rtname =kstrdup (param->string,GFP_KERNEL ); -if (!mp->m_rtname) +kfree (parsing_mp->m_rtname); + parsing_mp->m_rtname =kstrdup (param->string,GFP_KERNEL ); +if (!parsing_mp->m_rtname)return -ENOMEM ;return 0 ;case Opt_allocsize:if (suffix_kstrtoint (param->string,10 , &size))return -EINVAL ; - mp->m_allocsize_log =ffs (size) -1 ; - mp->m_flags |=XFS_MOUNT_ALLOCSIZE ; + parsing_mp->m_allocsize_log =ffs (size) -1 ; + parsing_mp->m_flags |=XFS_MOUNT_ALLOCSIZE ;return 0 ;case Opt_grpid:case Opt_bsdgroups: - mp->m_flags |=XFS_MOUNT_GRPID ; + parsing_mp->m_flags |=XFS_MOUNT_GRPID ;return 0 ;case Opt_nogrpid:case Opt_sysvgroups: - mp->m_flags &= ~XFS_MOUNT_GRPID ; + parsing_mp->m_flags &= ~XFS_MOUNT_GRPID ;return 0 ;case Opt_wsync: - mp->m_flags |=XFS_MOUNT_WSYNC ; + parsing_mp->m_flags |=XFS_MOUNT_WSYNC ;return 0 ;case Opt_norecovery: - mp->m_flags |=XFS_MOUNT_NORECOVERY ; + parsing_mp->m_flags |=XFS_MOUNT_NORECOVERY ;return 0 ;case Opt_noalign: - mp->m_flags |=XFS_MOUNT_NOALIGN ; + parsing_mp->m_flags |=XFS_MOUNT_NOALIGN ;return 0 ;case Opt_swalloc: - mp->m_flags |=XFS_MOUNT_SWALLOC ; + parsing_mp->m_flags |=XFS_MOUNT_SWALLOC ;return 0 ;case Opt_sunit: - mp->m_dalign = result.uint_32; + parsing_mp->m_dalign = result.uint_32;return 0 ;case Opt_swidth: - mp->m_swidth = result.uint_32; + parsing_mp->m_swidth = result.uint_32;return 0 ;case Opt_inode32: - mp->m_flags |=XFS_MOUNT_SMALL_INUMS ; + parsing_mp->m_flags |=XFS_MOUNT_SMALL_INUMS ;return 0 ;case Opt_inode64: - mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS ; + parsing_mp->m_flags &= ~XFS_MOUNT_SMALL_INUMS ;return 0 ;case Opt_nouuid: - mp->m_flags |=XFS_MOUNT_NOUUID ; + parsing_mp->m_flags |=XFS_MOUNT_NOUUID ;return 0 ;case Opt_largeio: - mp->m_flags |=XFS_MOUNT_LARGEIO ; + parsing_mp->m_flags |=XFS_MOUNT_LARGEIO ;return 0 ;case Opt_nolargeio: - mp->m_flags &= ~XFS_MOUNT_LARGEIO ; + parsing_mp->m_flags &= ~XFS_MOUNT_LARGEIO ;return 0 ;case Opt_filestreams: - mp->m_flags |=XFS_MOUNT_FILESTREAMS ; + parsing_mp->m_flags |=XFS_MOUNT_FILESTREAMS ;return 0 ;case Opt_noquota: - mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT ; - mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD ; - mp->m_qflags &= ~XFS_ALL_QUOTA_ACTIVE ; + parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACCT ; + parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ENFD ; + parsing_mp->m_qflags &= ~XFS_ALL_QUOTA_ACTIVE ;return 0 ;case Opt_quota:case Opt_uquota:case Opt_usrquota: - mp->m_qflags |= (XFS_UQUOTA_ACCT |XFS_UQUOTA_ACTIVE | + parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT |XFS_UQUOTA_ACTIVE |XFS_UQUOTA_ENFD );return 0 ;case Opt_qnoenforce:case Opt_uqnoenforce: - mp->m_qflags |= (XFS_UQUOTA_ACCT |XFS_UQUOTA_ACTIVE ); - mp->m_qflags &= ~XFS_UQUOTA_ENFD ; + parsing_mp->m_qflags |= (XFS_UQUOTA_ACCT |XFS_UQUOTA_ACTIVE ); + parsing_mp->m_qflags &= ~XFS_UQUOTA_ENFD ;return 0 ;case Opt_pquota:case Opt_prjquota: - mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE | + parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE |XFS_PQUOTA_ENFD );return 0 ;case Opt_pqnoenforce: - mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE ); - mp->m_qflags &= ~XFS_PQUOTA_ENFD ; + parsing_mp->m_qflags |= (XFS_PQUOTA_ACCT |XFS_PQUOTA_ACTIVE ); + parsing_mp->m_qflags &= ~XFS_PQUOTA_ENFD ;return 0 ;case Opt_gquota:case Opt_grpquota: - mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE | + parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE |XFS_GQUOTA_ENFD );return 0 ;case Opt_gqnoenforce: - mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE ); - mp->m_qflags &= ~XFS_GQUOTA_ENFD ; + parsing_mp->m_qflags |= (XFS_GQUOTA_ACCT |XFS_GQUOTA_ACTIVE ); + parsing_mp->m_qflags &= ~XFS_GQUOTA_ENFD ;return 0 ;case Opt_discard: - mp->m_flags |=XFS_MOUNT_DISCARD ; + parsing_mp->m_flags |=XFS_MOUNT_DISCARD ;return 0 ;case Opt_nodiscard: - mp->m_flags &= ~XFS_MOUNT_DISCARD ; + parsing_mp->m_flags &= ~XFS_MOUNT_DISCARD ;return 0 ;#ifdef CONFIG_FS_DAX case Opt_dax: -xfs_mount_set_dax_mode (mp,XFS_DAX_ALWAYS ); +xfs_mount_set_dax_mode (parsing_mp,XFS_DAX_ALWAYS );return 0 ;case Opt_dax_enum: -xfs_mount_set_dax_mode (mp, result.uint_32); +xfs_mount_set_dax_mode (parsing_mp, result.uint_32);return 0 ;#endif /* Following mount options will be removed in September 2025 */ case Opt_ikeep: -xfs_warn (mp,"%s mount option is deprecated." , param->key); - mp->m_flags |=XFS_MOUNT_IKEEP ; +xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); + parsing_mp->m_flags |=XFS_MOUNT_IKEEP ;return 0 ;case Opt_noikeep: -xfs_warn (mp,"%s mount option is deprecated." , param->key); - mp->m_flags &= ~XFS_MOUNT_IKEEP ; +xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); + parsing_mp->m_flags &= ~XFS_MOUNT_IKEEP ;return 0 ;case Opt_attr2: -xfs_warn (mp,"%s mount option is deprecated." , param->key); - mp->m_flags |=XFS_MOUNT_ATTR2 ; +xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); + parsing_mp->m_flags |=XFS_MOUNT_ATTR2 ;return 0 ;case Opt_noattr2: -xfs_warn (mp,"%s mount option is deprecated." , param->key); - mp->m_flags &= ~XFS_MOUNT_ATTR2 ; - mp->m_flags |=XFS_MOUNT_NOATTR2 ; +xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); + parsing_mp->m_flags &= ~XFS_MOUNT_ATTR2 ; + parsing_mp->m_flags |=XFS_MOUNT_NOATTR2 ;return 0 ;default : -xfs_warn (mp,"unknown mount option [%s]." , param->key); +xfs_warn (parsing_mp,"unknown mount option [%s]." , param->key);return -EINVAL ; }
Signature · 1 line
2.25.1
PATCH 3/7 xfs: Skip repetitive warnings about mount options
In reply to Amir GoldsteinFrom: Pavel Reichl <[email protected]>
commit 92cf7d36384b99d5a57bf4422904a3c16dc4527a upstream.
Skip the warnings about mount option being deprecated if we are remounting and deprecated option state is not changing.
--- fs/xfs/xfs_super.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
fs/xfs/xfs_super.c +20 -4
@@ -1155,6 +1155,22 @@ suffix_kstrtoint(return ret; } +static inline void +xfs_fs_warn_deprecated ( +struct fs_context *fc, +struct fs_parameter *param, +uint64_t flag, +bool value) +{ +/* Don't print the warning if reconfiguring and current mount point +* already had the flag set +*/ +if ((fc->purpose &FS_CONTEXT_FOR_RECONFIGURE ) && + !!(XFS_M (fc->root->d_sb)->m_flags & flag) == value) +return ; +xfs_warn (fc->s_fs_info,"%s mount option is deprecated." , param->key); +} +/* * Set mount state from a mount option. *
@@ -1294,19 +1310,19 @@ xfs_fc_parse_param(#endif /* Following mount options will be removed in September 2025 */ case Opt_ikeep: -xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); +xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_IKEEP , true); parsing_mp->m_flags |=XFS_MOUNT_IKEEP ;return 0 ;case Opt_noikeep: -xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); +xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_IKEEP , false); parsing_mp->m_flags &= ~XFS_MOUNT_IKEEP ;return 0 ;case Opt_attr2: -xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); +xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_ATTR2 , true); parsing_mp->m_flags |=XFS_MOUNT_ATTR2 ;return 0 ;case Opt_noattr2: -xfs_warn (parsing_mp,"%s mount option is deprecated." , param->key); +xfs_fs_warn_deprecated (fc, param,XFS_MOUNT_NOATTR2 , true); parsing_mp->m_flags &= ~XFS_MOUNT_ATTR2 ; parsing_mp->m_flags |=XFS_MOUNT_NOATTR2 ;return 0 ;
Signature · 1 line
2.25.1
PATCH 4/7 xfs: ensure xfs_errortag_random_default matches XFS_ERRTAG_MAX
In reply to Amir GoldsteinFrom: Gao Xiang <[email protected]>
commit b2c2974b8cdf1eb3ef90ff845eb27b19e2187b7e upstream.
Add the BUILD_BUG_ON to xfs_errortag_add() in order to make sure that the length of xfs_errortag_random_default matches XFS_ERRTAG_MAX when building.
--- fs/xfs/xfs_error.c | 2 ++ 1 file changed, 2 insertions(+)
fs/xfs/xfs_error.c +2 -0
@@ -293,6 +293,8 @@ xfs_errortag_add(struct xfs_mount *mp, unsigned int error_tag) { + BUILD_BUG_ON(ARRAY_SIZE(xfs_errortag_random_default) != XFS_ERRTAG_MAX); +if (error_tag >=XFS_ERRTAG_MAX )return -EINVAL ;
Signature · 1 line
2.25.1
PATCH 5/7 xfs: fix xfs_trans slab cache name
In reply to Amir GoldsteinFrom: Anthony Iliopoulos <[email protected]>
commit 25dfa65f814951a33072bcbae795989d817858da upstream.
Removal of kmem_zone_init wrappers accidentally changed a slab cache name from "xfs_trans" to "xf_trans". Fix this so that userspace consumers of /proc/slabinfo and /sys/kernel/slab can find it again.
--- fs/xfs/xfs_super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_super.c +1 -1
@@ -1926,7 +1926,7 @@ xfs_init_zones(void)if (!xfs_ifork_zone) goto out_destroy_da_state_zone; - xfs_trans_zone =kmem_cache_create ("xf_trans" , + xfs_trans_zone =kmem_cache_create ("xfs_trans" ,sizeof (struct xfs_trans ),0 ,0 ,NULL );if (!xfs_trans_zone)
Signature · 1 line
2.25.1
PATCH 6/7 xfs: update superblock counters correctly for !lazysbcount
In reply to Amir GoldsteinFrom: Dave Chinner <[email protected]>
commit 6543990a168acf366f4b6174d7bd46ba15a8a2a6 upstream.
Keep the mount superblock counters up to date for !lazysbcount filesystems so that when we log the superblock they do not need updating in any way because they are already correct.
It's found by what Zorro reported:
1. mkfs.xfs -f -l lazy-count=0 -m crc=0 $dev
2. mount $dev $mnt
3. fsstress -d $mnt -p 100 -n 1000 (maybe need more or less io load)
4. umount $mnt
5. xfs_repair -n $dev
and I've seen no problem with this patch.
--- fs/xfs/libxfs/xfs_sb.c | 16 +++++++++++++--- fs/xfs/xfs_trans.c | 3 +++ 2 files changed, 16 insertions(+), 3 deletions(-)
fs/xfs/libxfs/xfs_sb.c +13 -3
@@ -956,9 +956,19 @@ xfs_log_sb(struct xfs_mount *mp = tp->t_mountp;struct xfs_buf *bp =xfs_trans_getsb (tp); - mp->m_sb.sb_icount =percpu_counter_sum (&mp->m_icount); - mp->m_sb.sb_ifree =percpu_counter_sum (&mp->m_ifree); - mp->m_sb.sb_fdblocks =percpu_counter_sum (&mp->m_fdblocks); +/* +* Lazy sb counters don't update the in-core superblock so do that now. +* If this is at unmount, the counters will be exactly correct, but at +* any other time they will only be ballpark correct because of +* reservations that have been taken out percpu counters. If we have an +* unclean shutdown, this will be corrected by log recovery rebuilding +* the counters from the AGF block counts. +*/ +if (xfs_sb_version_haslazysbcount (&mp->m_sb)) { + mp->m_sb.sb_icount =percpu_counter_sum (&mp->m_icount); + mp->m_sb.sb_ifree =percpu_counter_sum (&mp->m_ifree); + mp->m_sb.sb_fdblocks =percpu_counter_sum (&mp->m_fdblocks); + }xfs_sb_to_disk (bp->b_addr, &mp->m_sb);xfs_trans_buf_set_type (tp, bp,XFS_BLFT_SB_BUF );
fs/xfs/xfs_trans.c +3 -0
@@ -615,6 +615,9 @@ xfs_trans_unreserve_and_mod_sb(/* apply remaining deltas */ spin_lock (&mp->m_sb_lock); + mp->m_sb.sb_fdblocks += tp->t_fdblocks_delta + tp->t_res_fdblocks_delta; + mp->m_sb.sb_icount += idelta; + mp->m_sb.sb_ifree += ifreedelta; mp->m_sb.sb_frextents += rtxdelta; mp->m_sb.sb_dblocks += tp->t_dblocks_delta; mp->m_sb.sb_agcount += tp->t_agcount_delta;
Signature · 1 line
2.25.1
PATCH 7/7 xfs: fix xfs_reflink_unshare usage of filemap_write_and_wait_range
In reply to Amir GoldsteinFrom: "Darrick J. Wong" <[email protected]>
commit d4f74e162d238ce00a640af5f0611c3f51dad70e upstream.
The final parameter of filemap_write_and_wait_range is the end of the range to flush, not the length of the range to flush.
--- fs/xfs/xfs_reflink.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_reflink.c +2 -1
@@ -1503,7 +1503,8 @@ xfs_reflink_unshare(if (error) goto out; - error =filemap_write_and_wait_range (inode->i_mapping, offset, len); + error =filemap_write_and_wait_range (inode->i_mapping, offset, + offset + len -1 );if (error) goto out;
Signature · 1 line
2.25.1