aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_bmap_util.c
diff options
context:
space:
mode:
authorDave Chinner <david@fromorbit.com>2014-06-09 17:32:56 -0400
committerDave Chinner <david@fromorbit.com>2014-06-09 17:32:56 -0400
commit7691283d0561a350b7517be94818669fb5e3d910 (patch)
tree3b939ee86e763c22c6ead988bf62de58e1981915 /fs/xfs/xfs_bmap_util.c
parent8612c7e594808e4a67bc2d4661f5925df2be3f51 (diff)
parent30265117ee1e23fa91920f337a3ea91207f700dc (diff)
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.c16
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(
258 struct xfs_bmalloca *args = container_of(work, 258 struct xfs_bmalloca *args = container_of(work,
259 struct xfs_bmalloca, work); 259 struct xfs_bmalloca, work);
260 unsigned long pflags; 260 unsigned long pflags;
261 unsigned long new_pflags = PF_FSTRANS;
261 262
262 /* we are in a transaction context here */ 263 /*
263 current_set_flags_nested(&pflags, PF_FSTRANS); 264 * we are in a transaction context here, but may also be doing work
265 * in kswapd context, and hence we may need to inherit that state
266 * temporarily to ensure that we don't block waiting for memory reclaim
267 * in any way.
268 */
269 if (args->kswapd)
270 new_pflags |= PF_MEMALLOC | PF_SWAPWRITE | PF_KSWAPD;
271
272 current_set_flags_nested(&pflags, new_pflags);
264 273
265 args->result = __xfs_bmapi_allocate(args); 274 args->result = __xfs_bmapi_allocate(args);
266 complete(args->done); 275 complete(args->done);
267 276
268 current_restore_flags_nested(&pflags, PF_FSTRANS); 277 current_restore_flags_nested(&pflags, new_pflags);
269} 278}
270 279
271/* 280/*
@@ -284,6 +293,7 @@ xfs_bmapi_allocate(
284 293
285 294
286 args->done = &done; 295 args->done = &done;
296 args->kswapd = current_is_kswapd();
287 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker); 297 INIT_WORK_ONSTACK(&args->work, xfs_bmapi_allocate_worker);
288 queue_work(xfs_alloc_wq, &args->work); 298 queue_work(xfs_alloc_wq, &args->work);
289 wait_for_completion(&done); 299 wait_for_completion(&done);