xfs: use current->journal_info for detecting transaction recursion
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.]
Fixes: 9070733b4e
("xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS")
Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Acked-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
c36d41b65e
commit
b261cd005a
@@ -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__ */
|
||||
|
Reference in New Issue
Block a user