Message ID | 20200217160040.21922-1-fdmanana@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Btrfs: fix possible sleep in atomic context during a shrinking truncate | expand |
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 90c404ae242a..b7b6baa38e10 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -4998,10 +4998,15 @@ int btrfs_truncate_inode_items(struct btrfs_trans_handle *trans, btrfs_inode_safe_disk_i_size_write(inode, last_size); } + /* + * Release and free the path before unlocking the range because we might + * be holding spin locks on some extent buffers. + */ + btrfs_free_path(path); + unlock_extent_cached(&BTRFS_I(inode)->io_tree, lock_start, (u64)-1, &cached_state); - btrfs_free_path(path); return ret; }