Skip to content

Commit 8ac91e6

Browse files
committed
Merge tag 'for-5.13-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fixes from David Sterba: "A few more fixes: - fix fiemap to print extents that could get misreported due to internal extent splitting and logical merging for fiemap output - fix RCU stalls during delayed iputs - fix removed dentries still existing after log is synced" * tag 'for-5.13-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: fix removed dentries still existing after log is synced btrfs: return whole extents in fiemap btrfs: avoid RCU stalls while running delayed iputs btrfs: return 0 for dev_extent_hole_check_zoned hole_start in case of error
2 parents d07f6ca + 54a40fc commit 8ac91e6

File tree

4 files changed

+26
-2
lines changed

4 files changed

+26
-2
lines changed

fs/btrfs/extent_io.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5196,7 +5196,7 @@ int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
51965196
u64 start, u64 len)
51975197
{
51985198
int ret = 0;
5199-
u64 off = start;
5199+
u64 off;
52005200
u64 max = start + len;
52015201
u32 flags = 0;
52025202
u32 found_type;
@@ -5231,6 +5231,11 @@ int extent_fiemap(struct btrfs_inode *inode, struct fiemap_extent_info *fieinfo,
52315231
goto out_free_ulist;
52325232
}
52335233

5234+
/*
5235+
* We can't initialize that to 'start' as this could miss extents due
5236+
* to extent item merging
5237+
*/
5238+
off = 0;
52345239
start = round_down(start, btrfs_inode_sectorsize(inode));
52355240
len = round_up(max, btrfs_inode_sectorsize(inode)) - start;
52365241

fs/btrfs/inode.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3241,6 +3241,7 @@ void btrfs_run_delayed_iputs(struct btrfs_fs_info *fs_info)
32413241
inode = list_first_entry(&fs_info->delayed_iputs,
32423242
struct btrfs_inode, delayed_iput);
32433243
run_delayed_iput_locked(fs_info, inode);
3244+
cond_resched_lock(&fs_info->delayed_iput_lock);
32443245
}
32453246
spin_unlock(&fs_info->delayed_iput_lock);
32463247
}

fs/btrfs/tree-log.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6463,6 +6463,24 @@ void btrfs_log_new_name(struct btrfs_trans_handle *trans,
64636463
(!old_dir || old_dir->logged_trans < trans->transid))
64646464
return;
64656465

6466+
/*
6467+
* If we are doing a rename (old_dir is not NULL) from a directory that
6468+
* was previously logged, make sure the next log attempt on the directory
6469+
* is not skipped and logs the inode again. This is because the log may
6470+
* not currently be authoritative for a range including the old
6471+
* BTRFS_DIR_ITEM_KEY and BTRFS_DIR_INDEX_KEY keys, so we want to make
6472+
* sure after a log replay we do not end up with both the new and old
6473+
* dentries around (in case the inode is a directory we would have a
6474+
* directory with two hard links and 2 inode references for different
6475+
* parents). The next log attempt of old_dir will happen at
6476+
* btrfs_log_all_parents(), called through btrfs_log_inode_parent()
6477+
* below, because we have previously set inode->last_unlink_trans to the
6478+
* current transaction ID, either here or at btrfs_record_unlink_dir() in
6479+
* case inode is a directory.
6480+
*/
6481+
if (old_dir)
6482+
old_dir->logged_trans = 0;
6483+
64666484
btrfs_init_log_ctx(&ctx, &inode->vfs_inode);
64676485
ctx.logging_new_name = true;
64686486
/*

fs/btrfs/volumes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1459,7 +1459,7 @@ static bool dev_extent_hole_check_zoned(struct btrfs_device *device,
14591459
/* Given hole range was invalid (outside of device) */
14601460
if (ret == -ERANGE) {
14611461
*hole_start += *hole_size;
1462-
*hole_size = false;
1462+
*hole_size = 0;
14631463
return true;
14641464
}
14651465

0 commit comments

Comments
 (0)