File tree Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Expand file tree Collapse file tree 1 file changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,15 @@ getf(int fd)
199199 /* Also grab vnode, so we can fish out the minor, for onexit */
200200 if (!file_vnode_withvid (fd , & vp , & vid )) {
201201 sfp -> f_vnode = vp ;
202- if (vnode_vtype (vp ) != VDIR ) {
202+
203+ if (vnode_getwithref (vp ) != 0 ) {
204+ file_drop (fd );
205+ return (NULL );
206+ }
207+
208+ enum vtype type ;
209+ type = vnode_vtype (vp );
210+ if (type == VCHR || type == VBLK ) {
203211 sfp -> f_file = minor (vnode_specrdev (vp ));
204212 }
205213 file_drop (fd );
@@ -242,6 +250,9 @@ releasef(int fd)
242250 if (!fp )
243251 return ; // Not found
244252
253+ if (fp -> f_vnode != NULL )
254+ vnode_put (fp -> f_vnode );
255+
245256 /* Remove node from the list */
246257 mutex_enter (& spl_getf_lock );
247258 list_remove (& spl_getf_list , fp );
You can’t perform that action at this time.
0 commit comments