diff options
Diffstat (limited to 'fs/reiserfs')
-rw-r--r-- | fs/reiserfs/inode.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/fs/reiserfs/inode.c b/fs/reiserfs/inode.c index 0d5817f81972..289d864fe731 100644 --- a/fs/reiserfs/inode.c +++ b/fs/reiserfs/inode.c | |||
@@ -254,6 +254,7 @@ static int _get_block_create_0 (struct inode * inode, long block, | |||
254 | char * p = NULL; | 254 | char * p = NULL; |
255 | int chars; | 255 | int chars; |
256 | int ret ; | 256 | int ret ; |
257 | int result ; | ||
257 | int done = 0 ; | 258 | int done = 0 ; |
258 | unsigned long offset ; | 259 | unsigned long offset ; |
259 | 260 | ||
@@ -262,10 +263,13 @@ static int _get_block_create_0 (struct inode * inode, long block, | |||
262 | (loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3); | 263 | (loff_t)block * inode->i_sb->s_blocksize + 1, TYPE_ANY, 3); |
263 | 264 | ||
264 | research: | 265 | research: |
265 | if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) { | 266 | result = search_for_position_by_key (inode->i_sb, &key, &path) ; |
267 | if (result != POSITION_FOUND) { | ||
266 | pathrelse (&path); | 268 | pathrelse (&path); |
267 | if (p) | 269 | if (p) |
268 | kunmap(bh_result->b_page) ; | 270 | kunmap(bh_result->b_page) ; |
271 | if (result == IO_ERROR) | ||
272 | return -EIO; | ||
269 | // We do not return -ENOENT if there is a hole but page is uptodate, because it means | 273 | // We do not return -ENOENT if there is a hole but page is uptodate, because it means |
270 | // That there is some MMAPED data associated with it that is yet to be written to disk. | 274 | // That there is some MMAPED data associated with it that is yet to be written to disk. |
271 | if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) { | 275 | if ((args & GET_BLOCK_NO_HOLE) && !PageUptodate(bh_result->b_page) ) { |
@@ -382,8 +386,9 @@ research: | |||
382 | 386 | ||
383 | // update key to look for the next piece | 387 | // update key to look for the next piece |
384 | set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars); | 388 | set_cpu_key_k_offset (&key, cpu_key_k_offset (&key) + chars); |
385 | if (search_for_position_by_key (inode->i_sb, &key, &path) != POSITION_FOUND) | 389 | result = search_for_position_by_key (inode->i_sb, &key, &path); |
386 | // we read something from tail, even if now we got IO_ERROR | 390 | if (result != POSITION_FOUND) |
391 | // i/o error most likely | ||
387 | break; | 392 | break; |
388 | bh = get_last_bh (&path); | 393 | bh = get_last_bh (&path); |
389 | ih = get_ih (&path); | 394 | ih = get_ih (&path); |
@@ -394,6 +399,10 @@ research: | |||
394 | 399 | ||
395 | finished: | 400 | finished: |
396 | pathrelse (&path); | 401 | pathrelse (&path); |
402 | |||
403 | if (result == IO_ERROR) | ||
404 | return -EIO; | ||
405 | |||
397 | /* this buffer has valid data, but isn't valid for io. mapping it to | 406 | /* this buffer has valid data, but isn't valid for io. mapping it to |
398 | * block #0 tells the rest of reiserfs it just has a tail in it | 407 | * block #0 tells the rest of reiserfs it just has a tail in it |
399 | */ | 408 | */ |