fusefs: attempt to support servers as old as protocol 7.4

Previously we allowed servers as old as 7.1 to connect (there never was a
7.0).  However, we wrongly assumed a few things about protocols older than
7.8.  This commit attempts to support servers as old as 7.4 but no older.  I
added no new tests because I'm not sure there actually _are_ any servers
this old in the wild.

Sponsored by:	The FreeBSD Foundation
This commit is contained in:
Alan Somers 2019-06-20 22:21:42 +00:00
parent 2ffddc5ee9
commit 192a918194
2 changed files with 25 additions and 11 deletions

View File

@ -896,20 +896,21 @@ fuse_internal_init_callback(struct fuse_ticket *tick, struct uio *uio)
}
fiio = fticket_resp(tick)->base;
/* XXX: Do we want to check anything further besides this? */
if (fiio->major < 7) {
data->fuse_libabi_major = fiio->major;
data->fuse_libabi_minor = fiio->minor;
if (!fuse_libabi_geq(data, 7, 4)) {
/*
* With a little work we could support servers as old as 7.1.
* But there would be little payoff.
*/
SDT_PROBE2(fusefs, , internal, trace, 1,
"userpace version too low");
err = EPROTONOSUPPORT;
goto out;
}
data->fuse_libabi_major = fiio->major;
data->fuse_libabi_minor = fiio->minor;
if (fuse_libabi_geq(data, 7, 5)) {
if (fticket_resp(tick)->len == sizeof(struct fuse_init_out)) {
data->max_readahead_blocks = fiio->max_readahead /
maxbcachebuf;
data->max_write = fiio->max_write;
if (fiio->flags & FUSE_ASYNC_READ)
data->dataflags |= FSESS_ASYNC_READ;
@ -929,10 +930,21 @@ fuse_internal_init_callback(struct fuse_ticket *tick, struct uio *uio)
err = EINVAL;
}
} else {
/* Old fix values */
/* Old fixed values */
data->max_write = 4096;
}
if (fuse_libabi_geq(data, 7, 6))
data->max_readahead_blocks = fiio->max_readahead / maxbcachebuf;
if (!fuse_libabi_geq(data, 7, 7))
fsess_set_notimpl(data->mp, FUSE_INTERRUPT);
if (!fuse_libabi_geq(data, 7, 8)) {
fsess_set_notimpl(data->mp, FUSE_BMAP);
fsess_set_notimpl(data->mp, FUSE_DESTROY);
}
out:
if (err) {
fdata_set_dead(data);

View File

@ -493,11 +493,13 @@ fuse_vfsop_unmount(struct mount *mp, int mntflags)
if (fdata_get_dead(data)) {
goto alreadydead;
}
if (fsess_isimpl(mp, FUSE_DESTROY)) {
fdisp_init(&fdi, 0);
fdisp_make(&fdi, FUSE_DESTROY, mp, 0, td, NULL);
err = fdisp_wait_answ(&fdi);
(void)fdisp_wait_answ(&fdi);
fdisp_destroy(&fdi);
}
fdata_set_dead(data);