remove libdss from Makefile
[GitHub/moto-9609/android_kernel_motorola_exynos9610.git] / fs / btrfs / acl.c
index 1ba49ebe67da39f6daf0a9a6f0ff63fff8554935..1c42d9f1d6c8ca8b193dffb36edfdaae5c7c7cae 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/posix_acl_xattr.h>
 #include <linux/posix_acl.h>
 #include <linux/sched.h>
+#include <linux/sched/mm.h>
 #include <linux/slab.h>
 
 #include "ctree.h"
@@ -89,8 +90,16 @@ static int __btrfs_set_acl(struct btrfs_trans_handle *trans,
        }
 
        if (acl) {
+               unsigned int nofs_flag;
+
                size = posix_acl_xattr_size(acl->a_count);
+               /*
+                * We're holding a transaction handle, so use a NOFS memory
+                * allocation context to avoid deadlock if reclaim happens.
+                */
+               nofs_flag = memalloc_nofs_save();
                value = kmalloc(size, GFP_KERNEL);
+               memalloc_nofs_restore(nofs_flag);
                if (!value) {
                        ret = -ENOMEM;
                        goto out;