linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Linda Knippers <linda.knippers@hp.com>
To: Jeff Moyer <jmoyer@redhat.com>, matthew.r.wilcox@intel.com
Cc: linux-fsdevel@vger.kernel.org, linux-nvdimm@ml01.01.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dax: fix O_DIRECT I/O to the last block of a blockdev
Date: Fri, 14 Aug 2015 16:53:25 -0400	[thread overview]
Message-ID: <55CE5545.7010304@hp.com> (raw)
In-Reply-To: <1439583332-13754-2-git-send-email-jmoyer@redhat.com>

On 8/14/2015 4:15 PM, Jeff Moyer wrote:
> commit bbab37ddc20b (block: Add support for DAX reads/writes to
> block devices) caused a regression in mkfs.xfs.  That utility
> sets the block size of the device to the logical block size
> using the BLKBSZSET ioctl, and then issues a single sector read
> from the last sector of the device.  This results in the dax_io
> code trying to do a page-sized read from 512 bytes from the end
> of the device.  The result is -ERANGE being returned to userspace.
> 
> The fix is to align the block to the page size before calling
> get_block.
> 
> Thanks to willy for simplifying my original patch.
> 
> Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

Tested-by:  Linda Knippers <linda.knippers@hp.com>

> ---
>  fs/dax.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/fs/dax.c b/fs/dax.c
> index a7f77e1..ef35a20 100644
> --- a/fs/dax.c
> +++ b/fs/dax.c
> @@ -116,7 +116,8 @@ static ssize_t dax_io(struct inode *inode, struct iov_iter *iter,
>  		unsigned len;
>  		if (pos == max) {
>  			unsigned blkbits = inode->i_blkbits;
> -			sector_t block = pos >> blkbits;
> +			long page = pos >> PAGE_SHIFT;
> +			sector_t block = page << (PAGE_SHIFT - blkbits);
>  			unsigned first = pos - (block << blkbits);
>  			long size;
>  
> 

  reply	other threads:[~2015-08-14 20:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-14 20:15 [PATCH 0/2] fix regression in direct I/O to pmem devices Jeff Moyer
2015-08-14 20:15 ` [PATCH 1/2] dax: fix O_DIRECT I/O to the last block of a blockdev Jeff Moyer
2015-08-14 20:53   ` Linda Knippers [this message]
2015-09-08 16:10     ` Linda Knippers
2015-09-08 16:23       ` Dan Williams
2015-08-14 20:15 ` [PATCH 2/2] blockdev: don't set S_DAX for misaligned partitions Jeff Moyer
2015-08-14 20:46   ` Andreas Dilger
2015-08-14 20:55     ` Jeff Moyer
2015-08-14 20:22 ` [PATCH 0/2] fix regression in direct I/O to pmem devices Dan Williams
2015-08-14 20:23   ` Dan Williams
2015-08-14 20:27     ` Jeff Moyer

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=55CE5545.7010304@hp.com \
    --to=linda.knippers@hp.com \
    --cc=jmoyer@redhat.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nvdimm@ml01.01.org \
    --cc=matthew.r.wilcox@intel.com \
    /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;
as well as URLs for NNTP newsgroup(s).