xfs: fix missing KM_NOFS tags to keep lockdep happy
authorDave Chinner <dchinner@redhat.com>
Sun, 19 May 2013 23:51:12 +0000 (09:51 +1000)
committerBen Myers <bpm@sgi.com>
Mon, 20 May 2013 21:18:05 +0000 (16:18 -0500)
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: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Ben Myers <bpm@sgi.com>
Signed-off-by: Ben Myers <bpm@sgi.com>
fs/xfs/xfs_buf.c
fs/xfs/xfs_da_btree.c
fs/xfs/xfs_dir2_leaf.c
fs/xfs/xfs_log_cil.c

index 82b70bda9f47a51eb3f31a50ae4fcd32f6c57047..0d255429968879f87496265e8ccb07e7f88c1de1 100644 (file)
@@ -1649,7 +1649,7 @@ xfs_alloc_buftarg(
 {
        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_dev =  bdev->bd_dev;
index 9b26a99ebfe917ed67123a77794751fc2b72cecd..41ea7e14a7b65bd144e541beb7fd1a67e8c12a3d 100644 (file)
@@ -2464,7 +2464,8 @@ xfs_buf_map_from_irec(
        ASSERT(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)
                        return ENOMEM;
                *mapp = map;
@@ -2520,7 +2521,8 @@ xfs_dabuf_map(
                 * Optimize the one-block case.
                 */
                if (nfsb != 1)
-                       irecs = kmem_zalloc(sizeof(irec) * nfsb, KM_SLEEP);
+                       irecs = kmem_zalloc(sizeof(irec) * nfsb,
+                                           KM_SLEEP | KM_NOFS);
 
                nirecs = nfsb;
                error = xfs_bmapi_read(dp, (xfs_fileoff_t)bno, nfsb, irecs,
index 721ba2fe8e54581aebf884e1cb31d2f02e1e2534..da71a1819d780cd35bd9817fd89deabd5feb3eb7 100644 (file)
@@ -1336,7 +1336,7 @@ xfs_dir2_leaf_getdents(
                                     mp->m_sb.sb_blocksize);
        map_info = kmem_zalloc(offsetof(struct xfs_dir2_leaf_map_info, map) +
                                (length * sizeof(struct xfs_bmbt_irec)),
-                              KM_SLEEP);
+                              KM_SLEEP | KM_NOFS);
        map_info->map_size = length;
 
        /*
index e3d0b85d852b6e2c3b07bc07482d2a7e357ccf90..d0833b54e55d63ed83eb61cedfd110cd4a1263b2 100644 (file)
@@ -139,7 +139,7 @@ xlog_cil_prepare_log_vecs(
 
                new_lv = kmem_zalloc(sizeof(*new_lv) +
                                niovecs * sizeof(struct xfs_log_iovec),
-                               KM_SLEEP);
+                               KM_SLEEP|KM_NOFS);
 
                /* The allocated iovec region lies beyond the log vector. */
                new_lv->lv_iovecp = (struct xfs_log_iovec *)&new_lv[1];