提交 b17cb364 编写于 作者: D Dave Chinner 提交者: Ben Myers

xfs: fix missing KM_NOFS tags to keep lockdep happy

There are several places where we use KM_SLEEP allocation contexts
and use the fact that they are called from transaction context to
add KM_NOFS where appropriate. Unfortunately, there are several
places where the code makes this assumption but can be called from
outside transaction context but with filesystem locks held. These
places need explicit KM_NOFS annotations to avoid lockdep
complaining about reclaim contexts.
Signed-off-by: NDave Chinner <dchinner@redhat.com>
Reviewed-by: NBen Myers <bpm@sgi.com>
Signed-off-by: NBen Myers <bpm@sgi.com>

(cherry picked from commit ac14876c)
上级 509e708a
...@@ -1649,7 +1649,7 @@ xfs_alloc_buftarg( ...@@ -1649,7 +1649,7 @@ xfs_alloc_buftarg(
{ {
xfs_buftarg_t *btp; xfs_buftarg_t *btp;
btp = kmem_zalloc(sizeof(*btp), KM_SLEEP); btp = kmem_zalloc(sizeof(*btp), KM_SLEEP | KM_NOFS);
btp->bt_mount = mp; btp->bt_mount = mp;
btp->bt_dev = bdev->bd_dev; btp->bt_dev = bdev->bd_dev;
......
...@@ -2464,7 +2464,8 @@ xfs_buf_map_from_irec( ...@@ -2464,7 +2464,8 @@ xfs_buf_map_from_irec(
ASSERT(nirecs >= 1); ASSERT(nirecs >= 1);
if (nirecs > 1) { if (nirecs > 1) {
map = kmem_zalloc(nirecs * sizeof(struct xfs_buf_map), KM_SLEEP); map = kmem_zalloc(nirecs * sizeof(struct xfs_buf_map),
KM_SLEEP | KM_NOFS);
if (!map) if (!map)
return ENOMEM; return ENOMEM;
*mapp = map; *mapp = map;
...@@ -2520,7 +2521,8 @@ xfs_dabuf_map( ...@@ -2520,7 +2521,8 @@ xfs_dabuf_map(
* Optimize the one-block case. * Optimize the one-block case.
*/ */
if (nfsb != 1) if (nfsb != 1)
irecs = kmem_zalloc(sizeof(irec) * nfsb, KM_SLEEP); irecs = kmem_zalloc(sizeof(irec) * nfsb,
KM_SLEEP | KM_NOFS);
nirecs = nfsb; nirecs = nfsb;
error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, irecs, error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, irecs,
......
...@@ -1336,7 +1336,7 @@ xfs_dir2_leaf_getdents( ...@@ -1336,7 +1336,7 @@ xfs_dir2_leaf_getdents(
mp->m_sb.sb_blocksize); mp->m_sb.sb_blocksize);
map_info = kmem_zalloc(offsetof(struct xfs_dir2_leaf_map_info, map) + map_info = kmem_zalloc(offsetof(struct xfs_dir2_leaf_map_info, map) +
(length * sizeof(struct xfs_bmbt_irec)), (length * sizeof(struct xfs_bmbt_irec)),
KM_SLEEP); KM_SLEEP | KM_NOFS);
map_info->map_size = length; map_info->map_size = length;
/* /*
......
...@@ -139,7 +139,7 @@ xlog_cil_prepare_log_vecs( ...@@ -139,7 +139,7 @@ xlog_cil_prepare_log_vecs(
new_lv = kmem_zalloc(sizeof(*new_lv) + new_lv = kmem_zalloc(sizeof(*new_lv) +
niovecs * sizeof(struct xfs_log_iovec), niovecs * sizeof(struct xfs_log_iovec),
KM_SLEEP); KM_SLEEP|KM_NOFS);
/* The allocated iovec region lies beyond the log vector. */ /* The allocated iovec region lies beyond the log vector. */
new_lv->lv_iovecp = (struct xfs_log_iovec *)&new_lv[1]; new_lv->lv_iovecp = (struct xfs_log_iovec *)&new_lv[1];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册