Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Jun 2019 22:21:43 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r349247 - projects/fuse2/sys/fs/fuse
Message-ID:  <201906202221.x5KMLhm4079722@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Thu Jun 20 22:21:42 2019
New Revision: 349247
URL: https://svnweb.freebsd.org/changeset/base/349247

Log:
  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

Modified:
  projects/fuse2/sys/fs/fuse/fuse_internal.c
  projects/fuse2/sys/fs/fuse/fuse_vfsops.c

Modified: projects/fuse2/sys/fs/fuse/fuse_internal.c
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_internal.c	Thu Jun 20 22:20:30 2019	(r349246)
+++ projects/fuse2/sys/fs/fuse/fuse_internal.c	Thu Jun 20 22:21:42 2019	(r349247)
@@ -896,20 +896,21 @@ fuse_internal_init_callback(struct fuse_ticket *tick, 
 	}
 	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,8 +930,19 @@ fuse_internal_init_callback(struct fuse_ticket *tick, 
 			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:

Modified: projects/fuse2/sys/fs/fuse/fuse_vfsops.c
==============================================================================
--- projects/fuse2/sys/fs/fuse/fuse_vfsops.c	Thu Jun 20 22:20:30 2019	(r349246)
+++ projects/fuse2/sys/fs/fuse/fuse_vfsops.c	Thu Jun 20 22:21:42 2019	(r349247)
@@ -493,11 +493,13 @@ fuse_vfsop_unmount(struct mount *mp, int mntflags)
 	if (fdata_get_dead(data)) {
 		goto alreadydead;
 	}
-	fdisp_init(&fdi, 0);
-	fdisp_make(&fdi, FUSE_DESTROY, mp, 0, td, NULL);
+	if (fsess_isimpl(mp, FUSE_DESTROY)) {
+		fdisp_init(&fdi, 0);
+		fdisp_make(&fdi, FUSE_DESTROY, mp, 0, td, NULL);
 
-	err = fdisp_wait_answ(&fdi);
-	fdisp_destroy(&fdi);
+		(void)fdisp_wait_answ(&fdi);
+		fdisp_destroy(&fdi);
+	}
 
 	fdata_set_dead(data);
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201906202221.x5KMLhm4079722>