Re: [PATCH v4 1/3] kernfs: remove page_mkwrite() from vm_operations_struct

From: Matthew Wilcox
Date: Tue Jul 09 2024 - 10:37:16 EST


On Mon, Jul 08, 2024 at 10:57:12AM -0600, Martin Oliveira wrote:
> - /*
> - * It is not possible to successfully wrap close.
> - * So error if someone is trying to use close.
> - */
> - if (vma->vm_ops && vma->vm_ops->close)
> - goto out_put;
> + if (vma->vm_ops) {
> + /*
> + * It is not possible to successfully wrap close.
> + * So error if someone is trying to use close.
> + */
> + if (vma->vm_ops->close)
> + goto out_put;
> +
> + if (WARN_ON_ONCE(vma->vm_ops->page_mkwrite))
> + goto out_put;
> + }

This is stupid. Warn for both or neither.