Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore BIO_FLUSH command if there is no volatile cache to flush #710

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion sys/geom/geom_disk.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ struct g_disk_softc {
char led[64];
uint32_t state;
struct mtx done_mtx;
bool ignore_flush;
};

static g_access_t g_disk_access;
Expand Down Expand Up @@ -539,7 +540,7 @@ g_disk_start(struct bio *bp)
g_trace(G_T_BIO, "g_disk_flushcache(%s)",
bp->bio_to->name);
if (!(dp->d_flags & DISKFLAG_CANFLUSHCACHE)) {
error = EOPNOTSUPP;
error = (sc->ignore_flush) ? 0 : EOPNOTSUPP;
break;
}
/*FALLTHROUGH*/
Expand Down Expand Up @@ -760,6 +761,10 @@ g_disk_create(void *arg, int flag)
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "flags",
CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, dp, 0,
g_disk_sysctl_flags, "A", "Report disk flags");
SYSCTL_ADD_BOOL(&sc->sysctl_ctx,
SYSCTL_CHILDREN(sc->sysctl_tree), OID_AUTO, "ignore_flush",
CTLFLAG_RWTUN, &sc->ignore_flush, sizeof(sc->ignore_flush),
"Do not return EOPNOTSUPP if there is no cache to flush");
Copy link
Member

@bsdimp bsdimp Apr 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, never mind... ENOTSUP == EOPNOTSUPP

}
pp->private = sc;
dp->d_geom = gp;
Expand Down