mirror of
https://github.com/opnsense/src.git
synced 2026-06-11 09:41:03 -04:00
Make fsck_ffs more persistent in creating a lost+found directory.
(cherry picked from commit 84a0e3f957)
Sponsored by: Netflix
This commit is contained in:
parent
cd19218566
commit
501b4fb50e
3 changed files with 19 additions and 8 deletions
|
|
@ -801,6 +801,8 @@ allocdir(ino_t parent, ino_t request, int mode)
|
|||
struct dirtemplate *dirp;
|
||||
|
||||
ino = allocino(request, IFDIR|mode);
|
||||
if (ino == 0)
|
||||
return (0);
|
||||
dirp = &dirhead;
|
||||
dirp->dot_ino = ino;
|
||||
dirp->dotdot_ino = parent;
|
||||
|
|
|
|||
|
|
@ -1048,8 +1048,10 @@ allocblk(long frags)
|
|||
cg = dtog(&sblock, i + j);
|
||||
cgbp = cglookup(cg);
|
||||
cgp = cgbp->b_un.b_cg;
|
||||
if (!check_cgmagic(cg, cgbp, 0))
|
||||
return (0);
|
||||
if (!check_cgmagic(cg, cgbp, 0)) {
|
||||
i = (cg + 1) * sblock.fs_fpg - sblock.fs_frag;
|
||||
continue;
|
||||
}
|
||||
baseblk = dtogd(&sblock, i + j);
|
||||
for (k = 0; k < frags; k++) {
|
||||
setbmap(i + j + k);
|
||||
|
|
|
|||
|
|
@ -902,22 +902,29 @@ allocino(ino_t request, int type)
|
|||
union dinode *dp;
|
||||
struct bufarea *cgbp;
|
||||
struct cg *cgp;
|
||||
int cg;
|
||||
int cg, anyino;
|
||||
|
||||
if (request == 0)
|
||||
anyino = 0;
|
||||
if (request == 0) {
|
||||
request = UFS_ROOTINO;
|
||||
else if (inoinfo(request)->ino_state != USTATE)
|
||||
anyino = 1;
|
||||
} else if (inoinfo(request)->ino_state != USTATE)
|
||||
return (0);
|
||||
retry:
|
||||
for (ino = request; ino < maxino; ino++)
|
||||
if (inoinfo(ino)->ino_state == USTATE)
|
||||
break;
|
||||
if (ino == maxino)
|
||||
if (ino >= maxino)
|
||||
return (0);
|
||||
cg = ino_to_cg(&sblock, ino);
|
||||
cgbp = cglookup(cg);
|
||||
cgp = cgbp->b_un.b_cg;
|
||||
if (!check_cgmagic(cg, cgbp, 0))
|
||||
return (0);
|
||||
if (!check_cgmagic(cg, cgbp, 0)) {
|
||||
if (anyino == 0)
|
||||
return (0);
|
||||
request = (cg + 1) * sblock.fs_ipg;
|
||||
goto retry;
|
||||
}
|
||||
setbit(cg_inosused(cgp), ino % sblock.fs_ipg);
|
||||
cgp->cg_cs.cs_nifree--;
|
||||
switch (type & IFMT) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue