Commit c05e3944 authored by Eric Sandeen's avatar Eric Sandeen Committed by Nathan Scott

[XFS] Use PFLAGS_RESTORE_FSTRANS in place of PFLAGS_RESTORE, only restore

previously saved FSTRANS state.  Otherwise we can lose process flags.

SGI Modid: xfs-linux:xfs-kern:168082a
parent b73e33f4
...@@ -57,13 +57,21 @@ typedef unsigned long xfs_pflags_t; ...@@ -57,13 +57,21 @@ typedef unsigned long xfs_pflags_t;
#define PFLAGS_TEST_FSTRANS() (current->flags & PF_FSTRANS) #define PFLAGS_TEST_FSTRANS() (current->flags & PF_FSTRANS)
/* these could be nested, so we save state */
#define PFLAGS_SET_FSTRANS(STATEP) do { \ #define PFLAGS_SET_FSTRANS(STATEP) do { \
*(STATEP) = current->flags; \ *(STATEP) = current->flags; \
current->flags |= PF_FSTRANS; \ current->flags |= PF_FSTRANS; \
} while (0) } while (0)
#define PFLAGS_RESTORE(STATEP) do { \ #define PFLAGS_CLEAR_FSTRANS(STATEP) do { \
current->flags = *(STATEP); \ *(STATEP) = current->flags; \
current->flags &= ~PF_FSTRANS; \
} while (0)
/* Restore the PF_FSTRANS state to what was saved in STATEP */
#define PFLAGS_RESTORE_FSTRANS(STATEP) do { \
current->flags = ((current->flags & ~PF_FSTRANS) | \
(*(STATEP) & PF_FSTRANS)); \
} while (0) } while (0)
#define PFLAGS_DUP(OSTATEP, NSTATEP) do { \ #define PFLAGS_DUP(OSTATEP, NSTATEP) do { \
......
...@@ -250,7 +250,7 @@ xfs_trans_reserve( ...@@ -250,7 +250,7 @@ xfs_trans_reserve(
error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FDBLOCKS, error = xfs_mod_incore_sb(tp->t_mountp, XFS_SBS_FDBLOCKS,
-blocks, rsvd); -blocks, rsvd);
if (error != 0) { if (error != 0) {
PFLAGS_RESTORE(&tp->t_pflags); PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
return (XFS_ERROR(ENOSPC)); return (XFS_ERROR(ENOSPC));
} }
tp->t_blk_res += blocks; tp->t_blk_res += blocks;
...@@ -323,7 +323,7 @@ xfs_trans_reserve( ...@@ -323,7 +323,7 @@ xfs_trans_reserve(
tp->t_blk_res = 0; tp->t_blk_res = 0;
} }
PFLAGS_RESTORE(&tp->t_pflags); PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
return (error); return (error);
} }
...@@ -734,7 +734,7 @@ xfs_trans_commit( ...@@ -734,7 +734,7 @@ xfs_trans_commit(
if (commit_lsn == -1 && !shutdown) if (commit_lsn == -1 && !shutdown)
shutdown = XFS_ERROR(EIO); shutdown = XFS_ERROR(EIO);
} }
PFLAGS_RESTORE(&tp->t_pflags); PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
xfs_trans_free_items(tp, shutdown? XFS_TRANS_ABORT : 0); xfs_trans_free_items(tp, shutdown? XFS_TRANS_ABORT : 0);
xfs_trans_free_busy(tp); xfs_trans_free_busy(tp);
xfs_trans_free(tp); xfs_trans_free(tp);
...@@ -823,7 +823,7 @@ xfs_trans_commit( ...@@ -823,7 +823,7 @@ xfs_trans_commit(
* had pinned, clean up, free trans structure, and return error. * had pinned, clean up, free trans structure, and return error.
*/ */
if (error || commit_lsn == -1) { if (error || commit_lsn == -1) {
PFLAGS_RESTORE(&tp->t_pflags); PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
xfs_trans_uncommit(tp, flags|XFS_TRANS_ABORT); xfs_trans_uncommit(tp, flags|XFS_TRANS_ABORT);
return XFS_ERROR(EIO); return XFS_ERROR(EIO);
} }
...@@ -862,7 +862,7 @@ xfs_trans_commit( ...@@ -862,7 +862,7 @@ xfs_trans_commit(
error = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb)); error = xfs_log_notify(mp, commit_iclog, &(tp->t_logcb));
/* mark this thread as no longer being in a transaction */ /* mark this thread as no longer being in a transaction */
PFLAGS_RESTORE(&tp->t_pflags); PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
/* /*
* Once all the items of the transaction have been copied * Once all the items of the transaction have been copied
...@@ -1100,7 +1100,7 @@ xfs_trans_cancel( ...@@ -1100,7 +1100,7 @@ xfs_trans_cancel(
} }
/* mark this thread as no longer being in a transaction */ /* mark this thread as no longer being in a transaction */
PFLAGS_RESTORE(&tp->t_pflags); PFLAGS_RESTORE_FSTRANS(&tp->t_pflags);
xfs_trans_free_items(tp, flags); xfs_trans_free_items(tp, flags);
xfs_trans_free_busy(tp); xfs_trans_free_busy(tp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment