Skip to content

Commit ea7d898

Browse files
bvanasschebrauner
authored andcommitted
fs: Propagate write hints to the struct block_device inode
Write hints applied with F_SET_RW_HINT on a block device affect the block device inode only. Propagate these hints to the inode associated with struct block_device because that is the inode used when writing back dirty pages. Cc: Alexander Viro <[email protected]> Cc: Christian Brauner <[email protected]> Cc: Jens Axboe <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Jeff Layton <[email protected]> Cc: Chuck Lever <[email protected]> Cc: Kanchan Joshi <[email protected]> Signed-off-by: Bart Van Assche <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent fe3944f commit ea7d898

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fs/fcntl.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,13 @@ static long fcntl_set_rw_hint(struct file *file, unsigned int cmd,
317317

318318
WRITE_ONCE(inode->i_write_hint, hint);
319319

320+
/*
321+
* file->f_mapping->host may differ from inode. As an example,
322+
* blkdev_open() modifies file->f_mapping.
323+
*/
324+
if (file->f_mapping->host != inode)
325+
WRITE_ONCE(file->f_mapping->host->i_write_hint, hint);
326+
320327
return 0;
321328
}
322329

0 commit comments

Comments
 (0)