Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ceph: switch back to testing for NULL folio->private in ceph_dirty_folio

Willy requested that we change this back to warning on folio->private
being non-NULl. He's trying to kill off the PG_private flag, and so we'd
like to catch where it's non-NULL.

Add a VM_WARN_ON_FOLIO (since it doesn't exist yet) and change over to
using that instead of VM_BUG_ON_FOLIO along with testing the ->private
pointer.

[ xiubli: define VM_WARN_ON_FOLIO macro in case DEBUG_VM is disabled
reported by kernel test robot <lkp@intel.com> ]

Cc: Matthew Wilcox <willy@infradead.org>
Signed-off-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Xiubo Li <xiubli@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>

authored by

Jeff Layton and committed by
Ilya Dryomov
020bc44a 7467b044

+11 -1
+1 -1
fs/ceph/addr.c
··· 122 122 * Reference snap context in folio->private. Also set 123 123 * PagePrivate so that we get invalidate_folio callback. 124 124 */ 125 - VM_BUG_ON_FOLIO(folio_test_private(folio), folio); 125 + VM_WARN_ON_FOLIO(folio->private, folio); 126 126 folio_attach_private(folio, snapc); 127 127 128 128 return ceph_fscache_dirty_folio(mapping, folio);
+10
include/linux/mmdebug.h
··· 54 54 } \ 55 55 unlikely(__ret_warn_once); \ 56 56 }) 57 + #define VM_WARN_ON_FOLIO(cond, folio) ({ \ 58 + int __ret_warn = !!(cond); \ 59 + \ 60 + if (unlikely(__ret_warn)) { \ 61 + dump_page(&folio->page, "VM_WARN_ON_FOLIO(" __stringify(cond)")");\ 62 + WARN_ON(1); \ 63 + } \ 64 + unlikely(__ret_warn); \ 65 + }) 57 66 #define VM_WARN_ON_ONCE_FOLIO(cond, folio) ({ \ 58 67 static bool __section(".data.once") __warned; \ 59 68 int __ret_warn_once = !!(cond); \ ··· 88 79 #define VM_WARN_ON(cond) BUILD_BUG_ON_INVALID(cond) 89 80 #define VM_WARN_ON_ONCE(cond) BUILD_BUG_ON_INVALID(cond) 90 81 #define VM_WARN_ON_ONCE_PAGE(cond, page) BUILD_BUG_ON_INVALID(cond) 82 + #define VM_WARN_ON_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) 91 83 #define VM_WARN_ON_ONCE_FOLIO(cond, folio) BUILD_BUG_ON_INVALID(cond) 92 84 #define VM_WARN_ONCE(cond, format...) BUILD_BUG_ON_INVALID(cond) 93 85 #define VM_WARN(cond, format...) BUILD_BUG_ON_INVALID(cond)