On Tue, Jul 27, 2021 at 08:06:21AM +1000, NeilBrown wrote: > You seem to be assuming that inode->i_mapping->host is always 'inode'. > That is not the case. Weeeelllll ... technically, outside of the filesystems that are changed here, the only assumption in common code that is made is that inode_to_bdi(inode->i_mapping->host->i_mapping->host) == inode_to_bdi(inode) Looking at inode_to_bdi, that just means that they have the same i_sb. Which is ... not true for character raw devices? if (++raw_devices[minor].inuse == 1) file_inode(filp)->i_mapping = bdev->bd_inode->i_mapping; but then, who's using readahead on a character raw device? They force O_DIRECT. But maybe this should pass inode->i_mapping->host instead of inode. > In particular, fs/coda/file.c contains > > if (coda_inode->i_mapping == &coda_inode->i_data) > coda_inode->i_mapping = host_inode->i_mapping; > > So a "coda_inode" shares the mapping with a "host_inode". > > This is why an inode has both i_data and i_mapping. > > So I'm not really sure this patch is safe. It might break codafs. > > But it is more likely that codafs isn't used, doesn't work, should be > removed, and i_data should be renamed to i_mapping. I think there's also something unusual going on with either ocfs2 or gfs2. But yes, I don't understand the rules for when I need to go from inode->i_mapping->host.