mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Linux: always check or verify return of igrab()
zhold() wraps igrab() on Linux, and igrab() may fail when the inode is in the process of being deleted. This means zhold() must only be called when a reference exists and therefore it cannot be deleted. This is the case for all existing consumers so add a VERIFY and a comment explaining this requirement. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Adam Moss <c@yotes.com> Closes #11704
This commit is contained in:
@@ -73,7 +73,13 @@ extern "C" {
|
||||
#define zn_has_cached_data(zp) ((zp)->z_is_mapped)
|
||||
#define zn_rlimit_fsize(zp, uio) (0)
|
||||
|
||||
#define zhold(zp) igrab(ZTOI((zp)))
|
||||
/*
|
||||
* zhold() wraps igrab() on Linux, and igrab() may fail when the
|
||||
* inode is in the process of being deleted. As zhold() must only be
|
||||
* called when a ref already exists - so the inode cannot be
|
||||
* mid-deletion - we VERIFY() this.
|
||||
*/
|
||||
#define zhold(zp) VERIFY3P(igrab(ZTOI((zp))), !=, NULL)
|
||||
#define zrele(zp) iput(ZTOI((zp)))
|
||||
|
||||
/* Called on entry to each ZFS inode and vfs operation. */
|
||||
|
||||
Reference in New Issue
Block a user