Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F151125822
D33424.id99967.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
D33424.id99967.diff
View Options
diff --git a/sbin/fsck/fsck.c b/sbin/fsck/fsck.c
--- a/sbin/fsck/fsck.c
+++ b/sbin/fsck/fsck.c
@@ -254,6 +254,9 @@
return (0);
if (!selected(fs->fs_vfstype))
return (0);
+ /* If failok, always check now */
+ if (hasopt(fs, "failok"))
+ return (1);
/*
* If the -B flag has been given, then process the needed
* background checks. Background checks cannot be run on
diff --git a/sbin/fsck/fsutil.h b/sbin/fsck/fsutil.h
--- a/sbin/fsck/fsutil.h
+++ b/sbin/fsck/fsutil.h
@@ -48,5 +48,6 @@
#define CHECK_CLEAN 0x0020
struct fstab;
+int hasopt(struct fstab *, const char *);
int checkfstab(int, int (*)(struct fstab *),
int (*) (const char *, const char *, const char *, const char *, pid_t *));
diff --git a/sbin/fsck/preen.c b/sbin/fsck/preen.c
--- a/sbin/fsck/preen.c
+++ b/sbin/fsck/preen.c
@@ -62,6 +62,7 @@
char *p_devname; /* device name */
char *p_mntpt; /* mount point */
char *p_type; /* file system type */
+ char p_failok; /* failok option set */
};
static TAILQ_HEAD(part, partentry) badh;
@@ -78,7 +79,7 @@
static int nrun = 0, ndisks = 0;
static struct diskentry *finddisk(const char *);
-static void addpart(const char *, const char *, const char *);
+static void addpart(const char *, const char *, const char *, const char);
static int startdisk(struct diskentry *,
int (*)(const char *, const char *, const char *, const char *, pid_t *));
static void printpart(void);
@@ -132,7 +133,6 @@
}
sumstatus = (*checkit)(fs->fs_vfstype,
name, fs->fs_file, NULL, NULL);
-
if (sumstatus)
return (sumstatus);
continue;
@@ -143,7 +143,8 @@
sumstatus |= 8;
continue;
}
- addpart(fs->fs_vfstype, name, fs->fs_file);
+ addpart(fs->fs_vfstype, name, fs->fs_file,
+ hasopt(fs, "failok"));
}
if ((flags & CHECK_PREEN) == 0 || passno == 1 ||
@@ -172,12 +173,17 @@
continue;
}
- if (WIFEXITED(status))
+ p = TAILQ_FIRST(&d->d_part);
+
+ if (WIFEXITED(status) == 0) {
+ retcode = 0;
+ } else if (p->p_failok == 0) {
retcode = WEXITSTATUS(status);
- else
+ } else {
retcode = 0;
-
- p = TAILQ_FIRST(&d->d_part);
+ fprintf(stderr, "%s: failok SPECIFIED, FSCK "
+ "ERROR(S) IGNORED\n", p->p_devname);
+ }
if (flags & (CHECK_DEBUG|CHECK_VERBOSE))
(void) printf("done %s: %s (%s) = 0x%x\n",
@@ -243,6 +249,29 @@
return (0);
}
+int
+hasopt(struct fstab *fs, const char *option)
+{
+ int negative, found;
+ char *opt, *optbuf;
+
+ if (option[0] == 'n' && option[1] == 'o') {
+ negative = 1;
+ option += 2;
+ } else
+ negative = 0;
+ optbuf = strdup(fs->fs_mntops);
+ found = 0;
+ for (opt = optbuf; (opt = strtok(opt, ",")) != NULL; opt = NULL) {
+ if (opt[0] == 'n' && opt[1] == 'o') {
+ if (!strcasecmp(opt + 2, option))
+ found = negative;
+ } else if (!strcasecmp(opt, option))
+ found = !negative;
+ }
+ free(optbuf);
+ return (found);
+}
static struct diskentry *
finddisk(const char *name)
@@ -297,7 +326,7 @@
static void
-addpart(const char *type, const char *dev, const char *mntpt)
+addpart(const char *type, const char *dev, const char *mntpt, const char failok)
{
struct diskentry *d = finddisk(dev);
struct partentry *p;
@@ -312,6 +341,7 @@
p->p_devname = estrdup(dev);
p->p_mntpt = estrdup(mntpt);
p->p_type = estrdup(type);
+ p->p_failok = failok;
TAILQ_INSERT_TAIL(&d->d_part, p, p_entries);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Apr 7, 6:29 AM (15 h, 43 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
31015532
Default Alt Text
D33424.id99967.diff (3 KB)
Attached To
Mode
D33424: Fix for Bug 246201 - fsck: Does not honour /etc/fstab "failok" option
Attached
Detach File
Event Timeline
Log In to Comment