* Walk the list of locks for an inode and * return the first blocking lock. */
| 1654 | * return the first blocking lock. |
| 1655 | */ |
| 1656 | static struct lockf_entry * |
| 1657 | lf_getblock(struct lockf *state, struct lockf_entry *lock) |
| 1658 | { |
| 1659 | struct lockf_entry *overlap; |
| 1660 | |
| 1661 | LIST_FOREACH(overlap, &state->ls_active, lf_link) { |
| 1662 | /* |
| 1663 | * We may assume that the active list is sorted by |
| 1664 | * lf_start. |
| 1665 | */ |
| 1666 | if (overlap->lf_start > lock->lf_end) |
| 1667 | break; |
| 1668 | if (!lf_blocks(lock, overlap)) |
| 1669 | continue; |
| 1670 | return (overlap); |
| 1671 | } |
| 1672 | return (NOLOCKF); |
| 1673 | } |
| 1674 | |
| 1675 | /* |
| 1676 | * Walk the list of locks for an inode to find an overlapping lock (if |
no test coverage detected