On Fri, Dec 11, 2015 at 01:09:30AM -0500, Michael McConville wrote:
> Here's the PR:
> 
> https://gnats.netbsd.org/50381
> 
> And the commit:
> 
> https://marc.info/?l=netbsd-source-changes&m=144694603617544&w=2
> 
> We have very few local changes to tmpfs and we share the
> KASSERT(de->td_node == NULL), so I think this applies to us.
> 
> Thoughts? ok?
> 
> 
> Index: sys/tmpfs/tmpfs_subr.c
> ===================================================================
> RCS file: /cvsroot/src/sys/fs/tmpfs/tmpfs_subr.c,v
> retrieving revision 1.96.4.1
> retrieving revision 1.96.4.1.2.1
> diff -u -p -r1.96.4.1 -r1.96.4.1.2.1
> --- sys/fs/tmpfs/tmpfs_subr.c 22 Dec 2014 02:05:08 -0000      1.96.4.1
> +++ sys/fs/tmpfs/tmpfs_subr.c 8 Nov 2015 01:27:10 -0000       1.96.4.1.2.1
> @@ -451,6 +451,7 @@ tmpfs_alloc_dirent(tmpfs_mount_t *tmp, c
>       nde->td_namelen = len;
>       memcpy(nde->td_name, name, len);
>       nde->td_seq = TMPFS_DIRSEQ_NONE;
> +     nde->td_node = NULL; /* for asserts */
>  
>       *de = nde;
>       return 0;
> 

Well, that diff won't apply directly, and in my opinion this is a safter way, 
considering
the tmpfs code, to accomplish the same thing.

Index: tmpfs/tmpfs_mem.c
===================================================================
RCS file: /cvs/src/sys/tmpfs/tmpfs_mem.c,v
retrieving revision 1.7
diff -u -p -u -p -r1.7 tmpfs_mem.c
--- tmpfs/tmpfs_mem.c   14 Mar 2015 03:38:52 -0000      1.7
+++ tmpfs/tmpfs_mem.c   11 Dec 2015 17:01:06 -0000
@@ -151,7 +151,7 @@ tmpfs_dirent_get(struct tmpfs_mount *mp)
        if (!tmpfs_mem_incr(mp, sizeof(struct tmpfs_dirent))) {
                return NULL;
        }
-       return pool_get(&tmpfs_dirent_pool, PR_WAITOK);
+       return pool_get(&tmpfs_dirent_pool, PR_ZERO|PR_WAITOK);
 }
 
 void

Reply via email to