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] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 6 Apr 2017 15:54:15 -0700
From:   "Darrick J. Wong" <darrick.wong@...cle.com>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     Goldwyn Rodrigues <rgoldwyn@...e.de>,
        linux-fsdevel@...r.kernel.org, jack@...e.com,
        linux-block@...r.kernel.org, linux-btrfs@...r.kernel.org,
        linux-ext4@...r.kernel.org, linux-xfs@...r.kernel.org,
        sagi@...mberg.me, avi@...lladb.com, axboe@...nel.dk,
        linux-api@...r.kernel.org, willy@...radead.org,
        tom.leiming@...il.com, Goldwyn Rodrigues <rgoldwyn@...e.com>
Subject: Re: [PATCH 7/8] nowait aio: xfs

On Mon, Apr 03, 2017 at 11:52:11PM -0700, Christoph Hellwig wrote:
> > +	if (unaligned_io) {
> > +		/* If we are going to wait for other DIO to finish, bail */
> > +		if ((iocb->ki_flags & IOCB_NOWAIT) &&
> > +		     atomic_read(&inode->i_dio_count))
> > +			return -EAGAIN;
> >  		inode_dio_wait(inode);
> 
> This checks i_dio_count twice in the nowait case, I think it should be:
> 
> 	if (iocb->ki_flags & IOCB_NOWAIT) {
> 		if (atomic_read(&inode->i_dio_count))
> 			return -EAGAIN;
> 	} else {
> 		inode_dio_wait(inode);
> 	}
> 
> >  	if ((flags & (IOMAP_WRITE | IOMAP_ZERO)) && xfs_is_reflink_inode(ip)) {
> >  		if (flags & IOMAP_DIRECT) {
> > +			/* A reflinked inode will result in CoW alloc */
> > +			if (flags & IOMAP_NOWAIT) {
> > +				error = -EAGAIN;
> > +				goto out_unlock;
> > +			}
> 
> This is a bit pessimistic - just because the inode has any shared
> extents we could still write into unshared ones.  For now I think this
> pessimistic check is fine, but the comment should be corrected.

Consider what happens in both _reflink_{allocate,reserve}_cow.  If there
is already an existing reservation in the CoW fork then we'll have to
CoW and therefore can't satisfy the NOWAIT flag.  If there isn't already
anything in the CoW fork, then we have to see if there are shared blocks
by calling _reflink_trim_around_shared.  That performs a refcountbt
lookup, which involves locking the AGF, so we also can't satisfy NOWAIT.

IOWs, I think this hunk has to move outside the IOMAP_DIRECT check to
cover both write-to-reflinked-file cases.

--D

> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ