--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
I once posted a similar patch for this issue which can be found at:
http://www.spinics.net/lists/linux-btrfs/msg12169.html
with an additional improvement if the offset is larger or equal to the
file size, return -ENXIO in directly:
if (offset >= inode->i_size) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
Thanks,
-Jeff
On 09/16/2011 11:48 PM, Christoph Hellwig wrote:
On Thu, Sep 15, 2011 at 04:06:47PM -0700, Andi Kleen wrote:
quoted
From: Andi Kleen <redacted>
Introduced by 9a4327ca1f45f82edad7dc0a4e52ce9316e0950c
I think this should go to Chris/Linus ASAP. But a slightly better
patch description wouldn't hurt either.
Also any reason you captialize BTRFS?
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
From: Andreas Dilger <hidden> Date: 2011-09-17 23:03:04
On 2011-09-17, at 12:10 AM, Jeff Liu [off-list ref] wrote:
I once posted a similar patch for this issue which can be found at:
http://www.spinics.net/lists/linux-btrfs/msg12169.html
with an additional improvement if the offset is larger or equal to the
file size, return -ENXIO in directly:
if (offset >= inode->i_size) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
Except that is wrong, because it would then be impossible to write sparse files.
Thanks,
-Jeff
On 09/16/2011 11:48 PM, Christoph Hellwig wrote:
quoted
On Thu, Sep 15, 2011 at 04:06:47PM -0700, Andi Kleen wrote:
quoted
From: Andi Kleen <redacted>
Introduced by 9a4327ca1f45f82edad7dc0a4e52ce9316e0950c
I think this should go to Chris/Linus ASAP. But a slightly better
patch description wouldn't hurt either.
Also any reason you captialize BTRFS?
out:
mutex_unlock(&inode->i_mutex);
return offset;
+error:
+ mutex_unlock(&inode->i_mutex);
+ return ret;
}
const struct file_operations btrfs_file_operations = {
--
1.7.4.4
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
---end quoted text---
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
with an additional improvement if the offset is larger or equal to the
file size, return -ENXIO in directly:
if (offset >= inode->i_size) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
Except that is wrong, because it would then be impossible to write sparse files.
And also i_size must be always read with i_size_read()
Anyways clearly there's a problem in btrfs land with merging fixes in time.
Is anyone collecting patches while Chris is gone?
-Andi
Hi Andreas and Andi,
Thanks for your comments.
On 09/18/2011 09:46 AM, Andi Kleen wrote:
quoted
quoted
with an additional improvement if the offset is larger or equal to the
file size, return -ENXIO in directly:
if (offset >= inode->i_size) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
Except that is wrong, because it would then be impossible to write sparse files.
Per my tryout, except that, if the offset >= source file size, call
lseek(fd, offset, SEEK_DATA/SEEK_HOLE) against Btrfs will always return
the total file size rather than -ENXIO. however, our desired result it
-ENXIO in this case, Am I right?
And also i_size must be always read with i_size_read()
Thanks for pointing this out!
Would you please kindly review the revised as below?
Signed-off-by: Jie Liu <redacted>
---
fs/btrfs/file.c | 9 +++++++--
1 files changed, 7 insertions(+), 2 deletions(-)
From: Marco Stornelli <hidden> Date: 2011-09-18 08:42:37
Il 18/09/2011 09:29, Jeff Liu ha scritto:
Hi Andreas and Andi,
Thanks for your comments.
On 09/18/2011 09:46 AM, Andi Kleen wrote:
quoted
quoted
quoted
with an additional improvement if the offset is larger or equal to the
file size, return -ENXIO in directly:
if (offset>= inode->i_size) {
mutex_unlock(&inode->i_mutex);
return -ENXIO;
}
Except that is wrong, because it would then be impossible to write sparse files.
Per my tryout, except that, if the offset>= source file size, call
lseek(fd, offset, SEEK_DATA/SEEK_HOLE) against Btrfs will always return
the total file size rather than -ENXIO. however, our desired result it
-ENXIO in this case, Am I right?
From: Chris Mason <hidden> Date: 2011-09-19 19:30:27
Excerpts from Andi Kleen's message of 2011-09-19 13:52:03 -0400:
quoted
Thanks everyone, I've put Jeff's last version of this in my queue.
Can you post the version you merged? The previous ones all had issues.
https://github.com/chrismason/linux/commit/48802c8ae2a9d618ec734a61283d645ad527e06c
This was the last one sent, I thought it combined all the fixes.
commit 48802c8ae2a9d618ec734a61283d645ad527e06c
Author: Jeff Liu [off-list ref]
Date: Sun Sep 18 10:34:02 2011 -0400
BTRFS: Fix lseek return value for error
The recent reworking of btrfs' lseek lead to incorrect
values being returned. This adds checks for seeking
beyond EOF in SEEK_HOLE and makes sure the error
values come back correct.
Andi Kleen also sent in similar patches.
Signed-off-by: Jie Liu [off-list ref]
Reported-by: Andi Kleen [off-list ref]
Signed-off-by: Chris Mason [off-list ref]