]> git.proxmox.com Git - mirror_spl.git/commitdiff
Turn on both PF_FSTRANS and PF_MEMALLOC_NOIO in spl_fstrans_mark
authorChunwei Chen <david.chen@osnexus.com>
Mon, 18 Jan 2016 22:41:45 +0000 (14:41 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 20 Jan 2016 19:38:31 +0000 (11:38 -0800)
In b4ad50a, we abandoned memalloc_noio_save in favor of spl_fstrans_mark
because earlier kernel with it doesn't turn off __GFP_FS. However, for newer
kernel, we would prefer PF_MEMALLOC_NOIO because it would work for allocation
in kernel which we cannot control otherwise. So in this patch, we turn on both
PF_FSTRANS and PF_MEMALLOC_NOIO in spl_fstrans_mark.

Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #523

include/sys/kmem.h

index 8d5e729373fa265a14f393280df89d2aecbed9b3..d4b3bf680a454528ec9514258b6d4e193582eaf7 100644 (file)
@@ -78,14 +78,20 @@ typedef struct {
        unsigned int saved_flags;
 } fstrans_cookie_t;
 
+#ifdef PF_MEMALLOC_NOIO
+#define        SPL_FSTRANS (PF_FSTRANS|PF_MEMALLOC_NOIO)
+#else
+#define        SPL_FSTRANS (PF_FSTRANS)
+#endif
+
 static inline fstrans_cookie_t
 spl_fstrans_mark(void)
 {
        fstrans_cookie_t cookie;
 
        cookie.fstrans_thread = current;
-       cookie.saved_flags = current->flags & PF_FSTRANS;
-       current->flags |= PF_FSTRANS;
+       cookie.saved_flags = current->flags & SPL_FSTRANS;
+       current->flags |= SPL_FSTRANS;
 
        return (cookie);
 }
@@ -94,9 +100,9 @@ static inline void
 spl_fstrans_unmark(fstrans_cookie_t cookie)
 {
        ASSERT3P(cookie.fstrans_thread, ==, current);
-       ASSERT(current->flags & PF_FSTRANS);
+       ASSERT((current->flags & SPL_FSTRANS) == SPL_FSTRANS);
 
-       current->flags &= ~(PF_FSTRANS);
+       current->flags &= ~SPL_FSTRANS;
        current->flags |= cookie.saved_flags;
 }