]> granicus.if.org Git - zfs/commitdiff
Fix GFP_KERNEL allocations flags
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Jan 2015 17:21:51 +0000 (09:21 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 21 Jan 2015 23:25:19 +0000 (15:25 -0800)
The kmem_vasprintf(), kmem_vsprintf(), kobj_open_file(), and vn_openat()
functions should all use the kmem_flags_convert() function to generate
the GFP_* flags.  This ensures that they can be safely called in any
context and the correct flags will be used.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #426

module/spl/spl-kmem.c
module/spl/spl-kobj.c
module/spl/spl-vnode.c

index 914f0fbf7d2fd88ffad1882b44fdbb5ed360ed15..e97d5f25559de615f65d15da14fb075ffc45f356 100644 (file)
@@ -80,7 +80,7 @@ kmem_vasprintf(const char *fmt, va_list ap)
 
        do {
                va_copy(aq, ap);
-               ptr = kvasprintf(GFP_KERNEL, fmt, aq);
+               ptr = kvasprintf(kmem_flags_convert(KM_SLEEP), fmt, aq);
                va_end(aq);
        } while (ptr == NULL);
 
@@ -96,7 +96,7 @@ kmem_asprintf(const char *fmt, ...)
 
        do {
                va_start(ap, fmt);
-               ptr = kvasprintf(GFP_KERNEL, fmt, ap);
+               ptr = kvasprintf(kmem_flags_convert(KM_SLEEP), fmt, ap);
                va_end(ap);
        } while (ptr == NULL);
 
index 5b29fdb58bee9c96ca7aec6efb1a88bc8c6629cd..4dd14ba41760e123a82dda7241c5e878122bd83b 100644 (file)
@@ -33,7 +33,7 @@ kobj_open_file(const char *name)
        vnode_t *vp;
        int rc;
 
-       file = kmalloc(sizeof(_buf_t), GFP_KERNEL);
+       file = kmalloc(sizeof(_buf_t), kmem_flags_convert(KM_SLEEP));
        if (file == NULL)
                return ((_buf_t *)-1UL);
 
index 97eb4ef731ed253fb6fcf70ccc96698c35b8f893..bce28a580b408ccf721d20faa5a757988f6f0d5f 100644 (file)
@@ -196,7 +196,7 @@ vn_openat(const char *path, uio_seg_t seg, int flags, int mode,
        ASSERT(vp == rootdir);
 
        len = strlen(path) + 2;
-       realpath = kmalloc(len, GFP_KERNEL);
+       realpath = kmalloc(len, kmem_flags_convert(KM_SLEEP));
        if (!realpath)
                return (ENOMEM);