]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
fs: Drop osync_buffers_list()
authorJan Kara <jack@suse.cz>
Thu, 26 Mar 2026 09:54:22 +0000 (10:54 +0100)
committerChristian Brauner <brauner@kernel.org>
Thu, 26 Mar 2026 14:03:30 +0000 (15:03 +0100)
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>
fs/buffer.c

index c85ccfb1a4ec784782b8408caf954ab875341d83..1c0e7c81a38bd551cb429ab49c7ba4f8ccb50438 100644 (file)
@@ -526,41 +526,6 @@ int inode_has_buffers(struct inode *inode)
 }
 EXPORT_SYMBOL_GPL(inode_has_buffers);
 
-/*
- * osync is designed to support O_SYNC io.  It waits synchronously for
- * all already-submitted IO to complete, but does not queue any new
- * writes to the disk.
- *
- * To do O_SYNC writes, just queue the buffer writes with write_dirty_buffer
- * as you dirty the buffers, and then use osync_inode_buffers to wait for
- * completion.  Any other dirty buffers which are not yet queued for
- * write will not be flushed to disk by the osync.
- */
-static int osync_buffers_list(spinlock_t *lock, struct list_head *list)
-{
-       struct buffer_head *bh;
-       struct list_head *p;
-       int err = 0;
-
-       spin_lock(lock);
-repeat:
-       list_for_each_prev(p, list) {
-               bh = BH_ENTRY(p);
-               if (buffer_locked(bh)) {
-                       get_bh(bh);
-                       spin_unlock(lock);
-                       wait_on_buffer(bh);
-                       if (!buffer_uptodate(bh))
-                               err = -EIO;
-                       brelse(bh);
-                       spin_lock(lock);
-                       goto repeat;
-               }
-       }
-       spin_unlock(lock);
-       return err;
-}
-
 /**
  * sync_mapping_buffers - write out & wait upon a mapping's "associated" buffers
  * @mapping: the mapping which wants those buffers written
@@ -777,7 +742,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
 {
        struct buffer_head *bh;
        struct address_space *mapping;
-       int err = 0, err2;
+       int err = 0;
        struct blk_plug plug;
        LIST_HEAD(tmp);
 
@@ -844,11 +809,7 @@ static int fsync_buffers_list(spinlock_t *lock, struct list_head *list)
        }
        
        spin_unlock(lock);
-       err2 = osync_buffers_list(lock, list);
-       if (err)
-               return err;
-       else
-               return err2;
+       return err;
 }
 
 /*