diff options
-rw-r--r-- | fs/udf/namei.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/udf/namei.c b/fs/udf/namei.c index 26815a25379..a2974f7563a 100644 --- a/fs/udf/namei.c +++ b/fs/udf/namei.c | |||
@@ -471,15 +471,19 @@ add: | |||
471 | f_pos >> dir->i_sb->s_blocksize_bits, 1, err); | 471 | f_pos >> dir->i_sb->s_blocksize_bits, 1, err); |
472 | if (!fibh->ebh) | 472 | if (!fibh->ebh) |
473 | goto out_err; | 473 | goto out_err; |
474 | /* Extents could have been merged, invalidate our position */ | ||
475 | brelse(epos.bh); | ||
476 | epos.bh = NULL; | ||
477 | epos.block = dinfo->i_location; | ||
478 | epos.offset = udf_file_entry_alloc_offset(dir); | ||
474 | 479 | ||
475 | if (!fibh->soffset) { | 480 | if (!fibh->soffset) { |
476 | if (udf_next_aext(dir, &epos, &eloc, &elen, 1) == | 481 | /* Find the freshly allocated block */ |
477 | (EXT_RECORDED_ALLOCATED >> 30)) { | 482 | while (udf_next_aext(dir, &epos, &eloc, &elen, 1) == |
478 | block = eloc.logicalBlockNum + ((elen - 1) >> | 483 | (EXT_RECORDED_ALLOCATED >> 30)) |
484 | ; | ||
485 | block = eloc.logicalBlockNum + ((elen - 1) >> | ||
479 | dir->i_sb->s_blocksize_bits); | 486 | dir->i_sb->s_blocksize_bits); |
480 | } else | ||
481 | block++; | ||
482 | |||
483 | brelse(fibh->sbh); | 487 | brelse(fibh->sbh); |
484 | fibh->sbh = fibh->ebh; | 488 | fibh->sbh = fibh->ebh; |
485 | fi = (struct fileIdentDesc *)(fibh->sbh->b_data); | 489 | fi = (struct fileIdentDesc *)(fibh->sbh->b_data); |