pipe: explain why not deallocating inode number is fine.

Suggested and reviewed by:	markj
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D24009
This commit is contained in:
Konstantin Belousov 2020-03-09 23:40:25 +00:00
parent a24ac0ce9b
commit 2d3c083fd7

View File

@ -367,6 +367,15 @@ pipe_paircreate(struct thread *td, struct pipepair **p_pp)
goto fail;
error = pipe_create(wpipe, false);
if (error != 0) {
/*
* This cleanup leaves the pipe inode number for rpipe
* still allocated, but never used. We do not free
* inode numbers for opened pipes, which is required
* for correctness because numbers must be unique.
* But also it avoids any memory use by the unr
* allocator, so stashing away the transient inode
* number is reasonable.
*/
pipe_free_kmem(rpipe);
goto fail;
}