Skip to contentSkip to conversation

fs: ubifs: Adding new return type vm_fault_t

PATCH In review Souptick Joarder 3 participants 5 messages Apr 14, 2018 – Apr 15, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fs: ubifs: Adding new return type vm_fault_t

Use new return type vm_fault_t for page_mkwrite handler.

---
 fs/ubifs/file.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)
fs/ubifs/file.c +4 -7
index cf348ba..094ac73 100644
@@ -1513,7 +1513,7 @@ static int ubifs_releasepage(struct page *page, gfp_t unused_gfp_flags)
  * mmap()d file has taken write protection fault and is being made writable.
  * UBIFS must ensure page is budgeted for.
  */
-static int ubifs_vm_page_mkwrite(struct vm_fault *vmf)
+static vm_fault_t ubifs_vm_page_mkwrite(struct vm_fault *vmf)
 {
 	struct page *page = vmf->page;
 	struct inode *inode = file_inode(vmf->vma->vm_file);
@@ -1567,8 +1567,7 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf)
 	if (unlikely(page->mapping != inode->i_mapping ||
 		     page_offset(page) > i_size_read(inode))) {
 		/* Page got truncated out from underneath us */
-		err = -EINVAL;
-		goto out_unlock;
+		goto sigbus;
 	}
 
 	if (PagePrivate(page))
@@ -1597,12 +1596,10 @@ static int ubifs_vm_page_mkwrite(struct vm_fault *vmf)
 	wait_for_stable_page(page);
 	return VM_FAULT_LOCKED;
 
-out_unlock:
+sigbus:
 	unlock_page(page);
 	ubifs_release_budget(c, &req);
-	if (err)
-		err = VM_FAULT_SIGBUS;
-	return err;
+	return VM_FAULT_SIGBUS;
 }
 
 static const struct vm_operations_struct ubifs_file_vm_ops = {
Signature · 1 line
1.9.1
#2 lore raw
Quoted 8 lines · Richard Weinberger

Am Samstag, 14. April 2018, 22:18:59 CEST schrieb Souptick Joarder:

Quoted 4 lines

Use new return type vm_fault_t for page_mkwrite handler.

Can we please get a little more context?
Is this part of a patch series?

The plan for these patches is to introduce the typedef, initially just as documentation ("These functions should return a VM_FAULT_ status"). We'll trickle the patches to individual drivers/filesystems in through the maintainers, as far as possible. Then we'll change the typedef to an unsigned int and break the compilation of any unconverted drivers/filesystems.

The return value of page_mkwrite defined in vm_operations_struct has changed to vm_fault_t type. So this patch is part of patch series which will convert fault handlers for vm_operations_struct in each driver/file system.

The first patch is already merged into linus tree. Commit Id - 1c8f422059ae5da07db7406ab916203f9417e396

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/patch/?id=1c8f422059ae5da07db7406ab916203f9417e396

What is the target tree to carry this?

Target tree I am not sure.
We have plan to push it in 4.17 release.
I think Matthew is the right person to get this info.

#3 lore raw
Quoted 6 lines · Souptick Joarder
Quoted 1 line · Richard Weinberger

What is the target tree to carry this?

Target tree I am not sure.
We have plan to push it in 4.17 release.
I think Matthew is the right person to get this info.

Please merge it through your tree for 4.18. Or earlier if you want.

#4 lore raw

Am Sonntag, 15. April 2018, 03:24:00 CEST schrieb Matthew Wilcox:

Quoted 9 lines · Souptick Joarder
Quoted 6 lines · Richard Weinberger
Quoted 1 line

What is the target tree to carry this?

Target tree I am not sure.
We have plan to push it in 4.17 release.
I think Matthew is the right person to get this info.

Please merge it through your tree for 4.18. Or earlier if you want.

Ok. Queued for 4.18.

Thanks,
//richard