xprtrdma: Ensure creating an MR does not trigger FS writeback
authorChuck Lever <chuck.lever@oracle.com>
Mon, 19 Aug 2019 22:46:24 +0000 (18:46 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Tue, 20 Aug 2019 20:35:30 +0000 (16:35 -0400)
Probably would be good to also pass GFP flags to ib_alloc_mr.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xprtrdma/frwr_ops.c
net/sunrpc/xprtrdma/verbs.c

index 362056f..1f2e3dd 100644 (file)
@@ -147,11 +147,14 @@ int frwr_init_mr(struct rpcrdma_ia *ia, struct rpcrdma_mr *mr)
        struct ib_mr *frmr;
        int rc;
 
+       /* NB: ib_alloc_mr and device drivers typically allocate
+        *     memory with GFP_KERNEL.
+        */
        frmr = ib_alloc_mr(ia->ri_pd, ia->ri_mrtype, depth);
        if (IS_ERR(frmr))
                goto out_mr_err;
 
-       sg = kcalloc(depth, sizeof(*sg), GFP_KERNEL);
+       sg = kcalloc(depth, sizeof(*sg), GFP_NOFS);
        if (!sg)
                goto out_list_err;
 
@@ -171,8 +174,6 @@ out_mr_err:
        return rc;
 
 out_list_err:
-       dprintk("RPC:       %s: sg allocation failure\n",
-               __func__);
        ib_dereg_mr(frmr);
        return -ENOMEM;
 }
index c9fa0f2..cb6df58 100644 (file)
@@ -949,7 +949,7 @@ rpcrdma_mrs_create(struct rpcrdma_xprt *r_xprt)
                struct rpcrdma_mr *mr;
                int rc;
 
-               mr = kzalloc(sizeof(*mr), GFP_KERNEL);
+               mr = kzalloc(sizeof(*mr), GFP_NOFS);
                if (!mr)
                        break;