Re: [PATCH] fsverity: don't use bio_first_page_all() in fsverity_verify_bio()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jun 03, 2023 at 07:21:01PM -0700, Eric Biggers wrote:
> bio_first_page_all(bio)->mapping->host is not compatible with large
> folios, since the first page of the bio is not necessarily the head page
> of the folio, and therefore it might not have the mapping pointer set.

Yes, that's true.  It is going to depend on the filesystem, since these
two bios are equivalent:

(folio->page[0], offset=0x4000, len=0x300)
(folio->page[4], offset=0, len=0x300)

and we don't yet have a rule that filesystems must construct one or the
other.  We probably _should_, but that was pretty low down my list of
things to care about right now.

> Therefore, move the dereference of ->mapping->host into
> verify_data_blocks(), which works with a folio.

Seems reasonable.

Reviewed-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>

> @@ -320,7 +321,6 @@ EXPORT_SYMBOL_GPL(fsverity_verify_blocks);
>   */
>  void fsverity_verify_bio(struct bio *bio)
>  {
> -	struct inode *inode = bio_first_page_all(bio)->mapping->host;

An alternative fix could be

	struct folio *first = page_folio(bio_first_page_all(bio));
	struct inode *inode = first->mapping->host;

Or we could add a bio_first_folio_all() that wraps that for you.



[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux