---
name: "VFS_LOCK_GIANT"
section: "9freebsd"
platform: "linux"
package: "freebsd-manpages"
version: "8.2-1"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/VFS_LOCK_GIANT/9freebsd"
---

# VFS\_LOCK\_GIANT(9freebsd)

conditionally lock and unlock Giant around entry into VFS

## NAME

**VFS\_LOCK\_GIANT**, **VFS\_UNLOCK\_GIANT** – conditionally lock and unlock Giant around entry into VFS

## SYNOPSIS

**#include \<sys/param.h\>**

**#include \<sys/mount.h\>**

**#include \<sys/vnode.h\>**

*int*\

**VFS\_LOCK\_GIANT**(*struct mount \*mp*);

*void*\

**VFS\_UNLOCK\_GIANT**(*int vfslocked*);

## DESCRIPTION

**VFS\_LOCK\_GIANT**() will conditionally acquire the *Giant* lock if the file system referenced by *mp* is marked as MPSAFE or not, returning a flag indicating whether *Giant* was set, which may later be passed to **VFS\_UNLOCK\_GIANT**(). The value of *mp* will typically be derived from the mount pointer in a *vnode* on which a VFS operation will be performed.

**VFS\_UNLOCK\_GIANT**() conditionally releases the *Giant* lock if the passed *vfslocked* argument is non-zero. It is expected that the argument will be derived from the return values of **VFS\_LOCK\_GIANT**() or NDHASGIANT(9).

## RETURN VALUES

**VFS\_LOCK\_GIANT**() returns a boolean indicating whether or not *Giant* was acquired.

## SEE ALSO

[mutex(9)](/mutex/9.md), NDHASGIANT(9), [vnode(9)](/vnode/9.md)

## AUTHORS

MPSAFE VFS support for FreeBSD was implemented by Jeff Roberson.

This manual page was written by Robert Watson.

## BUGS

Non-MPSAFE file systems exist, requiring callers conditional locking and unlocking of *Giant*.
