svn commit: r358827 - head/sys/kern

Konstantin Belousov kib at FreeBSD.org
Mon Mar 9 23:40:26 UTC 2020


Author: kib
Date: Mon Mar  9 23:40:25 2020
New Revision: 358827
URL: https://svnweb.freebsd.org/changeset/base/358827

Log:
  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

Modified:
  head/sys/kern/sys_pipe.c

Modified: head/sys/kern/sys_pipe.c
==============================================================================
--- head/sys/kern/sys_pipe.c	Mon Mar  9 23:08:24 2020	(r358826)
+++ head/sys/kern/sys_pipe.c	Mon Mar  9 23:40:25 2020	(r358827)
@@ -367,6 +367,15 @@ pipe_paircreate(struct thread *td, struct pipepair **p
 		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;
 	}


More information about the svn-src-all mailing list