xfs: fix frozen file system assert in xfs_trans_alloc
PATCH 1/1 xfs: fix frozen file system assert in xfs_trans_alloc
Commit 83a80e95e797 ("xfs: decouple xfs_trans_alloc_empty from xfs_trans_alloc") move the place of the assert for a frozen file system after the sb_start_intwrite call that ensures it doesn't run on frozen file systems, and thus allows to incorrect trigger it.
Fix that by moving it back to where it belongs.
--- fs/xfs/xfs_trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_trans.c +1 -1
@@ -253,8 +253,8 @@ xfs_trans_alloc(* by doing GFP_KERNEL allocations inside sb_start_intwrite(). */ retry: -WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE ); tp =__xfs_trans_alloc (mp, flags); +WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE ); error =xfs_trans_reserve (tp, resp, blocks, rtextents);if (error == -ENOSPC && want_retry) {xfs_trans_cancel (tp);
Signature · 1 line
2.47.2
Quoted 19 lines · Christoph Hellwig
Commit
83a80e95e797("xfs: decouplexfs_trans_alloc_emptyfromxfs_trans_alloc") move the place of the assert for a frozen file system after thesb_start_intwritecall that ensures it doesn't run on frozen file systems, and thus allows to incorrect trigger it.Fix that by moving it back to where it belongs.
Fixes 83a80e95e797 ("xfs: decouple xfs_trans_alloc_empty from xfs_trans_alloc")Reported-by Dave Chinner <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>--- fs/xfs/xfs_trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)fs/xfs/xfs_trans.c +0
-0
fs/xfs/xfs_trans.c xfs_trans_alloc( · line 257
Quoted 6 lines
fs/xfs/xfs_trans.c +1
-1@@ -253,8 +253,8 @@ xfs_trans_alloc(* by doing GFP_KERNEL allocations inside sb_start_intwrite(). */ retry: -WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE ); tp =__xfs_trans_alloc (mp, flags); +WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE );
Empty transactions can run during a freeze, so please put back the original warning and comment:
/*
* Zero-reservation ("empty") transactions can't modify anything, so
* they're allowed to run while we're frozen.
*/
WARN_ON(resp->tr_logres > 0 &&
mp->m_super->s_writers.frozen == SB_FREEZE_COMPLETE);--D
Quoted 7 lines
fs/xfs/xfs_trans.c +0
-0error =xfs_trans_reserve (tp, resp, blocks, rtextents);if (error == -ENOSPC && want_retry) {xfs_trans_cancel (tp);Signature · 1 line
2.47.2
Quoted 7 lines · Darrick J. Wong
fs/xfs/xfs_trans.c xfs_trans_alloc( · line 257
Quoted 4 lines
retry:
fs/xfs/xfs_trans.c +1
-1-WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE ); tp =__xfs_trans_alloc (mp, flags); +WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE );Empty transactions can run during a freeze, so please put back the original warning and comment:
Empty transactions don't end up in this code path any more.
Darrick J. Wong
Reviewed-byQuoted 10 lines · Christoph Hellwig
Quoted 7 lines · Darrick J. Wong
fs/xfs/xfs_trans.c xfs_trans_alloc( · line 257
Quoted 4 lines
retry:
fs/xfs/xfs_trans.c +1
-1-WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE ); tp =__xfs_trans_alloc (mp, flags); +WARN_ON (mp->m_super->s_writers.frozen ==SB_FREEZE_COMPLETE );Empty transactions can run during a freeze, so please put back the original warning and comment:
Empty transactions don't end up in this code path any more.
Oh, hah, silly me, I forgot that also got changed by that patchset. :(
--D
Quoted 8 lines · Christoph Hellwig
Commit
83a80e95e797("xfs: decouplexfs_trans_alloc_emptyfromxfs_trans_alloc") move the place of the assert for a frozen file system after thesb_start_intwritecall that ensures it doesn't run on frozen file systems, and thus allows to incorrect trigger it.Fix that by moving it back to where it belongs.
[...]
Applied to for-next, thanks!
[1/1] xfs: fix frozen file system assert in xfs_trans_alloc
commit: 647b3d59c768d7638dd17c78c8044178364383ca
Best regards,
Signature · 1 line
Carlos Maiolino <[email protected]>