libafs: do not allow NULL creds for afs_CreateReq
[openafs.git] / src / afs / afs_bypasscache.c
1 /*
2  * COPYRIGHT  ©  2000
3  * THE REGENTS OF THE UNIVERSITY OF MICHIGAN
4  * ALL RIGHTS RESERVED
5  *
6  * Permission is granted to use, copy, create derivative works
7  * and redistribute this software and such derivative works
8  * for any purpose, so long as the name of The University of
9  * Michigan is not used in any advertising or publicity
10  * pertaining to the use of distribution of this software
11  * without specific, written prior authorization.  If the
12  * above copyright notice or any other identification of the
13  * University of Michigan is included in any copy of any
14  * portion of this software, then the disclaimer below must
15  * also be included.
16  *
17  * THIS SOFTWARE IS PROVIDED AS IS, WITHOUT REPRESENTATION
18  * FROM THE UNIVERSITY OF MICHIGAN AS TO ITS FITNESS FOR ANY
19  * PURPOSE, AND WITHOUT WARRANTY BY THE UNIVERSITY O
20  * MICHIGAN OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
21  * WITHOUT LIMITATION THE IMPLIED WARRANTIES OF
22  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE
23  * REGENTS OF THE UNIVERSITY OF MICHIGAN SHALL NOT BE LIABLE
24  * FOR ANY DAMAGES, INCLUDING SPECIAL, INDIRECT, INCIDENTAL, OR
25  * CONSEQUENTIAL DAMAGES, WITH RESPECT TO ANY CLAIM ARISING
26  * OUT OF OR IN CONNECTION WITH THE USE OF THE SOFTWARE, EVEN
27  * IF IT HAS BEEN OR IS HEREAFTER ADVISED OF THE POSSIBILITY OF
28  * SUCH DAMAGES.
29  */
30
31  /*
32  * Portions Copyright (c) 2008
33  * The Linux Box Corporation
34  * ALL RIGHTS RESERVED
35  *
36  * Permission is granted to use, copy, create derivative works
37  * and redistribute this software and such derivative works
38  * for any purpose, so long as the name of the Linux Box
39  * Corporation is not used in any advertising or publicity
40  * pertaining to the use or distribution of this software
41  * without specific, written prior authorization.  If the
42  * above copyright notice or any other identification of the
43  * Linux Box Corporation is included in any copy of any
44  * portion of this software, then the disclaimer below must
45  * also be included.
46  *
47  * This software is provided as is, without representation
48  * from the Linux Box Corporation as to its fitness for any
49  * purpose, and without warranty by the Linux Box Corporation
50  * of any kind, either express or implied, including
51  * without limitation the implied warranties of
52  * merchantability and fitness for a particular purpose.  The
53  * Linux Box Corporation shall not be liable for any damages,
54  * including special, indirect, incidental, or consequential
55  * damages, with respect to any claim arising out of or in
56  * connection with the use of the software, even if it has been
57  * or is hereafter advised of the possibility of such damages.
58  */
59
60
61 #include <afsconfig.h>
62 #include "afs/param.h"
63 #if defined(AFS_CACHE_BYPASS) || defined(UKERNEL)
64 #include "afs/afs_bypasscache.h"
65
66 /*
67  * afs_bypasscache.c
68  *
69  */
70 #include "afs/sysincludes.h" /* Standard vendor system headers */
71 #include "afs/afsincludes.h" /* Afs-based standard headers */
72 #include "afs/afs_stats.h"   /* statistics */
73 #include "afs/nfsclient.h"
74 #include "rx/rx_globals.h"
75
76 #ifndef afs_min
77 #define afs_min(A,B) ((A)<(B)) ? (A) : (B)
78 #endif
79
80 /* conditional GLOCK macros */
81 #define COND_GLOCK(var) \
82         do { \
83                 var = ISAFS_GLOCK(); \
84                 if(!var) \
85                         RX_AFS_GLOCK(); \
86         } while(0)
87
88 #define COND_RE_GUNLOCK(var) \
89         do { \
90                 if(var) \
91                         RX_AFS_GUNLOCK(); \
92         } while(0)
93
94
95 /* conditional GUNLOCK macros */
96
97 #define COND_GUNLOCK(var) \
98         do {    \
99                 var = ISAFS_GLOCK(); \
100                 if(var) \
101                         RX_AFS_GUNLOCK(); \
102         } while(0)
103
104 #define COND_RE_GLOCK(var) \
105         do { \
106                 if(var) \
107                         RX_AFS_GLOCK(); \
108         } while(0)
109
110
111 int cache_bypass_strategy   =   NEVER_BYPASS_CACHE;
112 afs_size_t cache_bypass_threshold  =    AFS_CACHE_BYPASS_DISABLED; /* file size > threshold triggers bypass */
113 int cache_bypass_prefetch = 1;  /* Should we do prefetching ? */
114
115 extern afs_rwlock_t afs_xcbhash;
116
117 /*
118  * This is almost exactly like the PFlush() routine in afs_pioctl.c,
119  * but that routine is static.  We are about to change a file from
120  * normal caching to bypass it's caching.  Therefore, we want to
121  * free up any cache space in use by the file, and throw out any
122  * existing VM pages for the file.  We keep track of the number of
123  * times we go back and forth from caching to bypass.
124  */
125 void
126 afs_TransitionToBypass(struct vcache *avc,
127                        afs_ucred_t *acred, int aflags)
128 {
129
130     afs_int32 code;
131     int setDesire = 0;
132     int setManual = 0;
133
134     if (!avc)
135         return;
136
137     if (aflags & TRANSChangeDesiredBit)
138         setDesire = 1;
139     if (aflags & TRANSSetManualBit)
140         setManual = 1;
141
142 #ifdef AFS_BOZONLOCK_ENV
143     afs_BozonLock(&avc->pvnLock, avc);  /* Since afs_TryToSmush will do a pvn_vptrunc */
144 #else
145     AFS_GLOCK();
146 #endif
147
148     ObtainWriteLock(&avc->lock, 925);
149     /*
150      * Someone may have beat us to doing the transition - we had no lock
151      * when we checked the flag earlier.  No cause to panic, just return.
152      */
153     if (avc->cachingStates & FCSBypass)
154         goto done;
155
156     /* If we never cached this, just change state */
157     if (setDesire && (!(avc->cachingStates & FCSBypass))) {
158         avc->cachingStates |= FCSBypass;
159         goto done;
160     }
161
162     /* cg2v, try to store any chunks not written 20071204 */
163     if (avc->execsOrWriters > 0) {
164         struct vrequest *treq = NULL;
165
166         code = afs_CreateReq(&treq, acred);
167         if (!code) {
168             code = afs_StoreAllSegments(avc, treq, AFS_SYNC | AFS_LASTSTORE);
169             afs_DestroyReq(treq);
170         }
171     }
172
173 #if 0
174     /* also cg2v, don't dequeue the callback */
175     ObtainWriteLock(&afs_xcbhash, 956);
176     afs_DequeueCallback(avc);
177     ReleaseWriteLock(&afs_xcbhash);
178 #endif
179     avc->f.states &= ~(CStatd | CDirty);      /* next reference will re-stat */
180     /* now find the disk cache entries */
181     afs_TryToSmush(avc, acred, 1);
182     osi_dnlc_purgedp(avc);
183     if (avc->linkData && !(avc->f.states & CCore)) {
184         afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
185         avc->linkData = NULL;
186     }
187
188     avc->cachingStates |= FCSBypass;    /* Set the bypass flag */
189     if(setDesire)
190         avc->cachingStates |= FCSDesireBypass;
191     if(setManual)
192         avc->cachingStates |= FCSManuallySet;
193     avc->cachingTransitions++;
194
195 done:
196     ReleaseWriteLock(&avc->lock);
197 #ifdef AFS_BOZONLOCK_ENV
198     afs_BozonUnlock(&avc->pvnLock, avc);
199 #else
200     AFS_GUNLOCK();
201 #endif
202 }
203
204 /*
205  * This is almost exactly like the PFlush() routine in afs_pioctl.c,
206  * but that routine is static.  We are about to change a file from
207  * bypassing caching to normal caching.  Therefore, we want to
208  * throw out any existing VM pages for the file.  We keep track of
209  * the number of times we go back and forth from caching to bypass.
210  */
211 void
212 afs_TransitionToCaching(struct vcache *avc,
213                         afs_ucred_t *acred,
214                         int aflags)
215 {
216     int resetDesire = 0;
217     int setManual = 0;
218
219     if (!avc)
220         return;
221
222     if (aflags & TRANSChangeDesiredBit)
223         resetDesire = 1;
224     if (aflags & TRANSSetManualBit)
225         setManual = 1;
226
227 #ifdef AFS_BOZONLOCK_ENV
228     afs_BozonLock(&avc->pvnLock, avc);  /* Since afs_TryToSmush will do a pvn_vptrunc */
229 #else
230     AFS_GLOCK();
231 #endif
232     ObtainWriteLock(&avc->lock, 926);
233     /*
234      * Someone may have beat us to doing the transition - we had no lock
235      * when we checked the flag earlier.  No cause to panic, just return.
236      */
237     if (!(avc->cachingStates & FCSBypass))
238         goto done;
239
240     /* Ok, we actually do need to flush */
241     ObtainWriteLock(&afs_xcbhash, 957);
242     afs_DequeueCallback(avc);
243     avc->f.states &= ~(CStatd | CDirty);        /* next reference will re-stat cache entry */
244     ReleaseWriteLock(&afs_xcbhash);
245     /* now find the disk cache entries */
246     afs_TryToSmush(avc, acred, 1);
247     osi_dnlc_purgedp(avc);
248     if (avc->linkData && !(avc->f.states & CCore)) {
249         afs_osi_Free(avc->linkData, strlen(avc->linkData) + 1);
250         avc->linkData = NULL;
251     }
252
253     avc->cachingStates &= ~(FCSBypass);    /* Reset the bypass flag */
254     if (resetDesire)
255         avc->cachingStates &= ~(FCSDesireBypass);
256     if (setManual)
257         avc->cachingStates |= FCSManuallySet;
258     avc->cachingTransitions++;
259
260 done:
261     ReleaseWriteLock(&avc->lock);
262 #ifdef AFS_BOZONLOCK_ENV
263     afs_BozonUnlock(&avc->pvnLock, avc);
264 #else
265     AFS_GUNLOCK();
266 #endif
267 }
268
269 /* In the case where there's an error in afs_NoCacheFetchProc or
270  * afs_PrefetchNoCache, all of the pages they've been passed need
271  * to be unlocked.
272  */
273 #ifdef UKERNEL
274 typedef void * bypass_page_t;
275
276 #define unlock_and_release_pages(auio)
277 #define release_full_page(pp, pageoff)
278
279 #else
280 typedef struct page * bypass_page_t;
281
282 #define unlock_and_release_pages(auio) \
283     do { \
284         struct iovec *ciov;     \
285         bypass_page_t pp; \
286         afs_int32 iovmax; \
287         afs_int32 iovno = 0; \
288         ciov = auio->uio_iov; \
289         iovmax = auio->uio_iovcnt - 1;  \
290         pp = (bypass_page_t) ciov->iov_base;    \
291         while(1) { \
292             if (pp) { \
293                 if (PageLocked(pp)) \
294                     unlock_page(pp);    \
295                 put_page(pp); /* decrement refcount */ \
296             } \
297             iovno++; \
298             if(iovno > iovmax) \
299                 break; \
300             ciov = (auio->uio_iov + iovno);     \
301             pp = (bypass_page_t) ciov->iov_base;        \
302         } \
303     } while(0)
304
305 #define release_full_page(pp, pageoff)                  \
306     do { \
307         /* this is appropriate when no caller intends to unlock \
308          * and release the page */ \
309         SetPageUptodate(pp); \
310         if(PageLocked(pp)) \
311             unlock_page(pp); \
312         else \
313             afs_warn("afs_NoCacheFetchProc: page not locked!\n"); \
314         put_page(pp); /* decrement refcount */ \
315     } while(0)
316 #endif
317
318 static void
319 afs_bypass_copy_page(bypass_page_t pp, int pageoff, struct iovec *rxiov,
320         int iovno, int iovoff, struct uio *auio, int curiov, int partial)
321 {
322     char *address;
323     int dolen;
324
325     if (partial)
326         dolen = auio->uio_iov[curiov].iov_len - pageoff;
327     else
328         dolen = rxiov[iovno].iov_len - iovoff;
329
330 #if !defined(UKERNEL)
331 # if defined(KMAP_ATOMIC_TAKES_NO_KM_TYPE)
332     address = kmap_atomic(pp);
333 # else
334     address = kmap_atomic(pp, KM_USER0);
335 # endif
336 #else
337     address = pp;
338 #endif
339     memcpy(address + pageoff, (char *)(rxiov[iovno].iov_base) + iovoff, dolen);
340 #if !defined(UKERNEL)
341 # if defined(KMAP_ATOMIC_TAKES_NO_KM_TYPE)
342     kunmap_atomic(address);
343 # else
344     kunmap_atomic(address, KM_USER0);
345 # endif
346 #endif
347 }
348
349 /* no-cache prefetch routine */
350 static afs_int32
351 afs_NoCacheFetchProc(struct rx_call *acall,
352                      struct vcache *avc,
353                      struct uio *auio,
354                      afs_int32 release_pages,
355                      afs_int32 size)
356 {
357     afs_int32 length;
358     afs_int32 code;
359     int moredata, iovno, iovoff, iovmax, result, locked;
360     struct iovec *ciov;
361     struct iovec *rxiov;
362     int nio = 0;
363     bypass_page_t pp;
364
365     int curpage, bytes;
366     int pageoff;
367
368     rxiov = osi_AllocSmallSpace(sizeof(struct iovec) * RX_MAXIOVECS);
369     ciov = auio->uio_iov;
370     pp = (bypass_page_t) ciov->iov_base;
371     iovmax = auio->uio_iovcnt - 1;
372     iovno = iovoff = result = 0;
373
374     do {
375         COND_GUNLOCK(locked);
376         code = rx_Read(acall, (char *)&length, sizeof(afs_int32));
377         COND_RE_GLOCK(locked);
378         if (code != sizeof(afs_int32)) {
379             result = EIO;
380             afs_warn("Preread error. code: %d instead of %d\n",
381                 code, (int)sizeof(afs_int32));
382             unlock_and_release_pages(auio);
383             goto done;
384         } else
385             length = ntohl(length);
386
387         if (length > size) {
388             result = EIO;
389             afs_warn("Preread error. Got length %d, which is greater than size %d\n",
390                      length, size);
391             unlock_and_release_pages(auio);
392             goto done;
393         }
394
395         /* If we get a 0 length reply, time to cleanup and return */
396         if (length == 0) {
397             unlock_and_release_pages(auio);
398             result = 0;
399             goto done;
400         }
401
402         /*
403          * The fetch protocol is extended for the AFS/DFS translator
404          * to allow multiple blocks of data, each with its own length,
405          * to be returned. As long as the top bit is set, there are more
406          * blocks expected.
407          *
408          * We do not do this for AFS file servers because they sometimes
409          * return large negative numbers as the transfer size.
410          */
411         if (avc->f.states & CForeign) {
412             moredata = length & 0x80000000;
413             length &= ~0x80000000;
414         } else {
415             moredata = 0;
416         }
417
418         for (curpage = 0; curpage <= iovmax; curpage++) {
419             pageoff = 0;
420             /* properly, this should track uio_resid, not a fixed page size! */
421             while (pageoff < auio->uio_iov[curpage].iov_len) {
422                 /* If no more iovs, issue new read. */
423                 if (iovno >= nio) {
424                     COND_GUNLOCK(locked);
425                     bytes = rx_Readv(acall, rxiov, &nio, RX_MAXIOVECS, length);
426                     COND_RE_GLOCK(locked);
427                     if (bytes < 0) {
428                         afs_warn("afs_NoCacheFetchProc: rx_Read error. Return code was %d\n", bytes);
429                         result = bytes;
430                         unlock_and_release_pages(auio);
431                         goto done;
432                     } else if (bytes == 0) {
433                         /* we failed to read the full length */
434                         result = EIO;
435                         afs_warn("afs_NoCacheFetchProc: rx_Read returned zero. Aborting.\n");
436                         unlock_and_release_pages(auio);
437                         goto done;
438                     }
439                     size -= bytes;
440                     auio->uio_resid -= bytes;
441                     iovno = 0;
442                 }
443                 pp = (bypass_page_t)auio->uio_iov[curpage].iov_base;
444                 if (pageoff + (rxiov[iovno].iov_len - iovoff) <= auio->uio_iov[curpage].iov_len) {
445                     /* Copy entire (or rest of) current iovec into current page */
446                     if (pp)
447                         afs_bypass_copy_page(pp, pageoff, rxiov, iovno, iovoff, auio, curpage, 0);
448                     length -= (rxiov[iovno].iov_len - iovoff);
449                     pageoff += rxiov[iovno].iov_len - iovoff;
450                     iovno++;
451                     iovoff = 0;
452                 } else {
453                     /* Copy only what's needed to fill current page */
454                     if (pp)
455                         afs_bypass_copy_page(pp, pageoff, rxiov, iovno, iovoff, auio, curpage, 1);
456                     length -= (auio->uio_iov[curpage].iov_len - pageoff);
457                     iovoff += auio->uio_iov[curpage].iov_len - pageoff;
458                     pageoff = auio->uio_iov[curpage].iov_len;
459                 }
460
461                 /* we filled a page, or this is the last page.  conditionally release it */
462                 if (pp && ((pageoff == auio->uio_iov[curpage].iov_len &&
463                             release_pages) || (length == 0 && iovno >= nio)))
464                     release_full_page(pp, pageoff);
465
466                 if (length == 0 && iovno >= nio)
467                     goto done;
468             }
469         }
470     } while (moredata);
471
472 done:
473     osi_FreeSmallSpace(rxiov);
474     return result;
475 }
476
477
478 /* dispatch a no-cache read request */
479 afs_int32
480 afs_ReadNoCache(struct vcache *avc,
481                 struct nocache_read_request *bparms,
482                 afs_ucred_t *acred)
483 {
484     afs_int32 code;
485     afs_int32 bcnt;
486     struct brequest *breq;
487     struct vrequest *areq = NULL;
488
489     if (avc->vc_error) {
490         code = EIO;
491         afs_warn("afs_ReadNoCache VCache Error!\n");
492         goto cleanup;
493     }
494
495     AFS_GLOCK();
496     /* the receiver will free areq */
497     code = afs_CreateReq(&areq, acred);
498     if (code) {
499         afs_warn("afs_ReadNoCache afs_CreateReq error!\n");
500     } else {
501         code = afs_VerifyVCache(avc, areq);
502         if (code) {
503             afs_warn("afs_ReadNoCache Failed to verify VCache!\n");
504         }
505     }
506     AFS_GUNLOCK();
507
508     if (code) {
509         code = afs_CheckCode(code, areq, 11);   /* failed to get it */
510         goto cleanup;
511     }
512
513     bparms->areq = areq;
514
515     /* and queue this one */
516     bcnt = 1;
517     AFS_GLOCK();
518     while(bcnt < 20) {
519         breq = afs_BQueue(BOP_FETCH_NOCACHE, avc, B_DONTWAIT, 0, acred, 1, 1,
520                           bparms, (void *)0, (void *)0);
521         if(breq != 0) {
522             code = 0;
523             break;
524         }
525         afs_osi_Wait(10 * bcnt, 0, 0);
526     }
527     AFS_GUNLOCK();
528
529     if(!breq) {
530         code = EBUSY;
531         goto cleanup;
532     }
533
534     return code;
535
536 cleanup:
537     /* If there's a problem before we queue the request, we need to
538      * do everything that would normally happen when the request was
539      * processed, like unlocking the pages and freeing memory.
540      */
541     unlock_and_release_pages(bparms->auio);
542     AFS_GLOCK();
543     afs_DestroyReq(areq);
544     AFS_GUNLOCK();
545     osi_Free(bparms->auio->uio_iov,
546              bparms->auio->uio_iovcnt * sizeof(struct iovec));
547     osi_Free(bparms->auio, sizeof(struct uio));
548     osi_Free(bparms, sizeof(struct nocache_read_request));
549     return code;
550 }
551
552
553 /* Cannot have static linkage--called from BPrefetch (afs_daemons) */
554 afs_int32
555 afs_PrefetchNoCache(struct vcache *avc,
556                     afs_ucred_t *acred,
557                     struct nocache_read_request *bparms)
558 {
559     struct uio *auio;
560 #ifndef UKERNEL
561     struct iovec *iovecp;
562 #endif
563     struct vrequest *areq;
564     afs_int32 code = 0;
565     struct rx_connection *rxconn;
566 #ifdef AFS_64BIT_CLIENT
567     afs_int32 length_hi, bytes, locked;
568 #endif
569
570     struct afs_conn *tc;
571     struct rx_call *tcall;
572     struct tlocal1 {
573         struct AFSVolSync tsync;
574         struct AFSFetchStatus OutStatus;
575         struct AFSCallBack CallBack;
576     };
577     struct tlocal1 *tcallspec;
578
579     auio = bparms->auio;
580     areq = bparms->areq;
581 #ifndef UKERNEL
582     iovecp = auio->uio_iov;
583 #endif
584
585     tcallspec = osi_Alloc(sizeof(struct tlocal1));
586     do {
587         tc = afs_Conn(&avc->f.fid, areq, SHARED_LOCK /* ignored */, &rxconn);
588         if (tc) {
589             avc->callback = tc->parent->srvr->server;
590             tcall = rx_NewCall(rxconn);
591 #ifdef AFS_64BIT_CLIENT
592             if (!afs_serverHasNo64Bit(tc)) {
593                 code = StartRXAFS_FetchData64(tcall,
594                                               (struct AFSFid *) &avc->f.fid.Fid,
595                                               auio->uio_offset,
596                                               bparms->length);
597                 if (code == 0) {
598                     COND_GUNLOCK(locked);
599                     bytes = rx_Read(tcall, (char *)&length_hi,
600                                     sizeof(afs_int32));
601                     COND_RE_GLOCK(locked);
602
603                     if (bytes != sizeof(afs_int32)) {
604                         length_hi = 0;
605                         COND_GUNLOCK(locked);
606                         code = rx_EndCall(tcall, RX_PROTOCOL_ERROR);
607                         COND_RE_GLOCK(locked);
608                         tcall = NULL;
609                     }
610                 }
611             } /* afs_serverHasNo64Bit */
612             if (code == RXGEN_OPCODE || afs_serverHasNo64Bit(tc)) {
613                 if (auio->uio_offset > 0x7FFFFFFF) {
614                     code = EFBIG;
615                 } else {
616                     afs_int32 pos;
617                     pos = auio->uio_offset;
618                     COND_GUNLOCK(locked);
619                     if (!tcall)
620                         tcall = rx_NewCall(rxconn);
621                     code = StartRXAFS_FetchData(tcall,
622                                         (struct AFSFid *) &avc->f.fid.Fid,
623                                         pos, bparms->length);
624                     COND_RE_GLOCK(locked);
625                 }
626                 afs_serverSetNo64Bit(tc);
627             }
628 #else
629             code = StartRXAFS_FetchData(tcall,
630                                         (struct AFSFid *) &avc->f.fid.Fid,
631                                         auio->uio_offset, bparms->length);
632 #endif
633             if (code == 0) {
634                 code = afs_NoCacheFetchProc(tcall, avc, auio,
635                                             1 /* release_pages */,
636                                             bparms->length);
637             } else {
638                 afs_warn("BYPASS: StartRXAFS_FetchData failed: %d\n", code);
639                 unlock_and_release_pages(auio);
640                 goto done;
641             }
642             if (code == 0) {
643                 code = EndRXAFS_FetchData(tcall, &tcallspec->OutStatus,
644                                           &tcallspec->CallBack,
645                                           &tcallspec->tsync);
646             } else {
647                 afs_warn("BYPASS: NoCacheFetchProc failed: %d\n", code);
648             }
649             code = rx_EndCall(tcall, code);
650         } else {
651             afs_warn("BYPASS: No connection.\n");
652             code = -1;
653             unlock_and_release_pages(auio);
654             goto done;
655         }
656     } while (afs_Analyze(tc, rxconn, code, &avc->f.fid, areq,
657                                                  AFS_STATS_FS_RPCIDX_FETCHDATA,
658                                                  SHARED_LOCK,0));
659 done:
660     /*
661      * Copy appropriate fields into vcache
662      */
663
664     if (!code)
665         afs_ProcessFS(avc, &tcallspec->OutStatus, areq);
666
667     osi_Free(areq, sizeof(struct vrequest));
668     osi_Free(tcallspec, sizeof(struct tlocal1));
669     osi_Free(bparms, sizeof(struct nocache_read_request));
670 #ifndef UKERNEL
671     /* in UKERNEL, the "pages" are passed in */
672     osi_Free(iovecp, auio->uio_iovcnt * sizeof(struct iovec));
673     osi_Free(auio, sizeof(struct uio));
674 #endif
675     return code;
676 }
677 #endif