mirror of
https://gitee.com/bianbu-linux/linux-6.6
synced 2025-04-24 14:07:52 -04:00
for-6.6-rc2-tag
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE8rQSAMVO+zA4DBdWxWXV+ddtWDsFAmULIZUACgkQxWXV+ddt WDv77Q//ZiKpmevPQmQfUtmV8WwMfD2a9zRlKBpGggwtrD4mf3CYRLnOpTm81MPO vFIuYacBn+9UXqp2j/IbvNWfQAPQNVDxSPXx66uba93RJc+bB1J3TydxcEyJ7fr4 dwhLLk01jttfk0+rnjF34fmXiHSTtI6D2WeaLCzUbaPLw4SZ+ul+GAdeF3P174iO OMNBUln7hK00Q7j8kFf4j6SW1yIIKMTl6MfOFJYanIqzx51PYFFVtKwoCr0Vt53v ZHbgrK582ZJO6pKF9kJF/1tqrY9/Df8jzgSypK8pew/SukMOrf7iVwrmhietuhKA 92j5sxKhCRyq6Qg6ZwC0jyk+oMqrT8r+q3r38a5qDJx/9Q279vkXBqQnACfLjmnH 6+sNdkY5/uBWnDMh/+d6yBtfbdW5DtuET4McYpJt1Nk2St/f3UzPaL4LcNkDXNPk t1Q4W4v0KS1V8TbsLfdD629CMghxQNKVs1XqyCAbUq9ub4LE2CtL3lDm730qZoZt +LM7+sAxEOJC6yqYfdEbcIc8l27Hl5nZEzamcvMrRz61N85/8Jx4Sq2b6VSE9TCE hNEWAL5sOjhuhmUPhatYC+KO1P6NDP+Yg99yZCZIT9s/P1oK5H+aETshWX+lvJ+Q Ai+qzKvp2ERHFcE+R5qIXs/uX7azpzjqsRZxY2/zdp70ugQDSXE= =0eEg -----END PGP SIGNATURE----- Merge tag 'for-6.6-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux Pull btrfs fixes from David Sterba: "A few more followup fixes to the directory listing. People have noticed different behaviour compared to other filesystems after changes in 6.5. This is now unified to more "logical" and expected behaviour while still within POSIX. And a few more fixes for stable. - change behaviour of readdir()/rewinddir() when new directory entries are created after opendir(), properly tracking the last entry - fix race in readdir when multiple threads can set the last entry index for a directory Additionally: - use exclusive lock when direct io might need to drop privs and call notify_change() - don't clear uptodate bit on page after an error, this may lead to a deadlock in subpage mode - fix waiting pattern when multiple readers block on Merkle tree data, switch to folios" * tag 'for-6.6-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: fix race between reading a directory and adding entries to it btrfs: refresh dir last index during a rewinddir(3) call btrfs: set last dir index to the current last index when opening dir btrfs: don't clear uptodate on write errors btrfs: file_remove_privs needs an exclusive lock in direct io write btrfs: convert btrfs_read_merkle_tree_page() to use a folio
This commit is contained in:
commit
a229cf67ab
4 changed files with 69 additions and 53 deletions
|
@ -1085,9 +1085,6 @@ static void submit_uncompressed_range(struct btrfs_inode *inode,
|
|||
btrfs_mark_ordered_io_finished(inode, locked_page,
|
||||
page_start, PAGE_SIZE,
|
||||
!ret);
|
||||
btrfs_page_clear_uptodate(inode->root->fs_info,
|
||||
locked_page, page_start,
|
||||
PAGE_SIZE);
|
||||
mapping_set_error(locked_page->mapping, ret);
|
||||
unlock_page(locked_page);
|
||||
}
|
||||
|
@ -2791,7 +2788,6 @@ out_page:
|
|||
mapping_set_error(page->mapping, ret);
|
||||
btrfs_mark_ordered_io_finished(inode, page, page_start,
|
||||
PAGE_SIZE, !ret);
|
||||
btrfs_page_clear_uptodate(fs_info, page, page_start, PAGE_SIZE);
|
||||
clear_page_dirty_for_io(page);
|
||||
}
|
||||
btrfs_page_clear_checked(fs_info, page, page_start, PAGE_SIZE);
|
||||
|
@ -5769,20 +5765,24 @@ out:
|
|||
|
||||
static int btrfs_get_dir_last_index(struct btrfs_inode *dir, u64 *index)
|
||||
{
|
||||
if (dir->index_cnt == (u64)-1) {
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
btrfs_inode_lock(dir, 0);
|
||||
if (dir->index_cnt == (u64)-1) {
|
||||
ret = btrfs_inode_delayed_dir_index_count(dir);
|
||||
if (ret) {
|
||||
ret = btrfs_set_inode_index_count(dir);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
*index = dir->index_cnt;
|
||||
/* index_cnt is the index number of next new entry, so decrement it. */
|
||||
*index = dir->index_cnt - 1;
|
||||
out:
|
||||
btrfs_inode_unlock(dir, 0);
|
||||
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -5817,6 +5817,19 @@ static int btrfs_opendir(struct inode *inode, struct file *file)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static loff_t btrfs_dir_llseek(struct file *file, loff_t offset, int whence)
|
||||
{
|
||||
struct btrfs_file_private *private = file->private_data;
|
||||
int ret;
|
||||
|
||||
ret = btrfs_get_dir_last_index(BTRFS_I(file_inode(file)),
|
||||
&private->last_index);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
return generic_file_llseek(file, offset, whence);
|
||||
}
|
||||
|
||||
struct dir_entry {
|
||||
u64 ino;
|
||||
u64 offset;
|
||||
|
@ -10868,7 +10881,7 @@ static const struct inode_operations btrfs_dir_inode_operations = {
|
|||
};
|
||||
|
||||
static const struct file_operations btrfs_dir_file_operations = {
|
||||
.llseek = generic_file_llseek,
|
||||
.llseek = btrfs_dir_llseek,
|
||||
.read = generic_read_dir,
|
||||
.iterate_shared = btrfs_real_readdir,
|
||||
.open = btrfs_opendir,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue