|
@@ -18,6 +18,7 @@
|
|
|
#include <linux/module.h>
|
|
|
#include <linux/init.h>
|
|
|
#include <linux/sched.h>
|
|
|
+#include <linux/sched/mm.h>
|
|
|
#include <linux/fs.h>
|
|
|
#include <linux/bio.h>
|
|
|
#include <linux/stat.h>
|
|
@@ -347,7 +348,7 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send,
|
|
|
struct socket *sock = config->socks[index]->sock;
|
|
|
int result;
|
|
|
struct msghdr msg;
|
|
|
- unsigned long pflags = current->flags;
|
|
|
+ unsigned int noreclaim_flag;
|
|
|
|
|
|
if (unlikely(!sock)) {
|
|
|
dev_err_ratelimited(disk_to_dev(nbd->disk),
|
|
@@ -358,7 +359,7 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send,
|
|
|
|
|
|
msg.msg_iter = *iter;
|
|
|
|
|
|
- current->flags |= PF_MEMALLOC;
|
|
|
+ noreclaim_flag = memalloc_noreclaim_save();
|
|
|
do {
|
|
|
sock->sk->sk_allocation = GFP_NOIO | __GFP_MEMALLOC;
|
|
|
msg.msg_name = NULL;
|
|
@@ -381,7 +382,7 @@ static int sock_xmit(struct nbd_device *nbd, int index, int send,
|
|
|
*sent += result;
|
|
|
} while (msg_data_left(&msg));
|
|
|
|
|
|
- current_restore_flags(pflags, PF_MEMALLOC);
|
|
|
+ memalloc_noreclaim_restore(noreclaim_flag);
|
|
|
|
|
|
return result;
|
|
|
}
|