Discussion:
about zfs_fuse file operations
(too old to reply)
xiaoqin ma
2013-08-05 19:33:53 UTC
Permalink
I see most zfs_fuse operations use fuse_ino_t to get the znode and vnode
information. I am wondering where this number comes from?
Like in function:
zfsfuse_opencreate(fuse_req_t, fuse_ino_t, fuse_file_info *, int, mode_t,
const char *name);
If I am trying to create a new file, how the fuse_ino_t is generated?
If I am trying to read a file, how the fuse_inot_t is found?
--
--
To post to this group, send email to zfs-fuse-/***@public.gmane.org
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zfs-fuse+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Emmanuel Anne
2013-08-05 20:23:33 UTC
Permalink
Basically it's this part is the interface between linux and zfs through
fuse. You can look into the fuse source, there are some easier examples to
show how all this works, and fuse_lowlevel.h is heavily commented to
explain everything.

The example of opencreate is a little tricky because it's a function shared
by 2 fuse callbacks and the parameters have not the same meaning :
creat : ino is the inode of the parent
open : it's the inode of the file which we try to open
Don't forget that in every case the function must make sure the user is
allowed to access/create the file...
Anyway for fuse_lowlevel interface like here, zfs handles all the inode
numbers, and fuse finds them through lookup and then access the files only
by inode numbers (they are cached).
The fuse high level interface hides the inode numbers and accesses the
files only by name.

The interface is quite easy once you get the grip of it, but look in the
fuse examples and read the readme for fuse, it will probably be easier to
understand.

I hope it helps, good luck in your investigation !
Post by xiaoqin ma
I see most zfs_fuse operations use fuse_ino_t to get the znode and vnode
information. I am wondering where this number comes from?
zfsfuse_opencreate(fuse_req_t, fuse_ino_t, fuse_file_info *, int, mode_t,
const char *name);
If I am trying to create a new file, how the fuse_ino_t is generated?
If I am trying to read a file, how the fuse_inot_t is found?
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
my zfs-fuse git repository :
http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary
--
--
To post to this group, send email to zfs-fuse-/***@public.gmane.org
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zfs-fuse+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
xiaoqin ma
2013-08-05 23:25:17 UTC
Permalink
Thanks for the information.
I am trying to understand the code path for read/open/create.
1. the glibc calls like fopen/close will call VFS first to locate the
inode number?
2. the inode number is passed to open(const char *, struct fuse_file_info
*). defined in fuse.h
3. the message is passed from kernel fuse model to user space fuse model
4. zfsfuse_opencreate is called using inode_number as the object number.

I am not clear about given a file path who does the directory traverse? Is
it done in VFS or in ZFS?

If the lookup inum is implemented in ZFS,
the fuse only knows the root's inode number,
1. given a path like /zfs/test/test1, the kernel fuse and user space fuse
will do 4 message passing to locate the inumber? first zfsfuse_lookup call
will locate /zfs/test's inum by giving the root inum, the second
zfsfuse_lookup call will locate /zfs/test/test1's inum by giving
/zfs/test's inum.
Post by Emmanuel Anne
Basically it's this part is the interface between linux and zfs through
fuse. You can look into the fuse source, there are some easier examples to
show how all this works, and fuse_lowlevel.h is heavily commented to
explain everything.
The example of opencreate is a little tricky because it's a function
creat : ino is the inode of the parent
open : it's the inode of the file which we try to open
Don't forget that in every case the function must make sure the user is
allowed to access/create the file...
Anyway for fuse_lowlevel interface like here, zfs handles all the inode
numbers, and fuse finds them through lookup and then access the files only
by inode numbers (they are cached).
The fuse high level interface hides the inode numbers and accesses the
files only by name.
The interface is quite easy once you get the grip of it, but look in the
fuse examples and read the readme for fuse, it will probably be easier to
understand.
I hope it helps, good luck in your investigation !
Post by xiaoqin ma
I see most zfs_fuse operations use fuse_ino_t to get the znode and vnode
information. I am wondering where this number comes from?
zfsfuse_opencreate(fuse_req_t, fuse_ino_t, fuse_file_info *, int, mode_t,
const char *name);
If I am trying to create a new file, how the fuse_ino_t is generated?
If I am trying to read a file, how the fuse_inot_t is found?
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups
"zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary
--
--
To post to this group, send email to zfs-fuse-/***@public.gmane.org
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zfs-fuse+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Emmanuel Anne
2013-08-06 02:11:35 UTC
Permalink
Post by xiaoqin ma
1. given a path like /zfs/test/test1, the kernel fuse and user space fuse
will do 4 message passing to locate the inumber? first zfsfuse_lookup call
will locate /zfs/test's inum by giving the root inum, the second
zfsfuse_lookup call will locate /zfs/test/test1's inum by giving
/zfs/test's inum.
It needs to do the lookups, but since they are cached they are not all done
for this particular call if /zfs/test was accessed previously then the only
required lookup is test1 (if it was not accessed at all before). They are
cached in the kernel. Enable the debug options to get the debug output in
the console if you are curious to see this working, and lauch zfs-fuse by :
zfs-fuse -n
to get the debug output in the console, this way you can see which
functions are called while using some shell functions in another window.
Post by xiaoqin ma
Post by Emmanuel Anne
Basically it's this part is the interface between linux and zfs through
fuse. You can look into the fuse source, there are some easier examples to
show how all this works, and fuse_lowlevel.h is heavily commented to
explain everything.
The example of opencreate is a little tricky because it's a function
creat : ino is the inode of the parent
open : it's the inode of the file which we try to open
Don't forget that in every case the function must make sure the user is
allowed to access/create the file...
Anyway for fuse_lowlevel interface like here, zfs handles all the inode
numbers, and fuse finds them through lookup and then access the files only
by inode numbers (they are cached).
The fuse high level interface hides the inode numbers and accesses the
files only by name.
The interface is quite easy once you get the grip of it, but look in the
fuse examples and read the readme for fuse, it will probably be easier to
understand.
I hope it helps, good luck in your investigation !
Post by xiaoqin ma
I see most zfs_fuse operations use fuse_ino_t to get the znode and vnode
information. I am wondering where this number comes from?
zfsfuse_opencreate(fuse_req_t, fuse_ino_t, fuse_file_info *, int,
mode_t, const char *name);
If I am trying to create a new file, how the fuse_ino_t is generated?
If I am trying to read a file, how the fuse_inot_t is found?
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google
Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
.
--
my zfs-fuse git repository : http://rainemu.swishparty.co.**
uk/cgi-bin/gitweb.cgi?p=zfs;a=**summary<http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary>
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
my zfs-fuse git repository :
http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary
--
--
To post to this group, send email to zfs-fuse-/***@public.gmane.org
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zfs-fuse+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
xiaoqin ma
2013-08-08 18:05:51 UTC
Permalink
I started zfs-fuse -n, but when i run "zpool list",
I got the following error:
[***@localhost ~]# zfs-fuse -n
fuse: failed to access mountpoint /zfs-kstat: Transport endpoint is not
connected
Post by Emmanuel Anne
Post by xiaoqin ma
1. given a path like /zfs/test/test1, the kernel fuse and user space fuse
will do 4 message passing to locate the inumber? first zfsfuse_lookup call
will locate /zfs/test's inum by giving the root inum, the second
zfsfuse_lookup call will locate /zfs/test/test1's inum by giving
/zfs/test's inum.
It needs to do the lookups, but since they are cached they are not all
done for this particular call if /zfs/test was accessed previously then the
only required lookup is test1 (if it was not accessed at all before). They
are cached in the kernel. Enable the debug options to get the debug output
in the console if you are curious to see this working, and lauch zfs-fuse
zfs-fuse -n
to get the debug output in the console, this way you can see which
functions are called while using some shell functions in another window.
Post by xiaoqin ma
Post by Emmanuel Anne
Basically it's this part is the interface between linux and zfs through
fuse. You can look into the fuse source, there are some easier examples to
show how all this works, and fuse_lowlevel.h is heavily commented to
explain everything.
The example of opencreate is a little tricky because it's a function
creat : ino is the inode of the parent
open : it's the inode of the file which we try to open
Don't forget that in every case the function must make sure the user is
allowed to access/create the file...
Anyway for fuse_lowlevel interface like here, zfs handles all the inode
numbers, and fuse finds them through lookup and then access the files only
by inode numbers (they are cached).
The fuse high level interface hides the inode numbers and accesses the
files only by name.
The interface is quite easy once you get the grip of it, but look in the
fuse examples and read the readme for fuse, it will probably be easier to
understand.
I hope it helps, good luck in your investigation !
Post by xiaoqin ma
I see most zfs_fuse operations use fuse_ino_t to get the znode and
vnode information. I am wondering where this number comes from?
zfsfuse_opencreate(fuse_req_t, fuse_ino_t, fuse_file_info *, int,
mode_t, const char *name);
If I am trying to create a new file, how the fuse_ino_t is generated?
If I am trying to read a file, how the fuse_inot_t is found?
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google
Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
.
--
my zfs-fuse git repository : http://rainemu.swishparty.co.**
uk/cgi-bin/gitweb.cgi?p=zfs;a=**summary<http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary>
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups
"zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary
--
--
To post to this group, send email to zfs-fuse-/***@public.gmane.org
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zfs-fuse+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Emmanuel Anne
2013-08-09 07:03:34 UTC
Permalink
You shouldn't be able to find the cause by yourself normally...
From memory, it means either that you have 2 zfs-fuse processes running at
the same time or that the previous instance of zfs-fuse didn't exit cleanly
and didn't unmount /zfs-kstat
The usual workaround is to uncomment the line
no-kstat-mount
in /etc/zfs/zfsrc.

And I am almost sure there are messages about this in the archives of this
list... !
Post by xiaoqin ma
I started zfs-fuse -n, but when i run "zpool list",
fuse: failed to access mountpoint /zfs-kstat: Transport endpoint is not
connected
Post by Emmanuel Anne
Post by xiaoqin ma
1. given a path like /zfs/test/test1, the kernel fuse and user space
fuse will do 4 message passing to locate the inumber? first zfsfuse_lookup
call will locate /zfs/test's inum by giving the root inum, the second
zfsfuse_lookup call will locate /zfs/test/test1's inum by giving
/zfs/test's inum.
It needs to do the lookups, but since they are cached they are not all
done for this particular call if /zfs/test was accessed previously then the
only required lookup is test1 (if it was not accessed at all before). They
are cached in the kernel. Enable the debug options to get the debug output
in the console if you are curious to see this working, and lauch zfs-fuse
zfs-fuse -n
to get the debug output in the console, this way you can see which
functions are called while using some shell functions in another window.
Post by xiaoqin ma
Post by Emmanuel Anne
Basically it's this part is the interface between linux and zfs through
fuse. You can look into the fuse source, there are some easier examples to
show how all this works, and fuse_lowlevel.h is heavily commented to
explain everything.
The example of opencreate is a little tricky because it's a function
creat : ino is the inode of the parent
open : it's the inode of the file which we try to open
Don't forget that in every case the function must make sure the user is
allowed to access/create the file...
Anyway for fuse_lowlevel interface like here, zfs handles all the inode
numbers, and fuse finds them through lookup and then access the files only
by inode numbers (they are cached).
The fuse high level interface hides the inode numbers and accesses the
files only by name.
The interface is quite easy once you get the grip of it, but look in
the fuse examples and read the readme for fuse, it will probably be easier
to understand.
I hope it helps, good luck in your investigation !
Post by xiaoqin ma
I see most zfs_fuse operations use fuse_ino_t to get the znode and
vnode information. I am wondering where this number comes from?
zfsfuse_opencreate(fuse_req_t, fuse_ino_t, fuse_file_info *, int,
mode_t, const char *name);
If I am trying to create a new file, how the fuse_ino_t is generated?
If I am trying to read a file, how the fuse_inot_t is found?
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google
Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/**grou**ps/opt_out<https://groups.google.com/groups/opt_out>
.
--
my zfs-fuse git repository : http://rainemu.swishparty.co.**u**
k/cgi-bin/gitweb.cgi?p=zfs;a=**s**ummary<http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary>
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google
Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send
For more options, visit https://groups.google.com/**groups/opt_out<https://groups.google.com/groups/opt_out>
.
--
my zfs-fuse git repository : http://rainemu.swishparty.co.**
uk/cgi-bin/gitweb.cgi?p=zfs;a=**summary<http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary>
--
--
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an
For more options, visit https://groups.google.com/groups/opt_out.
--
my zfs-fuse git repository :
http://rainemu.swishparty.co.uk/cgi-bin/gitweb.cgi?p=zfs;a=summary
--
--
To post to this group, send email to zfs-fuse-/***@public.gmane.org
To visit our Web site, click on http://zfs-fuse.net/
---
You received this message because you are subscribed to the Google Groups "zfs-fuse" group.
To unsubscribe from this group and stop receiving emails from it, send an email to zfs-fuse+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
Loading...