xfs: reintroduce PF_FSTRANS for transaction reservation recursion protection
Subsystems (5)
PATCH 1/1 xfs: reintroduce PF_FSTRANS for transaction reservation recursion protection
PF_FSTRANS which is used to avoid transaction reservation recursion, is dropped since commit 9070733b4efa ("xfs: abstract PF_FSTRANS to PF_MEMALLOC_NOFS") and commit 7dea19f9ee63 ("mm: introduce memalloc_nofs_{save,restore} API") and replaced by PF_MEMALLOC_NOFS which means to avoid filesystem reclaim recursion. That change is subtle. Let's take the exmple of the check of WARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) to explain why this abstraction from PF_FSTRANS to PF_MEMALLOC_NOFS is not proper.
Bellow comment is quoted from Dave,
Quoted 5 lines
It wasn't for memory allocation recursion protection in XFS - it was for transaction reservation recursion protection by something trying to flush data pages while holding a transaction reservation. Doing this could deadlock the journal because the existing reservation could prevent the nested reservation for being able to reserve space
Quoted 8 lines
in the journal and that is a self-deadlock vector.
IOWs, this check is not protecting against memory reclaim recursion bugs at all (that's the previous check [1]). This check is protecting against the filesystem calling writepages directly from a context where it can self-deadlock.
So what we are seeing here is that thePF_FSTRANS->PF_MEMALLOC_NOFSabstraction lost all the actual useful information about what type of error this check was protecting against.
Besides reintroducing PF_FSTRANS, there're some other improvements in this patch,
- Remove useless MACRO current_clear_flags_nested(), current_pid() and current_test_flags().
- Remove useless memalloc_nofs_{save, restore} in __kmem_vmalloc()
[1]. Bellow check is to avoid memory reclaim recursion. if (WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) ==
PF_MEMALLOC)) goto redirty;
--- fs/iomap/buffered-io.c | 4 ++-- fs/xfs/kmem.c | 7 ------- fs/xfs/kmem.h | 2 +- fs/xfs/libxfs/xfs_btree.c | 2 +- fs/xfs/xfs_aops.c | 4 ++-- fs/xfs/xfs_linux.h | 4 ---- fs/xfs/xfs_trans.c | 12 ++++++------ include/linux/sched.h | 1 + 8 files changed, 13 insertions(+), 23 deletions(-)
fs/iomap/buffered-io.c +2 -2
@@ -1500,9 +1500,9 @@ static void iomap_writepage_end_bio(struct bio *bio)/* * Given that we do not allow direct reclaim to call us, we should -* never be called in a recursive filesystem reclaim context. +* never be called while in a filesystem transaction. */ -if (WARN_ON_ONCE (current->flags &PF_MEMALLOC_NOFS )) +if (WARN_ON_ONCE (current->flags &PF_FSTRANS )) goto redirty;/*
fs/xfs/kmem.c +0 -7
@@ -41,18 +41,11 @@static void *__kmem_vmalloc (size_t size,xfs_km_flags_t flags) { -unsigned nofs_flag =0 ;void *ptr;gfp_t lflags =kmem_flags_convert (flags); -if (flags &KM_NOFS ) - nofs_flag =memalloc_nofs_save (); - ptr =__vmalloc (size, lflags); -if (flags &KM_NOFS ) -memalloc_nofs_restore (nofs_flag); -return ptr; }
fs/xfs/kmem.h +1 -1
@@ -34,7 +34,7 @@BUG_ON (flags & ~(KM_NOFS |KM_MAYFAIL |KM_ZERO |KM_NOLOCKDEP )); lflags =GFP_KERNEL | __GFP_NOWARN; -if (flags &KM_NOFS ) +if (current->flags &PF_FSTRANS || flags &KM_NOFS ) lflags &= ~__GFP_FS;/*
fs/xfs/libxfs/xfs_btree.c +1 -1
@@ -2814,7 +2814,7 @@ struct xfs_btree_split_args {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 =PF_FSTRANS ;/* * we are in a transaction context here, but may also be doing work
fs/xfs/xfs_aops.c +2 -2
@@ -62,7 +62,7 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend)* 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 ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );return 0 ; }
@@ -125,7 +125,7 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *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 ); +current_set_flags_nested (&tp->t_pflags,PF_FSTRANS );__sb_writers_acquired (VFS_I (ip)->i_sb,SB_FREEZE_FS );/* we abort the update if there was an IO error */
fs/xfs/xfs_linux.h +0 -4
@@ -102,12 +102,8 @@#define xfs_cowb_secs xfs_params.cowb_timer.val#define current_cpu () (raw_smp_processor_id()) -#define current_pid () (current->pid) -#define current_test_flags (f) (current->flags & (f))#define current_set_flags_nested (sp, f) \ (*(sp) = current->flags, current->flags |= (f)) -#define current_clear_flags_nested (sp, f) \ - (*(sp) = current->flags, current->flags &= ~(f))#define current_restore_flags_nested (sp, f) \ (current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))
fs/xfs/xfs_trans.c +6 -6
@@ -153,7 +153,7 @@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 ); +current_set_flags_nested (&tp->t_pflags,PF_FSTRANS );/* * Attempt to reserve the needed disk blocks by decrementing
@@ -163,7 +163,7 @@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 ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );return -ENOSPC ; } tp->t_blk_res += blocks;
@@ -240,7 +240,7 @@ tp->t_blk_res =0 ; } -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );return error; }
@@ -861,7 +861,7 @@xfs_log_commit_cil (mp, tp, &commit_lsn, regrant); -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );xfs_trans_free (tp);/*
@@ -893,7 +893,7 @@xfs_log_ticket_ungrant (mp->m_log, tp->t_ticket); tp->t_ticket =NULL ; } -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );xfs_trans_free_items (tp, !!error);xfs_trans_free (tp);
@@ -954,7 +954,7 @@ }/* mark this thread as no longer being in a transaction */ -current_restore_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );xfs_trans_free_items (tp, dirty);xfs_trans_free (tp);
include/linux/sched.h +1 -0
@@ -1511,6 +1511,7 @@ static inline int is_global_init(struct task_struct *tsk)#define PF_KTHREAD 0x00200000/* I am a kernel thread */ #define PF_RANDOMIZE 0x00400000/* Randomize virtual address space */ #define PF_SWAPWRITE 0x00800000/* Allowed to write to swap */ +#define PF_FSTRANS 0x01000000/* Inside a filesystem transaction */ #define PF_UMH 0x02000000/* I'm an Usermodehelper process */ #define PF_NO_SETAFFINITY 0x04000000/* Userland is not allowed to meddle with cpus_mask */ #define PF_MCE_EARLY 0x08000000/* Early kill for mce process policy */
Signature · 1 line
1.8.3.1
Quoted 54 lines · Yafang Shao
PF_FSTRANSwhich is used to avoid transaction reservation recursion, is dropped since commit9070733b4efa("xfs: abstractPF_FSTRANStoPF_MEMALLOC_NOFS") and commit7dea19f9ee63("mm: introduce memalloc_nofs_{save,restore} API") and replaced byPF_MEMALLOC_NOFSwhich means to avoid filesystem reclaim recursion. That change is subtle. Let's take the exmple of the check ofWARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) to explain why this abstraction fromPF_FSTRANStoPF_MEMALLOC_NOFSis not proper.Bellow comment is quoted from Dave,
Quoted 5 lines
It wasn't for memory allocation recursion protection in XFS - it was for transaction reservation recursion protection by something trying to flush data pages while holding a transaction reservation. Doing this could deadlock the journal because the existing reservation could prevent the nested reservation for being able to reserve space
Quoted 8 lines
in the journal and that is a self-deadlock vector.
IOWs, this check is not protecting against memory reclaim recursion bugs at all (that's the previous check [1]). This check is protecting against the filesystem calling writepages directly from a context where it can self-deadlock.
So what we are seeing here is that thePF_FSTRANS->PF_MEMALLOC_NOFSabstraction lost all the actual useful information about what type of error this check was protecting against.Besides reintroducing
PF_FSTRANS, there're some other improvements in this patch,
- Remove useless MACROcurrent_clear_flags_nested(),current_pid()andcurrent_test_flags().
- Remove useless memalloc_nofs_{save, restore} in__kmem_vmalloc()[1]. Bellow check is to avoid memory reclaim recursion. if (WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) ==
PF_MEMALLOC)) goto redirty;Cc Dave Chinner <[email protected]>Cc Michal Hocko <[email protected]>Signed-off-by Yafang Shao <[email protected]>--- fs/iomap/buffered-io.c | 4 ++-- fs/xfs/kmem.c | 7 ------- fs/xfs/kmem.h | 2 +- fs/xfs/libxfs/xfs_btree.c | 2 +- fs/xfs/xfs_aops.c | 4 ++-- fs/xfs/xfs_linux.h | 4 ---- fs/xfs/xfs_trans.c | 12 ++++++------ include/linux/sched.h | 1 + 8 files changed, 13 insertions(+), 23 deletions(-)fs/iomap/buffered-io.c +0
-0
fs/iomap/buffered-io.c static void iomap_writepage_end_bio(struct bio *bio) · line 1506
Quoted 9 lines
fs/iomap/buffered-io.c +2
-2@@ -1500,9 +1500,9 @@ static void iomap_writepage_end_bio(struct bio *bio)/* * Given that we do not allow direct reclaim to call us, we should -* never be called in a recursive filesystem reclaim context. +* never be called while in a filesystem transaction. */ -if (WARN_ON_ONCE (current->flags &PF_MEMALLOC_NOFS )) +if (WARN_ON_ONCE (current->flags &PF_FSTRANS )) goto redirty;
This is OK, but the rest of the patch is not.
I did not say "replace all XFS use of GFP_NOFS/KM_NOFS with PF_TRANS", which is what this patch does. The use of PF_MEMALLOC_NOFS within transactions is correct and valid and needs to remain. Replacing this with PF_FSTRANS effectively reverts all the simplifications and obviously self-documneting code that PF_MEMALLOC_NOFS provides us with.
IOWs, PF_MEMALLOC_NOFS is used to indicate that this is a "no reclaim recursion" path and so it's use remains completely unchanged in XFS. PF_FSTRANS is to indicate this is a "no transaction recursion" path, which is a different thing and needs it's own specific annotation.
Quoted 10 lines
fs/xfs/kmem.c +0
-1@@ -41,18 +41,11 @@static void *__kmem_vmalloc (size_t size,xfs_km_flags_t flags) { -unsigned nofs_flag =0 ;void *ptr;
fs/xfs/kmem.c line 55
Quoted 10 lines
fs/xfs/kmem.c +0
-6gfp_t lflags =kmem_flags_convert (flags); -if (flags &KM_NOFS ) - nofs_flag =memalloc_nofs_save (); - ptr =__vmalloc (size, lflags); -if (flags &KM_NOFS ) -memalloc_nofs_restore (nofs_flag); -
This breaks both kmem_alloc_large() and kmem_alloc_io() if they are called from an explicit KM_NOFS context. vmalloc() does not respect the gfp flags that are passed to it and will always do GFP_KERNEL allocations deep down in the page table allocation code, and hence we must use memalloc_nofs_save() here if called in a KM_NOFS context.
Quoted 8 lines
fs/xfs/kmem.c +0
-0return ptr; }fs/xfs/kmem.h +0
-0
fs/xfs/kmem.h line 38
Quoted 6 lines
fs/xfs/kmem.h +1
-1@@ -34,7 +34,7 @@BUG_ON (flags & ~(KM_NOFS |KM_MAYFAIL |KM_ZERO |KM_NOLOCKDEP )); lflags =GFP_KERNEL | __GFP_NOWARN; -if (flags &KM_NOFS ) +if (current->flags &PF_FSTRANS || flags &KM_NOFS ) lflags &= ~__GFP_FS;
No. If we are in a transaction context, PF_MEMALLOC_NOFS should be set. We got rid of all the PF_FSTRANS checks out of this code by moving to PF_MEMALLOC_NOFS, reverting this isn't an improvement.
fs/xfs/libxfs/xfs_btree.c struct xfs_btree_split_args { · line 2817
Quoted 12 lines
fs/xfs/kmem.h +0
-0/* fs/xfs/libxfs/xfs_btree.c +1
-1@@ -2814,7 +2814,7 @@ struct xfs_btree_split_args {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 =PF_FSTRANS ;
new_pflags = PF_MEMALLOC_NOFS | PF_FSTRANS;
fs/xfs/xfs_aops.c static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) · line 65
Quoted 13 lines
fs/xfs/libxfs/xfs_btree.c +0
-0/* * we are in a transaction context here, but may also be doing work fs/xfs/xfs_aops.c +1
-1@@ -62,7 +62,7 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend)* 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 ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );
current_restore_flags_nested(PF_MEMALLOC_NOFS | PF_FSTRANS);
fs/xfs/xfs_aops.c static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) · line 128
Quoted 9 lines
fs/xfs/xfs_aops.c +1
-1return 0 ; }@@ -125,7 +125,7 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *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 ); +current_set_flags_nested (&tp->t_pflags,PF_FSTRANS );
current_set_flags_nested(PF_MEMALLOC_NOFS | PF_FSTRANS);
Quoted 9 lines
fs/xfs/xfs_aops.c +0
-0__sb_writers_acquired (VFS_I (ip)->i_sb,SB_FREEZE_FS );/* we abort the update if there was an IO error */ fs/xfs/xfs_linux.h +0
-0@@ -102,12 +102,8 @@#define xfs_cowb_secs xfs_params.cowb_timer.val
fs/xfs/xfs_linux.h line 108
Quoted 10 lines
fs/xfs/xfs_linux.h +0
-4#define current_cpu () (raw_smp_processor_id()) -#define current_pid () (current->pid) -#define current_test_flags (f) (current->flags & (f))#define current_set_flags_nested (sp, f) \ (*(sp) = current->flags, current->flags |= (f)) -#define current_clear_flags_nested (sp, f) \ - (*(sp) = current->flags, current->flags &= ~(f))#define current_restore_flags_nested (sp, f) \ (current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))
Separate cleanup patch to remove unrelated definitions, please.
fs/xfs/xfs_trans.c line 157
Quoted 11 lines
fs/xfs/xfs_trans.c +1
-1@@ -153,7 +153,7 @@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 ); +current_set_flags_nested (&tp->t_pflags,PF_FSTRANS );
And, again, PF_FSTRANS | PF_MEMALLOC_NOFS through this code.
Cheers,
Dave.
Signature · 2 lines
Dave Chinner [email protected]
Quoted 68 lines · Dave Chinner
Quoted 54 lines · Yafang Shao
PF_FSTRANSwhich is used to avoid transaction reservation recursion, is dropped since commit9070733b4efa("xfs: abstractPF_FSTRANStoPF_MEMALLOC_NOFS") and commit7dea19f9ee63("mm: introduce memalloc_nofs_{save,restore} API") and replaced byPF_MEMALLOC_NOFSwhich means to avoid filesystem reclaim recursion. That change is subtle. Let's take the exmple of the check ofWARN_ON_ONCE(current->flags & PF_MEMALLOC_NOFS)) to explain why this abstraction fromPF_FSTRANStoPF_MEMALLOC_NOFSis not proper.Bellow comment is quoted from Dave,
Quoted 5 lines
It wasn't for memory allocation recursion protection in XFS - it was for transaction reservation recursion protection by something trying to flush data pages while holding a transaction reservation. Doing this could deadlock the journal because the existing reservation could prevent the nested reservation for being able to reserve space
Quoted 8 lines
in the journal and that is a self-deadlock vector.
IOWs, this check is not protecting against memory reclaim recursion bugs at all (that's the previous check [1]). This check is protecting against the filesystem calling writepages directly from a context where it can self-deadlock.
So what we are seeing here is that thePF_FSTRANS->PF_MEMALLOC_NOFSabstraction lost all the actual useful information about what type of error this check was protecting against.Besides reintroducing
PF_FSTRANS, there're some other improvements in this patch,
- Remove useless MACROcurrent_clear_flags_nested(),current_pid()andcurrent_test_flags().
- Remove useless memalloc_nofs_{save, restore} in__kmem_vmalloc()[1]. Bellow check is to avoid memory reclaim recursion. if (WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) ==
PF_MEMALLOC)) goto redirty;Cc Dave Chinner <[email protected]>Cc Michal Hocko <[email protected]>Signed-off-by Yafang Shao <[email protected]>--- fs/iomap/buffered-io.c | 4 ++-- fs/xfs/kmem.c | 7 ------- fs/xfs/kmem.h | 2 +- fs/xfs/libxfs/xfs_btree.c | 2 +- fs/xfs/xfs_aops.c | 4 ++-- fs/xfs/xfs_linux.h | 4 ---- fs/xfs/xfs_trans.c | 12 ++++++------ include/linux/sched.h | 1 + 8 files changed, 13 insertions(+), 23 deletions(-)fs/iomap/buffered-io.c +0
-0fs/iomap/buffered-io.c static void iomap_writepage_end_bio(struct bio *bio) · line 1506
Quoted 9 lines
fs/iomap/buffered-io.c +2
-2@@ -1500,9 +1500,9 @@ static void iomap_writepage_end_bio(struct bio *bio)/* * Given that we do not allow direct reclaim to call us, we should -* never be called in a recursive filesystem reclaim context. +* never be called while in a filesystem transaction. */ -if (WARN_ON_ONCE (current->flags &PF_MEMALLOC_NOFS )) +if (WARN_ON_ONCE (current->flags &PF_FSTRANS )) goto redirty;This is OK, but the rest of the patch is not.
Quoted 7 lines
I did not say "replace all XFS use of GFP_NOFS/KM_NOFS with
PF_TRANS", which is what this patch does. The use ofPF_MEMALLOC_NOFSwithin transactions is correct and valid and needs to remain. Replacing this withPF_FSTRANSeffectively reverts all the simplifications and obviously self-documneting code thatPF_MEMALLOC_NOFSprovides us with.
Sorry about that, I misunderstood it. Will correct it in the next version.
Quoted 6 lines
IOWs,
PF_MEMALLOC_NOFSis used to indicate that this is a "no reclaim recursion" path and so it's use remains completely unchanged in XFS.PF_FSTRANSis to indicate this is a "no transaction recursion" path, which is a different thing and needs it's own specific annotation.
Thanks for the explanation.
Quoted 17 lines
Quoted 17 lines
fs/xfs/kmem.c +0
-4@@ -41,18 +41,11 @@static void *__kmem_vmalloc (size_t size,xfs_km_flags_t flags) { -unsigned nofs_flag =0 ;void *ptr;gfp_t lflags =kmem_flags_convert (flags); -if (flags &KM_NOFS ) - nofs_flag =memalloc_nofs_save (); - ptr =__vmalloc (size, lflags);
Quoted 11 lines
fs/xfs/kmem.c line 55
Quoted 3 lines
fs/xfs/kmem.c +0
-3-if (flags &KM_NOFS ) -memalloc_nofs_restore (nofs_flag); -This breaks both
kmem_alloc_large()andkmem_alloc_io()if they are called from an explicitKM_NOFScontext.vmalloc()does not respect the gfp flags that are passed to it and will always doGFP_KERNELallocations deep down in the page table allocation code, and hence we must usememalloc_nofs_save()here if called in aKM_NOFScontext.
I thought kmem_flags_convert() has already checked KM_NOFS so we don't need to call memalloc_nofs_save(), but it seems I was wrong. Thanks for the clarification.
Quoted 10 lines
Quoted 10 lines
fs/xfs/kmem.c +0
-0return ptr; }fs/xfs/kmem.h +0
-0@@ -34,7 +34,7 @@BUG_ON (flags & ~(KM_NOFS |KM_MAYFAIL |KM_ZERO |KM_NOLOCKDEP ));
Quoted 9 lines
fs/xfs/kmem.h line 38
Quoted 4 lines
fs/xfs/kmem.h +1
-1lflags =GFP_KERNEL | __GFP_NOWARN; -if (flags &KM_NOFS ) +if (current->flags &PF_FSTRANS || flags &KM_NOFS ) lflags &= ~__GFP_FS;No. If we are in a transaction context,
PF_MEMALLOC_NOFSshould be set. We got rid of all thePF_FSTRANSchecks out of this code by moving toPF_MEMALLOC_NOFS, reverting this isn't an improvement.
Got it. Thanks.
Quoted 15 lines
fs/xfs/libxfs/xfs_btree.c struct xfs_btree_split_args { · line 2817
Quoted 12 lines
fs/xfs/kmem.h +0
-0/* fs/xfs/libxfs/xfs_btree.c +1
-1@@ -2814,7 +2814,7 @@ struct xfs_btree_split_args {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 =PF_FSTRANS ;new_pflags = PF_MEMALLOC_NOFS | PF_FSTRANS;Quoted 1 line
Quoted 15 lines
fs/xfs/xfs_aops.c static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) · line 65
Quoted 12 lines
/*
* we are in a transaction context here, but may also be doing workfs/xfs/xfs_aops.c +1
-1@@ -62,7 +62,7 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend)* 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 ); +current_restore_flags_nested (&tp->t_pflags,PF_FSTRANS );current_restore_flags_nested(PF_MEMALLOC_NOFS | PF_FSTRANS);
Thanks
Quoted 12 lines
fs/xfs/xfs_aops.c static inline bool xfs_ioend_is_append(struct iomap_ioend *ioend) · line 128
Quoted 9 lines
fs/xfs/xfs_aops.c +1
-1return 0 ; }@@ -125,7 +125,7 @@ static inline bool xfs_ioend_is_append(struct iomap_ioend *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 ); +current_set_flags_nested (&tp->t_pflags,PF_FSTRANS );current_set_flags_nested(PF_MEMALLOC_NOFS | PF_FSTRANS);
Thanks
Quoted 10 lines
Quoted 10 lines
fs/xfs/xfs_aops.c +0
-0__sb_writers_acquired (VFS_I (ip)->i_sb,SB_FREEZE_FS );/* we abort the update if there was an IO error */ fs/xfs/xfs_linux.h +0
-0@@ -102,12 +102,8 @@#define xfs_cowb_secs xfs_params.cowb_timer.val
Quoted 12 lines
fs/xfs/xfs_linux.h line 108
Quoted 9 lines
fs/xfs/xfs_linux.h +0
-4#define current_cpu () (raw_smp_processor_id()) -#define current_pid () (current->pid) -#define current_test_flags (f) (current->flags & (f))#define current_set_flags_nested (sp, f) \ (*(sp) = current->flags, current->flags |= (f)) -#define current_clear_flags_nested (sp, f) \ - (*(sp) = current->flags, current->flags &= ~(f))#define current_restore_flags_nested (sp, f) \ (current->flags = ((current->flags & ~(f)) | (*(sp) & (f))))Separate cleanup patch to remove unrelated definitions, please.
Sure, I will.
Quoted 7 lines
Quoted 7 lines
fs/xfs/xfs_trans.c +0
-0@@ -153,7 +153,7 @@bool rsvd = (tp->t_flags &XFS_TRANS_RESERVE ) !=0 ;
Quoted 7 lines
fs/xfs/xfs_trans.c line 157
Quoted 4 lines
fs/xfs/xfs_trans.c +1
-1/* Mark this thread as being in a transaction */ -current_set_flags_nested (&tp->t_pflags,PF_MEMALLOC_NOFS ); +current_set_flags_nested (&tp->t_pflags,PF_FSTRANS );And, again,
PF_FSTRANS|PF_MEMALLOC_NOFSthrough this code.
Thanks
Signature · 2 lines
Thanks Yafang