Commit 70623723 authored by Paolo Bonzini's avatar Paolo Bonzini

KVM: guest_memfd: pass error up from filemap_grab_folio

Some SNP ioctls will require the page not to be in the pagecache, and as such they
will want to return EEXIST to userspace.  Start by passing the error up from
filemap_grab_folio.
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 1d23040c
...@@ -19,8 +19,8 @@ static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index) ...@@ -19,8 +19,8 @@ static struct folio *kvm_gmem_get_folio(struct inode *inode, pgoff_t index)
/* TODO: Support huge pages. */ /* TODO: Support huge pages. */
folio = filemap_grab_folio(inode->i_mapping, index); folio = filemap_grab_folio(inode->i_mapping, index);
if (IS_ERR_OR_NULL(folio)) if (IS_ERR(folio))
return NULL; return folio;
/* /*
* Use the up-to-date flag to track whether or not the memory has been * Use the up-to-date flag to track whether or not the memory has been
...@@ -146,8 +146,8 @@ static long kvm_gmem_allocate(struct inode *inode, loff_t offset, loff_t len) ...@@ -146,8 +146,8 @@ static long kvm_gmem_allocate(struct inode *inode, loff_t offset, loff_t len)
} }
folio = kvm_gmem_get_folio(inode, index); folio = kvm_gmem_get_folio(inode, index);
if (!folio) { if (IS_ERR(folio)) {
r = -ENOMEM; r = PTR_ERR(folio);
break; break;
} }
...@@ -505,8 +505,8 @@ int kvm_gmem_get_pfn(struct kvm *kvm, struct kvm_memory_slot *slot, ...@@ -505,8 +505,8 @@ int kvm_gmem_get_pfn(struct kvm *kvm, struct kvm_memory_slot *slot,
} }
folio = kvm_gmem_get_folio(file_inode(file), index); folio = kvm_gmem_get_folio(file_inode(file), index);
if (!folio) { if (IS_ERR(folio)) {
r = -ENOMEM; r = PTR_ERR(folio);
goto out_fput; goto out_fput;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment