summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/udf/inode.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/udf/inode.c b/fs/udf/inode.c
index 31946c51ed32..957c9747405d 100644
--- a/fs/udf/inode.c
+++ b/fs/udf/inode.c
@@ -575,6 +575,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
struct udf_inode_info *iinfo = UDF_I(inode);
int goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
int lastblock = 0;
+ bool isBeyondEOF;
prev_epos.offset = udf_file_entry_alloc_offset(inode);
prev_epos.block = iinfo->i_location;
@@ -653,7 +654,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
/* Are we beyond EOF? */
if (etype == -1) {
int ret;
-
+ isBeyondEOF = 1;
if (count) {
if (c)
laarr[0] = laarr[1];
@@ -696,6 +697,7 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
endnum = c + 1;
lastblock = 1;
} else {
+ isBeyondEOF = 0;
endnum = startnum = ((count > 2) ? 2 : count);
/* if the current extent is in position 0,
@@ -743,7 +745,8 @@ static struct buffer_head *inode_getblk(struct inode *inode, sector_t block,
*err = -ENOSPC;
return NULL;
}
- iinfo->i_lenExtents += inode->i_sb->s_blocksize;
+ if (isBeyondEOF)
+ iinfo->i_lenExtents += inode->i_sb->s_blocksize;
}
/* if the extent the requsted block is located in contains multiple