kernel - Fix improper use of CMSG_ALIGN() in unp_internalize()
[dragonfly.git] / sbin / fsck / inode.c
CommitLineData
984263bc
MD
1/*
2 * Copyright (c) 1980, 1986, 1993
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
dc71b7ab 13 * 3. Neither the name of the University nor the names of its contributors
984263bc
MD
14 * may be used to endorse or promote products derived from this software
15 * without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
18 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
21 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
1de703da
MD
28 *
29 * @(#)inode.c 8.8 (Berkeley) 4/28/95
30 * $FreeBSD: src/sbin/fsck/inode.c,v 1.20 2000/02/28 20:02:41 mckusick Exp $
984263bc
MD
31 */
32
984263bc
MD
33#include <sys/param.h>
34#include <sys/time.h>
35
38a690d7
MD
36#include <vfs/ufs/dinode.h>
37#include <vfs/ufs/dir.h>
38#include <vfs/ufs/fs.h>
984263bc
MD
39
40#include <err.h>
41#include <pwd.h>
42#include <string.h>
43
44#include "fsck.h"
f2c50142 45#include "memzone.h"
984263bc 46
f2c50142 47static ufs1_ino_t startinum;
984263bc 48
9a76cd75 49static int iblock(struct inodesc *, long ilevel, quad_t isize);
984263bc
MD
50
51int
67ad9090 52ckinode(struct ufs1_dinode *dp, struct inodesc *idesc)
984263bc
MD
53{
54 ufs_daddr_t *ap;
55 int ret;
56 long n, ndb, offset;
67ad9090 57 struct ufs1_dinode dino;
984263bc
MD
58 quad_t remsize, sizepb;
59 mode_t mode;
60 char pathbuf[MAXPATHLEN + 1];
61
62 if (idesc->id_fix != IGNORE)
63 idesc->id_fix = DONTKNOW;
64 idesc->id_entryno = 0;
65 idesc->id_filesize = dp->di_size;
66 mode = dp->di_mode & IFMT;
67 if (mode == IFBLK || mode == IFCHR || (mode == IFLNK &&
68 dp->di_size < (unsigned)sblock.fs_maxsymlinklen))
69 return (KEEPON);
70 dino = *dp;
71 ndb = howmany(dino.di_size, sblock.fs_bsize);
c309c6d4 72 for (ap = &dino.di_db[0]; ap < &dino.di_db[UFS_NDADDR]; ap++) {
984263bc
MD
73 if (--ndb == 0 && (offset = blkoff(&sblock, dino.di_size)) != 0)
74 idesc->id_numfrags =
75 numfrags(&sblock, fragroundup(&sblock, offset));
76 else
77 idesc->id_numfrags = sblock.fs_frag;
78 if (*ap == 0) {
79 if (idesc->id_type == DATA && ndb >= 0) {
80 /* An empty block in a directory XXX */
81 getpathname(pathbuf, idesc->id_number,
82 idesc->id_number);
83 pfatal("DIRECTORY %s: CONTAINS EMPTY BLOCKS",
84 pathbuf);
85 if (reply("ADJUST LENGTH") == 1) {
86 dp = ginode(idesc->id_number);
87 dp->di_size = (ap - &dino.di_db[0]) *
88 sblock.fs_bsize;
89 printf(
90 "YOU MUST RERUN FSCK AFTERWARDS\n");
91 rerun = 1;
92 inodirty();
93
94 }
95 }
96 continue;
97 }
98 idesc->id_blkno = *ap;
99 if (idesc->id_type == ADDR)
100 ret = (*idesc->id_func)(idesc);
101 else
102 ret = dirscan(idesc);
103 if (ret & STOP)
104 return (ret);
105 }
106 idesc->id_numfrags = sblock.fs_frag;
c309c6d4 107 remsize = dino.di_size - sblock.fs_bsize * UFS_NDADDR;
984263bc 108 sizepb = sblock.fs_bsize;
c309c6d4 109 for (ap = &dino.di_ib[0], n = 1; n <= UFS_NIADDR; ap++, n++) {
984263bc
MD
110 if (*ap) {
111 idesc->id_blkno = *ap;
112 ret = iblock(idesc, n, remsize);
113 if (ret & STOP)
114 return (ret);
115 } else {
116 if (idesc->id_type == DATA && remsize > 0) {
117 /* An empty block in a directory XXX */
118 getpathname(pathbuf, idesc->id_number,
119 idesc->id_number);
120 pfatal("DIRECTORY %s: CONTAINS EMPTY BLOCKS",
121 pathbuf);
122 if (reply("ADJUST LENGTH") == 1) {
123 dp = ginode(idesc->id_number);
124 dp->di_size -= remsize;
125 remsize = 0;
126 printf(
127 "YOU MUST RERUN FSCK AFTERWARDS\n");
128 rerun = 1;
129 inodirty();
130 break;
131 }
132 }
133 }
134 sizepb *= NINDIR(&sblock);
135 remsize -= sizepb;
136 }
137 return (KEEPON);
138}
139
140static int
b5744197 141iblock(struct inodesc *idesc, long ilevel, quad_t isize)
984263bc
MD
142{
143 ufs_daddr_t *ap;
144 ufs_daddr_t *aplim;
145 struct bufarea *bp;
146 int i, n, (*func)(), nif;
147 quad_t sizepb;
148 char buf[BUFSIZ];
149 char pathbuf[MAXPATHLEN + 1];
67ad9090 150 struct ufs1_dinode *dp;
984263bc
MD
151
152 if (idesc->id_type == ADDR) {
153 func = idesc->id_func;
154 if (((n = (*func)(idesc)) & KEEPON) == 0)
155 return (n);
156 } else
157 func = dirscan;
158 if (chkrange(idesc->id_blkno, idesc->id_numfrags))
159 return (SKIP);
160 bp = getdatablk(idesc->id_blkno, sblock.fs_bsize);
161 ilevel--;
162 for (sizepb = sblock.fs_bsize, i = 0; i < ilevel; i++)
163 sizepb *= NINDIR(&sblock);
164 nif = howmany(isize , sizepb);
165 if (nif > NINDIR(&sblock))
166 nif = NINDIR(&sblock);
167 if (idesc->id_func == pass1check && nif < NINDIR(&sblock)) {
168 aplim = &bp->b_un.b_indir[NINDIR(&sblock)];
169 for (ap = &bp->b_un.b_indir[nif]; ap < aplim; ap++) {
170 if (*ap == 0)
171 continue;
7cee7052 172 sprintf(buf, "PARTIALLY TRUNCATED INODE I=%lu",
984263bc
MD
173 (u_long)idesc->id_number);
174 if (dofix(idesc, buf)) {
175 *ap = 0;
176 dirty(bp);
177 }
178 }
179 flush(fswritefd, bp);
180 }
181 aplim = &bp->b_un.b_indir[nif];
182 for (ap = bp->b_un.b_indir; ap < aplim; ap++) {
183 if (*ap) {
184 idesc->id_blkno = *ap;
185 if (ilevel == 0)
186 n = (*func)(idesc);
187 else
188 n = iblock(idesc, ilevel, isize);
189 if (n & STOP) {
190 bp->b_flags &= ~B_INUSE;
191 return (n);
192 }
193 } else {
194 if (idesc->id_type == DATA && isize > 0) {
195 /* An empty block in a directory XXX */
196 getpathname(pathbuf, idesc->id_number,
197 idesc->id_number);
198 pfatal("DIRECTORY %s: CONTAINS EMPTY BLOCKS",
199 pathbuf);
200 if (reply("ADJUST LENGTH") == 1) {
201 dp = ginode(idesc->id_number);
202 dp->di_size -= isize;
203 isize = 0;
204 printf(
205 "YOU MUST RERUN FSCK AFTERWARDS\n");
206 rerun = 1;
207 inodirty();
208 bp->b_flags &= ~B_INUSE;
209 return(STOP);
210 }
211 }
212 }
213 isize -= sizepb;
214 }
215 bp->b_flags &= ~B_INUSE;
216 return (KEEPON);
217}
218
219/*
220 * Check that a block in a legal block number.
221 * Return 0 if in range, 1 if out of range.
222 */
223int
b5744197 224chkrange(ufs_daddr_t blk, int cnt)
984263bc 225{
feb65525 226 int c;
984263bc
MD
227
228 if (cnt <= 0 || blk <= 0 || blk > maxfsblock ||
229 cnt - 1 > maxfsblock - blk)
230 return (1);
231 if (cnt > sblock.fs_frag ||
232 fragnum(&sblock, blk) + cnt > sblock.fs_frag) {
233 if (debug)
8af0d623
JS
234 printf("bad size: blk %ld, offset %d, size %d\n",
235 (long)blk, fragnum(&sblock, blk), cnt);
984263bc
MD
236 return (1);
237 }
238 c = dtog(&sblock, blk);
239 if (blk < cgdmin(&sblock, c)) {
240 if ((blk + cnt) > cgsblock(&sblock, c)) {
241 if (debug) {
242 printf("blk %ld < cgdmin %ld;",
243 (long)blk, (long)cgdmin(&sblock, c));
244 printf(" blk + cnt %ld > cgsbase %ld\n",
245 (long)(blk + cnt),
246 (long)cgsblock(&sblock, c));
247 }
248 return (1);
249 }
250 } else {
251 if ((blk + cnt) > cgbase(&sblock, c+1)) {
252 if (debug) {
253 printf("blk %ld >= cgdmin %ld;",
254 (long)blk, (long)cgdmin(&sblock, c));
255 printf(" blk + cnt %ld > sblock.fs_fpg %ld\n",
256 (long)(blk + cnt), (long)sblock.fs_fpg);
257 }
258 return (1);
259 }
260 }
261 return (0);
262}
263
264/*
265 * General purpose interface for reading inodes.
266 */
67ad9090 267struct ufs1_dinode *
f2c50142 268ginode(ufs1_ino_t inumber)
984263bc
MD
269{
270 ufs_daddr_t iblk;
271
c309c6d4 272 if (inumber < UFS_ROOTINO || inumber > maxino)
984263bc
MD
273 errx(EEXIT, "bad inode number %d to ginode", inumber);
274 if (startinum == 0 ||
275 inumber < startinum || inumber >= startinum + INOPB(&sblock)) {
276 iblk = ino_to_fsba(&sblock, inumber);
277 if (pbp != 0)
278 pbp->b_flags &= ~B_INUSE;
279 pbp = getdatablk(iblk, sblock.fs_bsize);
280 startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
281 }
282 return (&pbp->b_un.b_dinode[inumber % INOPB(&sblock)]);
283}
284
285/*
286 * Special purpose version of ginode used to optimize first pass
287 * over all the inodes in numerical order.
288 */
f2c50142 289ufs1_ino_t nextino, lastinum;
984263bc 290long readcnt, readpercg, fullcnt, inobufsize, partialcnt, partialsize;
67ad9090 291struct ufs1_dinode *inodebuf;
984263bc 292
67ad9090 293struct ufs1_dinode *
f2c50142 294getnextinode(ufs1_ino_t inumber)
984263bc
MD
295{
296 long size;
297 ufs_daddr_t dblk;
67ad9090 298 static struct ufs1_dinode *dp;
984263bc
MD
299
300 if (inumber != nextino++ || inumber > maxino)
301 errx(EEXIT, "bad inode number %d to nextinode", inumber);
302 if (inumber >= lastinum) {
303 readcnt++;
304 dblk = fsbtodb(&sblock, ino_to_fsba(&sblock, lastinum));
305 if (readcnt % readpercg == 0) {
306 size = partialsize;
307 lastinum += partialcnt;
308 } else {
309 size = inobufsize;
310 lastinum += fullcnt;
311 }
312 /*
313 * If bread returns an error, it will already have zeroed
314 * out the buffer, so we do not need to do so here.
315 */
7cee7052 316 bread(fsreadfd, (char *)inodebuf, dblk, size);
984263bc
MD
317 dp = inodebuf;
318 }
319 return (dp++);
320}
321
322void
f2c50142 323setinodebuf(ufs1_ino_t inum)
984263bc
MD
324{
325
326 if (inum % sblock.fs_ipg != 0)
327 errx(EEXIT, "bad inode number %d to setinodebuf", inum);
328 startinum = 0;
329 nextino = inum;
330 lastinum = inum;
331 readcnt = 0;
332 if (inodebuf != NULL)
333 return;
334 inobufsize = blkroundup(&sblock, INOBUFSIZE);
67ad9090 335 fullcnt = inobufsize / sizeof(struct ufs1_dinode);
984263bc
MD
336 readpercg = sblock.fs_ipg / fullcnt;
337 partialcnt = sblock.fs_ipg % fullcnt;
67ad9090 338 partialsize = partialcnt * sizeof(struct ufs1_dinode);
984263bc
MD
339 if (partialcnt != 0) {
340 readpercg++;
341 } else {
342 partialcnt = fullcnt;
343 partialsize = inobufsize;
344 }
67ad9090 345 if ((inodebuf = (struct ufs1_dinode *)malloc((unsigned)inobufsize)) == NULL)
984263bc
MD
346 errx(EEXIT, "cannot allocate space for inode buffer");
347}
348
349void
b5744197 350freeinodebuf(void)
984263bc
MD
351{
352
353 if (inodebuf != NULL)
354 free((char *)inodebuf);
355 inodebuf = NULL;
356}
357
358/*
359 * Routines to maintain information about directory inodes.
360 * This is built during the first pass and used during the
361 * second and third passes.
362 *
363 * Enter inodes into the cache.
364 */
f2c50142
MD
365static struct memzone inoinfo_zone;
366
984263bc 367void
f2c50142 368cacheino(struct ufs1_dinode *dp, ufs1_ino_t inumber)
984263bc 369{
feb65525 370 struct inoinfo *inp;
984263bc
MD
371 struct inoinfo **inpp;
372 int blks;
373
374 blks = howmany(dp->di_size, sblock.fs_bsize);
c309c6d4
SW
375 if (blks > UFS_NDADDR)
376 blks = UFS_NDADDR + UFS_NIADDR;
f2c50142
MD
377 inp = mzalloc(&inoinfo_zone,
378 sizeof(*inp) + (blks - 1) * sizeof(ufs_daddr_t));
984263bc
MD
379 if (inp == NULL)
380 errx(EEXIT, "cannot increase directory list");
b13267a5 381 inpp = &inphead[DIRHASH(inumber)];
984263bc
MD
382 inp->i_nexthash = *inpp;
383 *inpp = inp;
c309c6d4 384 inp->i_parent = inumber == UFS_ROOTINO ? UFS_ROOTINO : (ufs1_ino_t)0;
f2c50142 385 inp->i_dotdot = (ufs1_ino_t)0;
984263bc
MD
386 inp->i_number = inumber;
387 inp->i_isize = dp->di_size;
388 inp->i_numblks = blks * sizeof(ufs_daddr_t);
389 memmove(&inp->i_blks[0], &dp->di_db[0], (size_t)inp->i_numblks);
390 if (inplast == listmax) {
391 listmax += 100;
392 inpsort = (struct inoinfo **)realloc((char *)inpsort,
393 (unsigned)listmax * sizeof(struct inoinfo *));
394 if (inpsort == NULL)
395 errx(EEXIT, "cannot increase directory list");
396 }
397 inpsort[inplast++] = inp;
398}
399
400/*
401 * Look up an inode cache structure.
402 */
403struct inoinfo *
f2c50142 404getinoinfo(ufs1_ino_t inumber)
984263bc 405{
feb65525 406 struct inoinfo *inp;
984263bc 407
b13267a5 408 for (inp = inphead[DIRHASH(inumber)]; inp; inp = inp->i_nexthash) {
984263bc
MD
409 if (inp->i_number != inumber)
410 continue;
411 return (inp);
412 }
413 errx(EEXIT, "cannot find inode %d", inumber);
60233e58 414 return (NULL);
984263bc
MD
415}
416
417/*
418 * Clean up all the inode cache structure.
419 */
420void
b5744197 421inocleanup(void)
984263bc 422{
984263bc
MD
423 if (inphead == NULL)
424 return;
f2c50142 425 mzpurge(&inoinfo_zone);
984263bc
MD
426 free((char *)inphead);
427 free((char *)inpsort);
428 inphead = inpsort = NULL;
429}
430
431void
b5744197 432inodirty(void)
984263bc
MD
433{
434
435 dirty(pbp);
436}
437
438void
feb65525 439clri(struct inodesc *idesc, char *type, int flag)
984263bc 440{
67ad9090 441 struct ufs1_dinode *dp;
984263bc
MD
442
443 dp = ginode(idesc->id_number);
444 if (flag == 1) {
445 pwarn("%s %s", type,
446 (dp->di_mode & IFMT) == IFDIR ? "DIR" : "FILE");
447 pinode(idesc->id_number);
448 }
449 if (preen || reply("CLEAR") == 1) {
450 if (preen)
451 printf(" (CLEARED)\n");
452 n_files--;
7cee7052 453 ckinode(dp, idesc);
984263bc
MD
454 clearinode(dp);
455 inoinfo(idesc->id_number)->ino_state = USTATE;
456 inodirty();
457 }
458}
459
460int
b5744197 461findname(struct inodesc *idesc)
984263bc 462{
feb65525 463 struct direct *dirp = idesc->id_dirp;
984263bc
MD
464
465 if (dirp->d_ino != idesc->id_parent || idesc->id_entryno < 2) {
466 idesc->id_entryno++;
467 return (KEEPON);
468 }
469 memmove(idesc->id_name, dirp->d_name, (size_t)dirp->d_namlen + 1);
470 return (STOP|FOUND);
471}
472
473int
b5744197 474findino(struct inodesc *idesc)
984263bc 475{
feb65525 476 struct direct *dirp = idesc->id_dirp;
984263bc
MD
477
478 if (dirp->d_ino == 0)
479 return (KEEPON);
480 if (strcmp(dirp->d_name, idesc->id_name) == 0 &&
c309c6d4 481 dirp->d_ino >= UFS_ROOTINO && dirp->d_ino <= maxino) {
984263bc
MD
482 idesc->id_parent = dirp->d_ino;
483 return (STOP|FOUND);
484 }
485 return (KEEPON);
486}
487
488int
b5744197 489clearentry(struct inodesc *idesc)
984263bc 490{
feb65525 491 struct direct *dirp = idesc->id_dirp;
984263bc
MD
492
493 if (dirp->d_ino != idesc->id_parent || idesc->id_entryno < 2) {
494 idesc->id_entryno++;
495 return (KEEPON);
496 }
497 dirp->d_ino = 0;
498 return (STOP|FOUND|ALTERED);
499}
500
501void
f2c50142 502pinode(ufs1_ino_t ino)
984263bc 503{
67ad9090 504 struct ufs1_dinode *dp;
feb65525 505 char *p;
984263bc
MD
506 struct passwd *pw;
507 time_t t;
508
509 printf(" I=%lu ", (u_long)ino);
c309c6d4 510 if (ino < UFS_ROOTINO || ino > maxino)
984263bc
MD
511 return;
512 dp = ginode(ino);
513 printf(" OWNER=");
678e8cc6 514 if ((pw = getpwuid((int)dp->di_uid)) != NULL)
984263bc
MD
515 printf("%s ", pw->pw_name);
516 else
517 printf("%u ", (unsigned)dp->di_uid);
518 printf("MODE=%o\n", dp->di_mode);
519 if (preen)
520 printf("%s: ", cdevname);
a3e9bf8f 521 printf("SIZE=%ju ", (uintmax_t)dp->di_size);
984263bc
MD
522 t = dp->di_mtime;
523 p = ctime(&t);
524 printf("MTIME=%12.12s %4.4s ", &p[4], &p[20]);
525}
526
527void
f2c50142 528blkerror(ufs1_ino_t ino, char *type, ufs_daddr_t blk)
984263bc
MD
529{
530
a3e9bf8f 531 pfatal("%d %s I=%u", blk, type, ino);
984263bc
MD
532 printf("\n");
533 switch (inoinfo(ino)->ino_state) {
534
535 case FSTATE:
536 inoinfo(ino)->ino_state = FCLEAR;
537 return;
538
539 case DSTATE:
540 inoinfo(ino)->ino_state = DCLEAR;
541 return;
542
543 case FCLEAR:
544 case DCLEAR:
545 return;
546
547 default:
548 errx(EEXIT, "BAD STATE %d TO BLKERR", inoinfo(ino)->ino_state);
549 /* NOTREACHED */
550 }
551}
552
553/*
554 * allocate an unused inode
555 */
f2c50142
MD
556ufs1_ino_t
557allocino(ufs1_ino_t request, int type)
984263bc 558{
f2c50142 559 ufs1_ino_t ino;
67ad9090 560 struct ufs1_dinode *dp;
984263bc
MD
561 struct cg *cgp = &cgrp;
562 int cg;
563
564 if (request == 0)
c309c6d4 565 request = UFS_ROOTINO;
984263bc
MD
566 else if (inoinfo(request)->ino_state != USTATE)
567 return (0);
568 for (ino = request; ino < maxino; ino++)
569 if (inoinfo(ino)->ino_state == USTATE)
570 break;
571 if (ino == maxino)
572 return (0);
573 cg = ino_to_cg(&sblock, ino);
574 getblk(&cgblk, cgtod(&sblock, cg), sblock.fs_cgsize);
575 if (!cg_chkmagic(cgp))
576 pfatal("CG %d: BAD MAGIC NUMBER\n", cg);
577 setbit(cg_inosused(cgp), ino % sblock.fs_ipg);
578 cgp->cg_cs.cs_nifree--;
579 switch (type & IFMT) {
580 case IFDIR:
581 inoinfo(ino)->ino_state = DSTATE;
582 cgp->cg_cs.cs_ndir++;
583 break;
584 case IFREG:
585 case IFLNK:
586 inoinfo(ino)->ino_state = FSTATE;
587 break;
588 default:
589 return (0);
590 }
591 cgdirty();
592 dp = ginode(ino);
593 dp->di_db[0] = allocblk((long)1);
594 if (dp->di_db[0] == 0) {
595 inoinfo(ino)->ino_state = USTATE;
596 return (0);
597 }
598 dp->di_mode = type;
599 dp->di_flags = 0;
600 dp->di_atime = time(NULL);
601 dp->di_mtime = dp->di_ctime = dp->di_atime;
602 dp->di_mtimensec = dp->di_ctimensec = dp->di_atimensec = 0;
603 dp->di_size = sblock.fs_fsize;
604 dp->di_blocks = btodb(sblock.fs_fsize);
605 n_files++;
606 inodirty();
607 if (newinofmt)
608 inoinfo(ino)->ino_type = IFTODT(type);
609 return (ino);
610}
611
612/*
613 * deallocate an inode
614 */
615void
f2c50142 616freeino(ufs1_ino_t ino)
984263bc
MD
617{
618 struct inodesc idesc;
67ad9090 619 struct ufs1_dinode *dp;
984263bc
MD
620
621 memset(&idesc, 0, sizeof(struct inodesc));
622 idesc.id_type = ADDR;
623 idesc.id_func = pass4check;
624 idesc.id_number = ino;
625 dp = ginode(ino);
7cee7052 626 ckinode(dp, &idesc);
984263bc
MD
627 clearinode(dp);
628 inodirty();
629 inoinfo(ino)->ino_state = USTATE;
630 n_files--;
631}