[PATCH v5 1/4] kernfs: add a WARN_ON_ONCE if ->close is set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The next patch is going to remove .page_mkwrite from kernfs and will
WARN if an mmap implementation sets .page_mkwrite.

In preparation for that change, and to make it consistent, add a WARN to
the ->close check.

Co-developed-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Signed-off-by: Logan Gunthorpe <logang@xxxxxxxxxxxx>
Signed-off-by: Martin Oliveira <martin.oliveira@xxxxxxxxxxxxx>
---
 fs/kernfs/file.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index 8502ef68459b..72cc51dcf870 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -479,7 +479,7 @@ static int kernfs_fop_mmap(struct file *file, struct vm_area_struct *vma)
 	 * 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)
+	if (WARN_ON_ONCE(vma->vm_ops && vma->vm_ops->close))
 		goto out_put;
 
 	rc = 0;
-- 
2.43.0





[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux