lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Wed, 7 Apr 2021 12:29:13 +0000
From:   "ruansy.fnst@...itsu.com" <ruansy.fnst@...itsu.com>
To:     Matthew Wilcox <willy@...radead.org>
CC:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-xfs@...r.kernel.org" <linux-xfs@...r.kernel.org>,
        "linux-nvdimm@...ts.01.org" <linux-nvdimm@...ts.01.org>,
        "linux-fsdevel@...r.kernel.org" <linux-fsdevel@...r.kernel.org>,
        "darrick.wong@...cle.com" <darrick.wong@...cle.com>,
        "dan.j.williams@...el.com" <dan.j.williams@...el.com>,
        "jack@...e.cz" <jack@...e.cz>,
        "viro@...iv.linux.org.uk" <viro@...iv.linux.org.uk>,
        "linux-btrfs@...r.kernel.org" <linux-btrfs@...r.kernel.org>,
        "david@...morbit.com" <david@...morbit.com>,
        "hch@....de" <hch@....de>, "rgoldwyn@...e.de" <rgoldwyn@...e.de>,
        Ritesh Harjani <riteshh@...il.com>
Subject: RE: [PATCH 1/3] fsdax: Factor helpers to simplify dax fault code



> -----Original Message-----
> From: Matthew Wilcox <willy@...radead.org>
> Sent: Wednesday, April 7, 2021 7:14 PM
> To: Ruan, Shiyang/阮 世阳 <ruansy.fnst@...itsu.com>
> Cc: linux-kernel@...r.kernel.org; linux-xfs@...r.kernel.org;
> linux-nvdimm@...ts.01.org; linux-fsdevel@...r.kernel.org;
> darrick.wong@...cle.com; dan.j.williams@...el.com; jack@...e.cz;
> viro@...iv.linux.org.uk; linux-btrfs@...r.kernel.org; david@...morbit.com;
> hch@....de; rgoldwyn@...e.de; Ritesh Harjani <riteshh@...il.com>
> Subject: Re: [PATCH 1/3] fsdax: Factor helpers to simplify dax fault code
> 
> On Wed, Apr 07, 2021 at 02:32:05PM +0800, Shiyang Ruan wrote:
> > +static int dax_fault_cow_page(struct vm_fault *vmf, struct iomap *iomap,
> > +		loff_t pos, vm_fault_t *ret)
> > +{
> > +	int error = 0;
> > +	unsigned long vaddr = vmf->address;
> > +	sector_t sector = dax_iomap_sector(iomap, pos);
> > +
> > +	switch (iomap->type) {
> > +	case IOMAP_HOLE:
> > +	case IOMAP_UNWRITTEN:
> > +		clear_user_highpage(vmf->cow_page, vaddr);
> > +		break;
> > +	case IOMAP_MAPPED:
> > +		error = copy_cow_page_dax(iomap->bdev, iomap->dax_dev,
> > +						sector, vmf->cow_page, vaddr);
> > +		break;
> > +	default:
> > +		WARN_ON_ONCE(1);
> > +		error = -EIO;
> > +		break;
> > +	}
> > +
> > +	if (error)
> > +		return error;
> > +
> > +	__SetPageUptodate(vmf->cow_page);
> > +	*ret = finish_fault(vmf);
> > +	if (!*ret)
> > +		*ret = VM_FAULT_DONE_COW;
> > +	return 0;
> > +}
> ...
> 
> > +		error = dax_fault_cow_page(vmf, &iomap, pos, &ret);
> >  		if (error)
> > +			ret = dax_fault_return(error);
> >  		goto finish_iomap;
> 
> This seems unnecessarily complex.  Why not return the vm_fault_t instead of
> returning the errno and then converting it?

Yes, I'll fix it.


--
Thanks,
Ruan Shiyang.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ