> For the complete documentation index, see [llms.txt](https://book.bsdcn.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://book.bsdcn.org/man/man9/vhold.9.md).

# vhold.9

`vhold` — 获取/释放对 vnode 的持有

## 名称

`vhold`

## 概要

`#include <sys/param.h>`

`#include <sys/vnode.h>`

`void vhold(struct vnode *vp)`

`void vholdl(struct vnode *vp)`

`void vdrop(struct vnode *vp)`

`void vdropl(struct vnode *vp)`

## 描述

`vhold()` 和 `vholdl()` 函数递增给定 vnode 的 `v_holdcnt`。如果 vnode 已添加到空闲列表且仍被引用，则将其移除。

`vdrop()` 和 `vdropl()` 函数递减 vnode 的 `v_holdcnt`。如果在调用 `vdrop()` 或 `vdropl()` 之前持有计数小于或等于零，系统将 panic。如果 vnode 不再被引用，则将其释放。

`vhold()` 和 `vdrop()` 锁定 vnode 互斥锁，而 `vholdl()` 和 `vdropl()` 期望互斥锁已被持有。

## 参见

[vnode(9)](/man/man9/vnode.9.md)

## 作者

本手册页由 Chad David <davidc@acns.ab.ca> 编写。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://book.bsdcn.org/man/man9/vhold.9.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
