All of lore.kernel.org
 help / color / mirror / Atom feed
* Patch "dax: fix O_DIRECT I/O to the last block of a blockdev" has been added to the 4.2-stable tree
@ 2015-10-13 21:49 gregkh
  0 siblings, 0 replies; only message in thread
From: gregkh @ 2015-10-13 21:49 UTC (permalink / raw)
  To: jmoyer, dan.j.williams, gregkh, linda.knippers; +Cc: stable, stable-commits


This is a note to let you know that I've just added the patch titled

    dax: fix O_DIRECT I/O to the last block of a blockdev

to the 4.2-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     dax-fix-o_direct-i-o-to-the-last-block-of-a-blockdev.patch
and it can be found in the queue-4.2 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


>From e94f5a2285fc94202a9efb2c687481f29b64132c Mon Sep 17 00:00:00 2001
From: Jeff Moyer <jmoyer@redhat.com>
Date: Fri, 14 Aug 2015 16:15:31 -0400
Subject: dax: fix O_DIRECT I/O to the last block of a blockdev

From: Jeff Moyer <jmoyer@redhat.com>

commit e94f5a2285fc94202a9efb2c687481f29b64132c upstream.

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>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/dax.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/dax.c
+++ b/fs/dax.c
@@ -116,7 +116,8 @@ static ssize_t dax_io(struct inode *inod
 		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;
 


Patches currently in stable-queue which might be from jmoyer@redhat.com are

queue-4.2/blockdev-don-t-set-s_dax-for-misaligned-partitions.patch
queue-4.2/dax-fix-o_direct-i-o-to-the-last-block-of-a-blockdev.patch

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-10-13 21:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-13 21:49 Patch "dax: fix O_DIRECT I/O to the last block of a blockdev" has been added to the 4.2-stable tree gregkh

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.