Re: [PATCH v2] fuse: allow synchronous FUSE_INIT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 27, 2025 at 09:51:04PM +0200, Miklos Szeredi wrote:
> On Wed, 27 Aug 2025 at 21:02, Darrick J. Wong <djwong@xxxxxxxxxx> wrote:
> 
> > IOWs, would you be willing to rename this to FUSE_DEV_IOC_SET_FEATURE
> > and take a u32 code?  Then programs with an open /dev/fuse fd can
> > incrementally add pieces as required.  The first one would be
> > FUSE_DEV_SYNC_INIT, the second one would be FUSE_DEV_ADD_IOMAP, etc.
> 
> Okay, so this is not a mask, and individual features would need to be
> set with separate ioctl calls, right?
> 
> That would allow negotiating features.

Correct, one feature per ioctl call.

> > > +     return (typeof(fud)) ((unsigned long) fud & FUSE_DEV_PTR_MASK);
> >
> > s/unsigned long/uintptr_t/ here ?
> 
> Okay.
> 
> > If process_init_reply hits the ok==false case and clears fc->conn_init,
> > should this return an error here to abort the mount?
> 
> Yes, fixed.

Cool, thanks!

FWIW when I added the second FUSE_DEV_ mask, I ended up rewiring the
code like this:

#define FUSE_DEV_SYNC_INIT	(1UL << 0)
#define FUSE_DEV_INHERIT_IOMAP	(1UL << 1)
#define FUSE_DEV_FLAGS_MASK	(FUSE_DEV_SYNC_INIT | FUSE_DEV_INHERIT_IOMAP)
#define FUSE_DEV_PTR_MASK	(~FUSE_DEV_FLAGS_MASK)

and adding helpers to take care of all the annoying casts:

static inline void __fuse_set_dev_flags(struct file *file, uintptr_t flag)
{
	uintptr_t old_flags =
		(uintptr_t)READ_ONCE(file->private_data) & FUSE_DEV_FLAGS_MASK;

	WRITE_ONCE(file->private_data,
		(struct fuse_dev *)(old_flags | flag));
}

and fuse_fill_super_common ends up looking like this:

	if (ctx->fudptr) {
		uintptr_t raw = (uintptr_t)(*ctx->fudptr);
		uintptr_t flags = raw & FUSE_DEV_FLAGS_MASK;

		if (raw & FUSE_DEV_PTR_MASK)
			goto err_unlock;
		if (flags & FUSE_DEV_SYNC_INIT)
			fc->sync_init = 1;
		if (flags & FUSE_DEV_INHERIT_IOMAP)
			fc->may_iomap = 1;
	}

--D

> Thanks,
> Miklos




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux