* [PATCH v2] dax: check return value of dax_radix_entry()
@ 2016-03-02 17:00 Ross Zwisler
2016-03-03 3:49 ` Dave Chinner
0 siblings, 1 reply; 3+ messages in thread
From: Ross Zwisler @ 2016-03-02 17:00 UTC (permalink / raw)
To: linux-kernel
Cc: Ross Zwisler, Andrew Morton, Dan Williams, Matthew Wilcox,
linux-nvdimm
dax_pfn_mkwrite() previously wasn't checking the return value of the call
to dax_radix_entry(), which was a mistake.
Instead, capture this return value and return the appropriate VM_FAULT_
value.
Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
---
fs/dax.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/fs/dax.c b/fs/dax.c
index 7111724..bbb2ad7 100644
--- a/fs/dax.c
+++ b/fs/dax.c
@@ -1056,6 +1056,7 @@ EXPORT_SYMBOL_GPL(dax_pmd_fault);
int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
{
struct file *file = vma->vm_file;
+ int error;
/*
* We pass NO_SECTOR to dax_radix_entry() because we expect that a
@@ -1065,7 +1066,13 @@ int dax_pfn_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
* saves us from having to make a call to get_block() here to look
* up the sector.
*/
- dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false, true);
+ error = dax_radix_entry(file->f_mapping, vmf->pgoff, NO_SECTOR, false,
+ true);
+
+ if (error == -ENOMEM)
+ return VM_FAULT_OOM;
+ if (error)
+ return VM_FAULT_SIGBUS;
return VM_FAULT_NOPAGE;
}
EXPORT_SYMBOL_GPL(dax_pfn_mkwrite);
--
2.5.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH v2] dax: check return value of dax_radix_entry()
2016-03-02 17:00 [PATCH v2] dax: check return value of dax_radix_entry() Ross Zwisler
@ 2016-03-03 3:49 ` Dave Chinner
2016-03-03 15:38 ` Ross Zwisler
0 siblings, 1 reply; 3+ messages in thread
From: Dave Chinner @ 2016-03-03 3:49 UTC (permalink / raw)
To: Ross Zwisler
Cc: linux-kernel, Andrew Morton, Dan Williams, Matthew Wilcox,
linux-nvdimm
On Wed, Mar 02, 2016 at 10:00:51AM -0700, Ross Zwisler wrote:
> dax_pfn_mkwrite() previously wasn't checking the return value of the call
> to dax_radix_entry(), which was a mistake.
>
> Instead, capture this return value and return the appropriate VM_FAULT_
> value.
>
> Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
Hi Ross,
Can you please cc dax stuff to linux-fsdevel? it is way too easy to
miss stuff like this when lkml is the only list it's sent to?
That said, the change looks good.
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] dax: check return value of dax_radix_entry()
2016-03-03 3:49 ` Dave Chinner
@ 2016-03-03 15:38 ` Ross Zwisler
0 siblings, 0 replies; 3+ messages in thread
From: Ross Zwisler @ 2016-03-03 15:38 UTC (permalink / raw)
To: Dave Chinner
Cc: Ross Zwisler, linux-kernel, Andrew Morton, Dan Williams,
Matthew Wilcox, linux-nvdimm
On Thu, Mar 03, 2016 at 02:49:11PM +1100, Dave Chinner wrote:
> On Wed, Mar 02, 2016 at 10:00:51AM -0700, Ross Zwisler wrote:
> > dax_pfn_mkwrite() previously wasn't checking the return value of the call
> > to dax_radix_entry(), which was a mistake.
> >
> > Instead, capture this return value and return the appropriate VM_FAULT_
> > value.
> >
> > Signed-off-by: Ross Zwisler <ross.zwisler@linux.intel.com>
>
> Hi Ross,
>
> Can you please cc dax stuff to linux-fsdevel? it is way too easy to
> miss stuff like this when lkml is the only list it's sent to?
Sure, will do.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-03-03 15:39 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-02 17:00 [PATCH v2] dax: check return value of dax_radix_entry() Ross Zwisler
2016-03-03 3:49 ` Dave Chinner
2016-03-03 15:38 ` Ross Zwisler
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox