Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: Drop osync_buffers_list()

The function only waits for already locked buffers in the list of
metadata bhs. fsync_buffers_list() has just waited for all outstanding
IO on buffers so this isn't adding anything useful. Comment in front of
fsync_buffers_list() mentions concerns about buffers being moved out
from tmp list back to mappings i_private_list but these days
mark_buffer_dirty_inode() doesn't touch inodes with b_assoc_map set so
that cannot happen. Just delete the stale code.

Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jan Kara <jack@suse.cz>
Link: https://patch.msgid.link/20260326095354.16340-70-jack@suse.cz
Tested-by: syzbot@syzkaller.appspotmail.com
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Jan Kara and committed by
Christian Brauner
cae6b7a0 d15c987d

+2 -41
+2 -41
fs/buffer.c
··· 526 526 } 527 527 EXPORT_SYMBOL_GPL(inode_has_buffers); 528 528 529 - /* 530 - * osync is designed to support O_SYNC io. It waits synchronously for 531 - * all already-submitted IO to complete, but does not queue any new 532 - * writes to the disk. 533 - * 534 - * To do O_SYNC writes, just queue the buffer writes with write_dirty_buffer 535 - * as you dirty the buffers, and then use osync_inode_buffers to wait for 536 - * completion. Any other dirty buffers which are not yet queued for 537 - * write will not be flushed to disk by the osync. 538 - */ 539 - static int osync_buffers_list(spinlock_t *lock, struct list_head *list) 540 - { 541 - struct buffer_head *bh; 542 - struct list_head *p; 543 - int err = 0; 544 - 545 - spin_lock(lock); 546 - repeat: 547 - list_for_each_prev(p, list) { 548 - bh = BH_ENTRY(p); 549 - if (buffer_locked(bh)) { 550 - get_bh(bh); 551 - spin_unlock(lock); 552 - wait_on_buffer(bh); 553 - if (!buffer_uptodate(bh)) 554 - err = -EIO; 555 - brelse(bh); 556 - spin_lock(lock); 557 - goto repeat; 558 - } 559 - } 560 - spin_unlock(lock); 561 - return err; 562 - } 563 - 564 529 /** 565 530 * sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers 566 531 * @mapping: the mapping which wants those buffers written ··· 742 777 { 743 778 struct buffer_head *bh; 744 779 struct address_space *mapping; 745 - int err = 0, err2; 780 + int err = 0; 746 781 struct blk_plug plug; 747 782 LIST_HEAD(tmp); 748 783 ··· 809 844 } 810 845 811 846 spin_unlock(lock); 812 - err2 = osync_buffers_list(lock, list); 813 - if (err) 814 - return err; 815 - else 816 - return err2; 847 + return err; 817 848 } 818 849 819 850 /*