Re: [PATCH] nfs:Fix error handling in the function nfs_vm_page_mkwrite

From: Trond Myklebust
Date: Mon Aug 24 2015 - 09:17:07 EST


On Sat, Aug 22, 2015 at 6:34 PM, Nicholas Krause <xerofoify@xxxxxxxxx> wrote:
> This fixes error handling in the function nfs_vm_page_mkwrite to
> properly check if the function wait_on_bit_action returned something
> other then zero as if so return to the caller of nfs_vm_page_mkwrite
> to signal that a internal failure has occurred when calling this
> function and should be handled by the caller.
>
> Signed-off-by: Nicholas Krause <xerofoify@xxxxxxxxx>
> ---
> fs/nfs/file.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/fs/nfs/file.c b/fs/nfs/file.c
> index cc4fa1e..698851a 100644
> --- a/fs/nfs/file.c
> +++ b/fs/nfs/file.c
> @@ -612,8 +612,10 @@ static int nfs_vm_page_mkwrite(struct vm_area_struct *vma, struct vm_fault *vmf)
> /* make sure the cache has finished storing the page */
> nfs_fscache_wait_on_page_write(NFS_I(inode), page);
>
> - wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
> - nfs_wait_bit_killable, TASK_KILLABLE);
> + ret = wait_on_bit_action(&NFS_I(inode)->flags, NFS_INO_INVALIDATING,
> + nfs_wait_bit_killable, TASK_KILLABLE);
> + if (ret)
> + goto out;
>
> lock_page(page);
> mapping = page_file_mapping(page);
> --
> 2.1.4
>

nfs_vm_page_mkwrite() is only allowed to return the value '0' or one
or more of the VM_FAULT_* flags. It may not return kernel error
values.

Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/