[PATCH 3/7] gnttab: fold redundant error code paths in acquire_grant_for_copy()
Jan Beulich <[email protected]> Tue, 28 Jul 2026 15:51:03 +0200
| Newsgroups | gmane.comp.emulators.xen.devel |
|---|---|
| Message-ID | <[email protected]> |
One of the open-coded error paths of transitive grant handling is an exact match of the code at the unlock_out_clear label. The other can be made so by moving the put_page() earlier. Signed-off-by: Jan Beulich <[email protected]> --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -2729,10 +2729,7 @@ acquire_grant_for_copy( { atomic_dec(&rgt->nr_v2_ops); rcu_unlock_domain(td); - reduce_status_for_pin(rd, act, status, readonly); - active_entry_release(act); - grant_read_unlock(rgt); - return rc; + goto unlock_out_clear; } /* @@ -2763,17 +2760,16 @@ acquire_grant_for_copy( release_grant_for_copy(td, trans_gref, readonly); rcu_unlock_domain(td); + put_page(*page); + *page = NULL; + grant_read_lock(rgt); atomic_dec(&rgt->nr_v2_ops); act = active_entry_acquire(rgt, gref); - reduce_status_for_pin(rd, act, status, readonly); - active_entry_release(act); - grant_read_unlock(rgt); - put_page(*page); - *page = NULL; - return ERESTART; + rc = ERESTART; + goto unlock_out_clear; } if ( !old_pin )