diff options
author | Konstantin Belousov <kib@FreeBSD.org> | 2020-03-09 23:40:25 +0000 |
---|---|---|
committer | Konstantin Belousov <kib@FreeBSD.org> | 2020-03-09 23:40:25 +0000 |
commit | 2d3c083fd7fdd02971ef0a593f3f1bf047f7b418 (patch) | |
tree | 40e2f60b7c151bd6af74a61a6319eeb8815ad2ed | |
parent | a24ac0ce9b810f0c1d017b2fa8e2245bb757dbb9 (diff) | |
download | src-2d3c083fd7fdd02971ef0a593f3f1bf047f7b418.tar.gz src-2d3c083fd7fdd02971ef0a593f3f1bf047f7b418.zip |
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
Notes
Notes:
svn path=/head/; revision=358827
-rw-r--r-- | sys/kern/sys_pipe.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c index 55d882c4c6f5..62dfa65c1dd8 100644 --- a/sys/kern/sys_pipe.c +++ b/sys/kern/sys_pipe.c @@ -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; } |