* There are various reference counters associated with the mount point. * Normally it is permitted to modify them without taking the mnt ilock, * but this behavior can be temporarily disabled if stable value is needed * or callers are expected to block (e.g. to not allow new users during * forced unmount). */
| 1527 | * forced unmount). |
| 1528 | */ |
| 1529 | void |
| 1530 | vfs_op_enter(struct mount *mp) |
| 1531 | { |
| 1532 | struct mount_pcpu *mpcpu; |
| 1533 | int cpu; |
| 1534 | |
| 1535 | MNT_ILOCK(mp); |
| 1536 | mp->mnt_vfs_ops++; |
| 1537 | if (mp->mnt_vfs_ops > 1) { |
| 1538 | MNT_IUNLOCK(mp); |
| 1539 | return; |
| 1540 | } |
| 1541 | vfs_op_barrier_wait(mp); |
| 1542 | CPU_FOREACH(cpu) { |
| 1543 | mpcpu = vfs_mount_pcpu_remote(mp, cpu); |
| 1544 | |
| 1545 | mp->mnt_ref += mpcpu->mntp_ref; |
| 1546 | mpcpu->mntp_ref = 0; |
| 1547 | |
| 1548 | mp->mnt_lockref += mpcpu->mntp_lockref; |
| 1549 | mpcpu->mntp_lockref = 0; |
| 1550 | |
| 1551 | mp->mnt_writeopcount += mpcpu->mntp_writeopcount; |
| 1552 | mpcpu->mntp_writeopcount = 0; |
| 1553 | } |
| 1554 | if (mp->mnt_ref <= 0 || mp->mnt_lockref < 0 || mp->mnt_writeopcount < 0) |
| 1555 | panic("%s: invalid count(s) on mp %p: ref %d lockref %d writeopcount %d\n", |
| 1556 | __func__, mp, mp->mnt_ref, mp->mnt_lockref, mp->mnt_writeopcount); |
| 1557 | MNT_IUNLOCK(mp); |
| 1558 | vfs_assert_mount_counters(mp); |
| 1559 | } |
| 1560 | |
| 1561 | void |
| 1562 | vfs_op_exit_locked(struct mount *mp) |
no test coverage detected