diff options
author | Dave Chinner <david@fromorbit.com> | 2014-06-10 01:32:56 +0400 |
---|---|---|
committer | Dave Chinner <david@fromorbit.com> | 2014-06-10 01:32:56 +0400 |
commit | 7691283d0561a350b7517be94818669fb5e3d910 (patch) | |
tree | 3b939ee86e763c22c6ead988bf62de58e1981915 /fs/xfs/xfs_bmap_util.c | |
parent | 8612c7e594808e4a67bc2d4661f5925df2be3f51 (diff) | |
parent | 30265117ee1e23fa91920f337a3ea91207f700dc (diff) | |
download | linux-7691283d0561a350b7517be94818669fb5e3d910.tar.xz |
Merge branch 'xfs-misc-fixes-3-for-3.16' into for-next
Diffstat (limited to 'fs/xfs/xfs_bmap_util.c')
-rw-r--r-- | fs/xfs/xfs_bmap_util.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/fs/xfs/xfs_bmap_util.c b/fs/xfs/xfs_bmap_util.c index 057f671811d6..703b3ec1796c 100644 --- a/fs/xfs/xfs_bmap_util.c +++ b/fs/xfs/xfs_bmap_util.c @@ -258,14 +258,23 @@ xfs_bmapi_allocate_worker( struct xfs_bmalloca *args = container_of(work, struct xfs_bmalloca, work); unsigned long pflags; + unsigned long new_pflags = PF_FSTRANS; - /* we are in a transaction context here */ - current_set_flags_nested(&pflags, PF_FSTRANS); + /* + * we are in a transaction context here, but may also be doing work + * in kswapd context, and hence we may need to inherit that state + * temporarily to ensure that we don't block waiting for memory reclaim + * in any way. + */ + if (args->kswapd) + new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD; + + current_set_flags_nested(&pflags, new_pflags); args->result = __xfs_bmapi_allocate(args); complete(args->done); - current_restore_flags_nested(&pflags, PF_FSTRANS); + current_restore_flags_nested(&pflags, new_pflags); } /* @@ -284,6 +293,7 @@ xfs_bmapi_allocate( args->done = &done; + args->kswapd = current_is_kswapd(); INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); queue_work(xfs_alloc_wq, &args->work); wait_for_completion(&done); |