Re: [Gluster-devel] FUSE directory filehandle

2019-01-11 Thread Amar Tumballi Suryanarayan
On Thu, Jan 10, 2019 at 8:17 AM Emmanuel Dreyfus  wrote:

> Hello
>
> This is not strictly a GlusterFS question since I came to it porting
> LTFS to NetBSD, however I would like to make sure I will not break
> GlusterFS by fixing NetBSD FUSE implementation for LTFS.
>
> Current NetBSD FUSE implementation sends the filehandle in any FUSE
> requests for an open node, regardless of its type (directory or file).
>
> I discovered that libfuse low level code manages filehandle differently
> for opendir/readdir/syncdir/releasedir than for other operations. As a
> result, when a getattr is done on a directory, setting the filehandle
> obtained from opendir can cause a crash in libfuse.
>
> The fix for NetBSD FUSE implementation is to avoid setting the
> filehandle for the following FUSE operations on directories: getattr,
> setattr, poll, getlk, setlk, setlkw, read, write (only the first two
> ones are likely to be actually used, though)
>
> Does anyone forsee a possible problem for GlusterFS with such a
> behavior? In other words, will it be fine to always have a
> FUSE_UNKNOWN_FH (aka null) filehandle for getattr/setattr on
> directories?
>
>
Below is the code snippet from fuse_getattr().

#if FUSE_KERNEL_MINOR_VERSION >= 9
priv = this->private;
if (priv->proto_minor >= 9 && fgi->getattr_flags & FUSE_GETATTR_FH)
state->fd = fd_ref((fd_t *)(uintptr_t)fgi->fh);
#endif

Which means, it may crash if we get fd as NULL, when FUSE_GETATTR_FH is set.


>
> --
> Emmanuel Dreyfus
> http://hcpnet.free.fr/pubz
> m...@netbsd.org
> ___
> Gluster-devel mailing list
> Gluster-devel@gluster.org
> https://lists.gluster.org/mailman/listinfo/gluster-devel
>
>
>

-- 
Amar Tumballi (amarts)
___
Gluster-devel mailing list
Gluster-devel@gluster.org
https://lists.gluster.org/mailman/listinfo/gluster-devel

[Gluster-devel] FUSE directory filehandle

2019-01-09 Thread Emmanuel Dreyfus
Hello

This is not strictly a GlusterFS question since I came to it porting
LTFS to NetBSD, however I would like to make sure I will not break
GlusterFS by fixing NetBSD FUSE implementation for LTFS.

Current NetBSD FUSE implementation sends the filehandle in any FUSE
requests for an open node, regardless of its type (directory or file). 

I discovered that libfuse low level code manages filehandle differently
for opendir/readdir/syncdir/releasedir than for other operations. As a
result, when a getattr is done on a directory, setting the filehandle
obtained from opendir can cause a crash in libfuse.

The fix for NetBSD FUSE implementation is to avoid setting the
filehandle for the following FUSE operations on directories: getattr,
setattr, poll, getlk, setlk, setlkw, read, write (only the first two
ones are likely to be actually used, though)

Does anyone forsee a possible problem for GlusterFS with such a
behavior? In other words, will it be fine to always have a
FUSE_UNKNOWN_FH (aka null) filehandle for getattr/setattr on
directories?


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
m...@netbsd.org
___
Gluster-devel mailing list
Gluster-devel@gluster.org
https://lists.gluster.org/mailman/listinfo/gluster-devel