mac80211: Fix MLO address translation for multiple bss case
[platform/kernel/linux-starfive.git] / mm / shmem.c
index c1d8b8a..a8d9fd0 100644 (file)
@@ -472,12 +472,10 @@ bool shmem_is_huge(struct vm_area_struct *vma, struct inode *inode,
        if (vma && ((vma->vm_flags & VM_NOHUGEPAGE) ||
            test_bit(MMF_DISABLE_THP, &vma->vm_mm->flags)))
                return false;
-       if (shmem_huge_force)
-               return true;
-       if (shmem_huge == SHMEM_HUGE_FORCE)
-               return true;
        if (shmem_huge == SHMEM_HUGE_DENY)
                return false;
+       if (shmem_huge_force || shmem_huge == SHMEM_HUGE_FORCE)
+               return true;
 
        switch (SHMEM_SB(inode->i_sb)->huge) {
        case SHMEM_HUGE_ALWAYS:
@@ -948,6 +946,15 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
                index++;
        }
 
+       /*
+        * When undoing a failed fallocate, we want none of the partial folio
+        * zeroing and splitting below, but shall want to truncate the whole
+        * folio when !uptodate indicates that it was added by this fallocate,
+        * even when [lstart, lend] covers only a part of the folio.
+        */
+       if (unfalloc)
+               goto whole_folios;
+
        same_folio = (lstart >> PAGE_SHIFT) == (lend >> PAGE_SHIFT);
        folio = shmem_get_partial_folio(inode, lstart >> PAGE_SHIFT);
        if (folio) {
@@ -973,6 +980,8 @@ static void shmem_undo_range(struct inode *inode, loff_t lstart, loff_t lend,
                folio_put(folio);
        }
 
+whole_folios:
+
        index = start;
        while (index < end) {
                cond_resched();