From: Carlos Maiolino <cmaiolino@redhat.com>
To: Christoph Hellwig <hch@lst.de>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH] xfs: fix IOCB_NOWAIT handling in xfs_file_dio_aio_read
Date: Wed, 15 Jan 2020 15:33:01 +0100 [thread overview]
Message-ID: <20200115143301.4b5hap4fm6irjwto@orion> (raw)
In-Reply-To: <20200115134653.433559-1-hch@lst.de>
On Wed, Jan 15, 2020 at 02:46:53PM +0100, Christoph Hellwig wrote:
> Direct I/O reads can also be used with RWF_NOWAIT & co. Fix the inode
> locking in xfs_file_dio_aio_read to take IOCB_NOWAIT into account.
>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>
> Resending standalone to get a little more attention.
>
> fs/xfs/xfs_file.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c
> index c93250108952..b8a4a3f29b36 100644
> --- a/fs/xfs/xfs_file.c
> +++ b/fs/xfs/xfs_file.c
> @@ -187,7 +187,12 @@ xfs_file_dio_aio_read(
>
> file_accessed(iocb->ki_filp);
>
> - xfs_ilock(ip, XFS_IOLOCK_SHARED);
> + if (iocb->ki_flags & IOCB_NOWAIT) {
> + if (!xfs_ilock_nowait(ip, XFS_IOLOCK_SHARED))
> + return -EAGAIN;
> + } else {
> + xfs_ilock(ip, XFS_IOLOCK_SHARED);
> + }
> ret = iomap_dio_rw(iocb, to, &xfs_read_iomap_ops, NULL,
> is_sync_kiocb(iocb));
> xfs_iunlock(ip, XFS_IOLOCK_SHARED);
>
Looks good to me.
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
--
Carlos
next prev parent reply other threads:[~2020-01-15 14:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-15 13:46 [PATCH] xfs: fix IOCB_NOWAIT handling in xfs_file_dio_aio_read Christoph Hellwig
2020-01-15 14:33 ` Carlos Maiolino [this message]
2020-01-15 17:12 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200115143301.4b5hap4fm6irjwto@orion \
--to=cmaiolino@redhat.com \
--cc=hch@lst.de \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox