The NetBSD Project

CVS log for src/lib/libperfuse/perfuse_priv.h

[BACK] Up to [cvs.NetBSD.org] / src / lib / libperfuse

Request diff between arbitrary revisions


Default branch: MAIN
Current tag: MAIN


Revision 1.31 / (download) - annotate - [select for diffs], Sat Jul 21 05:49:42 2012 UTC (9 months, 4 weeks ago) by manu
Branch: MAIN
CVS Tags: yamt-pagecache-base8, yamt-pagecache-base7, yamt-pagecache-base6, tls-maxphys-nbase, tls-maxphys-base, tls-maxphys, agc-symver-base, agc-symver, HEAD
Changes since 1.30: +34 -12 lines
Diff to previous 1.30 (colored)

- Fix same vnodes associated with multiple cookies
The scheme used to retreive known nodes on lookup was flawed, as it only
used parent and name. This produced a different cookie for the same file
if it was renamed, when looking up ../ or when dealing with multiple files
associated with the same name through link(2).

We therefore abandon the use of node name and introduce hashed lists of
inodes. This causes a huge rewrite of reclaim code, which do not attempt
to keep parents allocated until all their children are reclaimed

- Fix race conditions in reclaim
There are a few situations where we issue multiple FUSE operations for
a PUFFS operation. On reclaim, we therefore have to wait for all FUSE
operation to complete, not just the current exchanges. We do this by
introducing node reference count with node_ref() and node_rele().

- Detect data loss caused by FAF
VOP_PUTPAGES causes FAF writes where the kernel does not check the
operation result. At least issue a warning on error.

- Enjoy FAF shortcut on setattr
No need to wait for the result if the kernel does not want it. There is
however an exception for setattr that touch the size, we need to wait
for completion because we have other operations queued for after the
resize.

- Fix fchmod() on write-open file
fchmod() on a node open with write privilege will send setattr with both mode and size set. This confuses some FUSE filesystem. Therefore we send two FUSE operations, one for mode, and one for size.

- Remove node TTL handling for netbsd-5 for simplicity sake. The code
still builds on netbsd-5 but does not have the node TTL feature anymore.
It works fine with kernel support on netbsd-6.

Revision 1.30 / (download) - annotate - [select for diffs], Thu Jun 28 13:53:13 2012 UTC (10 months, 3 weeks ago) by abs
Branch: MAIN
Changes since 1.29: +2 -2 lines
Diff to previous 1.29 (colored)

Fix the build by adding (unused) flags argument to perfuse_node_setattr_ttl

Revision 1.29 / (download) - annotate - [select for diffs], Wed Apr 18 00:57:22 2012 UTC (13 months ago) by manu
Branch: MAIN
CVS Tags: yamt-pagecache-base5
Changes since 1.28: +7 -1 lines
Diff to previous 1.28 (colored)

- When using PUFFS_KFLAG_CACHE_FS_TTL, do not use puffs_node to carry
  attribute and TTL fora newly created node. Instead extend puffs_newinfo
  and add puffs_newinfo_setva() and puffs_newinfo_setttl()
- Remove node_mk_common_final in libperfuse. It used to set uid/gid for
  a newly created vnode but has been made redundant along time ago since
  uid and gid are properly set in FUSE header.
- In libperfuse, check for corner case where opc = 0 on INACTIVE and   RECLAIM (how is it possible? Check for it to avoid a crash anyway)
- In libperfuse, make sure we unlimit RLIMIT_AS and RLIMIT_DATA so that
  we do notrun out of memory because the kernel is lazy at reclaiming vnodes.
- In libperfuse, cleanup style of perfuse_destroy_pn()

Revision 1.28 / (download) - annotate - [select for diffs], Sun Apr 8 15:13:06 2012 UTC (13 months, 1 week ago) by manu
Branch: MAIN
CVS Tags: yamt-pagecache-base4
Changes since 1.27: +5 -3 lines
Diff to previous 1.27 (colored)

Use new PUFFS_KFLAG_CACHE_FS_TTL option to puffs_init(3) so that
FUSE TTL on name and attributes are used. This save many PUFFS
operations and improves performances.

PUFFS_KFLAG_CACHE_FS_TTL is #ifdef'ed in many places for now so that
libperfuse can still be used on netbsd-5.

Revision 1.27 / (download) - annotate - [select for diffs], Wed Mar 21 10:10:36 2012 UTC (13 months, 4 weeks ago) by matt
Branch: MAIN
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

Use C89 function definition

Revision 1.26 / (download) - annotate - [select for diffs], Thu Mar 8 14:58:57 2012 UTC (14 months, 1 week ago) by manu
Branch: MAIN
Changes since 1.25: +3 -2 lines
Diff to previous 1.25 (colored)

The kernel can lookup the same node multiple time and will reclaim as
many times it looked up. All reclaims but the last one must be ignored,
otherwise we discard a node which will still get operations. We therefore
have to keep track of lookup/reclaim count and hnour reclaims only when
the count reaches zero.

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jan 29 06:22:02 2012 UTC (15 months, 2 weeks ago) by manu
Branch: MAIN
CVS Tags: netbsd-6-base
Branch point for: netbsd-6
Changes since 1.24: +4 -1 lines
Diff to previous 1.24 (colored)

Improve FUSE trace facility

Revision 1.24 / (download) - annotate - [select for diffs], Wed Dec 28 17:33:53 2011 UTC (16 months, 3 weeks ago) by manu
Branch: MAIN
Changes since 1.23: +18 -1 lines
Diff to previous 1.23 (colored)

Add a FUSE trace facility, with statistics collection. This should help
tracking bugs and performance issues

Revision 1.23 / (download) - annotate - [select for diffs], Sun Oct 30 05:11:37 2011 UTC (18 months, 2 weeks ago) by manu
Branch: MAIN
CVS Tags: yamt-pagecache-base3, yamt-pagecache-base2, yamt-pagecache-base
Branch point for: yamt-pagecache
Changes since 1.22: +4 -2 lines
Diff to previous 1.22 (colored)

- Fix the confusion between fileno (opaque FUSE reference) and inode
  numbers. fileno must be used when exchanging FUSE messages.
- Do not use kernel name cache anymore, as it caused modification from
  other machines to be invisible.
- Honour name and attribute cache directive from FUSE filesystem

Revision 1.22 / (download) - annotate - [select for diffs], Fri Sep 9 15:45:28 2011 UTC (20 months, 1 week ago) by manu
Branch: MAIN
Changes since 1.21: +4 -2 lines
Diff to previous 1.21 (colored)

Serialize access to file size. We already have such a thing in the
kernel, where it fixes race for PUFFS filesystems, but we need it again
in perfused since FUSE filesystems are allowed to reorder requests.

The huge issue is in the asyncrhonous SETATTR sent by fsync. It is
followed by a syncrhnous FSYNC, so if the filesystem does not reorder
requests, once the FSYNC returns, we are confident the SETATTR is done.
But since FUSE can reorder, we need to implement sync in perfused.

Revision 1.21 / (download) - annotate - [select for diffs], Thu Jul 14 15:37:32 2011 UTC (22 months ago) by manu
Branch: MAIN
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

FUSE struct dirent's off is not the offset in the buffer, it is an opaque
cookie that the filesystem passes us, and that we need to send back on
the next READDIR. Most filesystem just ignore the value and send the
next chunk of buffer, but not all of them. Fixing this allows glusterfs
distributed volume to work.

Revision 1.20 / (download) - annotate - [select for diffs], Mon Jul 4 08:07:30 2011 UTC (22 months, 2 weeks ago) by manu
Branch: MAIN
Changes since 1.19: +2 -2 lines
Diff to previous 1.19 (colored)

Add a flag to VOP_LISTEXTATTR(9) so that the vnode interface can tell the
filesystem in which format extended attribute shall be listed.

There are currently two formats:
- NUL-terminated strings, used for listxattr(2), this is the default.
- one byte length-pprefixed, non NUL-terminated strings, used for
  extattr_list_file(2), which is obtanined by setting the
  EXTATTR_LIST_PREFIXLEN flag to VOP_LISTEXTATTR(9)

This approach avoid the need for converting the list back and forth, except
in libperfuse, since FUSE uses NUL-terminated strings, and the kernel may
have requested EXTATTR_LIST_PREFIXLEN.

Revision 1.19 / (download) - annotate - [select for diffs], Tue Jun 28 16:19:16 2011 UTC (22 months, 3 weeks ago) by manu
Branch: MAIN
Changes since 1.18: +12 -2 lines
Diff to previous 1.18 (colored)

Add support for extended attributes

Revision 1.18 / (download) - annotate - [select for diffs], Mon May 30 14:50:08 2011 UTC (23 months, 3 weeks ago) by manu
Branch: MAIN
CVS Tags: cherry-xenmp-base, cherry-xenmp
Changes since 1.17: +2 -1 lines
Diff to previous 1.17 (colored)

Use SOCK_SEQPACKET in perfuse if available. This fix file operations hangs
where the FUSE filesyste replied to an operation and got an ENOBUFS it did
not handle.

We now are also able to cleanly unmount

Revision 1.17 / (download) - annotate - [select for diffs], Mon Apr 25 04:54:53 2011 UTC (2 years ago) by manu
Branch: MAIN
Changes since 1.16: +4 -4 lines
Diff to previous 1.16 (colored)

- Implement proper unprivilegied user permission verifications
Verification is now done in the lookup method, as it is the way to
go. Of course there are corner cases, such as the sticky bit which
need special handling in the remove method.

- Set full fsidx in vftstat method

- Do not pass O_APPEND to the filesystem. FUSE always sends the
write offset, so setting O_APPEND is useless. If the filesystem
uses it in an open(2) system call, it will even cause file
corruptions, since offsets given to pwrite(2) will be ignored.
This fix allows glusterfs to host a NetBSD ./build.sh -o build

- Do not use the FUSE access method, use getattr and check for
permission on our own. The problem is that a FUSE filesystem will
typically use the Linux-specific setfsuid() to perform access
control. If that is missing, any chack is likely to occur on
behalf of the user running the filesystem (typically root), causing
access method to return wrong information.

- When possible, avoid performing a getattr method call and use
cached value in puffs_node instead. We still retreive the latest
value by calling getattr when performing append write operation,
to minimize the chances that another writer appended since the
last time we did.

- Update puffs_node cached file size in write method

- Remove unused argument to perfuse_destroy_pn()

Revision 1.16 / (download) - annotate - [select for diffs], Mon Oct 11 05:37:58 2010 UTC (2 years, 7 months ago) by manu
Branch: MAIN
CVS Tags: matt-mips64-premerge-20101231, bouyer-quota2-nbase, bouyer-quota2-base, bouyer-quota2
Changes since 1.15: +0 -0 lines
Diff to previous 1.15 (colored)

Remove code supporting SOCK_STREAM, as SOCK_DGRAM works fine

Revision 1.15 / (download) - annotate - [select for diffs], Mon Oct 11 01:08:26 2010 UTC (2 years, 7 months ago) by manu
Branch: MAIN
Changes since 1.14: +1 -4 lines
Diff to previous 1.14 (colored)

- fix access control: pcn->pcn_cred is not user credentials
- Keep track of file generation
- remove size tracking in pnd_size, we have it in pn_va.va_size

Revision 1.14 / (download) - annotate - [select for diffs], Sun Oct 3 05:46:47 2010 UTC (2 years, 7 months ago) by manu
Branch: MAIN
Changes since 1.13: +5 -4 lines
Diff to previous 1.13 (colored)

- Correctly handle rename whith overwritten destination
- Keep track of file name to avoid lookups when we can. This makes sure we
  do not have two cookies for the same inode, a situation that cause wreak
  havoc when we come to remove or rename a node.
- Do not use PUFFS_FLAG_BUILDPATH at all, since we now track file names
- In open, queue requests after checking for access, as there is no merit
  to queue a will-be-denied request while we can deny it immediatly
- request reclaim of removed nodes at inactive stage

Revision 1.13 / (download) - annotate - [select for diffs], Wed Sep 29 08:01:10 2010 UTC (2 years, 7 months ago) by manu
Branch: MAIN
Changes since 1.12: +5 -2 lines
Diff to previous 1.12 (colored)

= Open files =
- Restore open on our own in fsycn and readdir, as the node may not already
be open, and FUSE really wants it to be. No need to close immediatly, it
can be done at inactive time.

= Write operations =
- fix a nasty bug that corrupted files on write (written added twice)
- Keep track of file size in order to honour PUFFS_IO_APPEND

= many fixes in rename =
- handler overwritten nodes correctly
- wait for all operations on the node to drain before doing rename, as
filesystems may not cope with operations on a moving file.
- setback PUFFS_SETBACK_INACT_N1 cannot be used from rename, we therefore
miss the inactive time for an overwritten node. This bounds us to give up
PUFFS_KFLAG_IAONDEMAND.

= Removed files =
- forbid most operations on a removed node, return ENOENT
- setback PUFFS_SETBACK_NOREF_N1 at inactive stage to cause removed
file reclaim

= Misc =
- Update outdated ARGSUSED for lint
- Fix a memory leak (puffs_pn_remove instead of puffs_pn_put)
- Do not use PUFFS_FLAG_BUILDPATH except for debug output. It makes the
lookup code much simplier.

Revision 1.12 / (download) - annotate - [select for diffs], Thu Sep 23 16:02:34 2010 UTC (2 years, 7 months ago) by manu
Branch: MAIN
Changes since 1.11: +12 -17 lines
Diff to previous 1.11 (colored)

== file close operations ==
- use PUFFS_KFLAG_WTCACHE to puffs_init so that all writes are
immediatly send to the filesystem, and we do not have anymore write
after inactive. As a consequence, we can close files at inactive
stage, and there is not any concern left with files opened at
create time. We also do not have anymore to open ourselves in readdir and
fsync.

- Fsync on close (inactive stage). That makes sure we will not need to
do these operations once the file is closed (FUSE want an open file).
short sircuit the request that come after the close, bu not fsinc'ing
closed files,

- Use PUFFS_KFLAG_IAONDEMAND to get less inactive calls

== Removed nodes ==
- more ENOENT retunred for operations on removed node (but there
are probably some still missing): getattr, ooen, setattr, fsync

- set PND_REMOVE before sending the UNLINK/RMDIR operations so that we avoid
races during UNLINK completion. Also set PND_REMOVED on node we overwirte
in rename

== Filehandle fixes ==
- queue open operation to avoid getting two fh for one file

- set FH in getattr, if the file is open

- Just requires a read FH for fsyncdir, as we always opendir in read
mode. Ok, this is misleading :-)

== Misc ==
- do not set FUSE_FATTR_ATIME_NOW in setattr, as we provide the time

- short circuit nilpotent operations in setattr

- add a filename diagnostic flag to dump file names

Revision 1.11 / (download) - annotate - [select for diffs], Mon Sep 20 07:00:22 2010 UTC (2 years, 7 months ago) by manu
Branch: MAIN
Changes since 1.10: +30 -18 lines
Diff to previous 1.10 (colored)

- performance improvement for read, readdir and write. Now we use
SOCK_DGRAM, we can send many pages at once without hitting any bug

- when creating a file, it is open for FUSE, but not for the kernel.
If the kernel does not do a subsequent open, we have a leak. We fight
against this by trying to close such file that the kernel left unopen
for some time.

- some code refactoring to make message exchange debug easier (more to come)

Revision 1.10 / (download) - annotate - [select for diffs], Wed Sep 15 01:51:43 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.9: +5 -1 lines
Diff to previous 1.9 (colored)

- Use SOCK_DGRAM instead of SOCK_STREAM, as the filesystem seems to
assume datagram semantics: when using SOCK_STREAM, if perfused sends
frames faster than the filesystem consumes them, it will grab multiple
frames at once and discard anything beyond the first one. For now the
code can work both with SOCK_DGRAM and SOCK_STREAM, but SOCK_STREAM
support will probably have to be removed for the sake of readability.

- Remeber to sync parent directories when moving a node

- In debug output, display the requeue type (readdir, write, etc...)

Revision 1.9 / (download) - annotate - [select for diffs], Thu Sep 9 09:12:35 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.8: +1 -2 lines
Diff to previous 1.8 (colored)

- call FSYNCDIR for directories
- directories can be open R/W (for FSYNCDIR)
- do not skip calls to FSYNC or FSYNCDIR if the filesystem returned ENOSYS:
it may change its mind, and it may also actually do something when retunring
ENOSYS
- When FSYNC and FSYNCDIR return ENOSYS, do not report it to kernel (silent
failure)

Revision 1.8 / (download) - annotate - [select for diffs], Mon Sep 6 01:40:24 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.7: +1 -1 lines
Diff to previous 1.7 (colored)

More LP64 fixes

Revision 1.7 / (download) - annotate - [select for diffs], Mon Sep 6 01:17:05 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.6: +1 -1 lines
Diff to previous 1.6 (colored)

build fixes for LP64

Revision 1.6 / (download) - annotate - [select for diffs], Sun Sep 5 06:49:13 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.5: +2 -3 lines
Diff to previous 1.5 (colored)

- correctly set flags for CREATE

- after a node is deleted, some operations should return ENOENT, some
should be ignored. Fixed it for ACCESS, SETATTR and GETATTR. Other
operation may also need a fix.

- At reclaim time, there is no need to wait for READDIR and READ
completion, since the caller will never close a file before getting
readir() and read() replies. Waiting for WRITE completion is still
mandatory, but we must ensure that no queued WRITE is awaiting to
be scheduled. Once the queue is drained, we must check that the
reclaim operation was not canceled by a new file LOOKUP.

- At reclaim time, fixed a mix up between read and write fh to close

- Fixed permission checks for RENAME (it tested the node itself
instead of the source)

- When seting file mode, only MKNOD needs the filetype (S_* fields).
It is probably a bug to set it for other operations.

Revision 1.5 / (download) - annotate - [select for diffs], Fri Sep 3 07:15:18 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.4: +16 -15 lines
Diff to previous 1.4 (colored)

- Postpone file close at reclaim time, since NetBSD sends fsync and
setattr(mtime, ctime) after close, while FUSE expects the file
to be open for these operations

- remove unused argument to node_mk_common()

- remove requeued requests when they are executed, not when they
are tagged for schedule

- try to make filehandle management simplier, by keeping track of only
one read and one write filehandle (the latter being really read/write).

- when CREATE is not available, we use the MKNOD/OPEN path. Fix a
bug here where we opened the parent directory instead of the node:
add the missing lookup of the mknod'ed node.

- lookup file we just created: glusterfs does not really see them
otherwise.

- open file when doing setattr(mtime, ctime) on non open files, as
some filesystems seems to require it.

- Do not flush pagecache for removed nodes

- Keep track of read/write operations in progress, and at reclaim
time, make sure they are over before closing and forgeting the file.

Revision 1.4 / (download) - annotate - [select for diffs], Wed Sep 1 14:57:24 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.3: +3 -3 lines
Diff to previous 1.3 (colored)

Build fixes for LP64

Revision 1.3 / (download) - annotate - [select for diffs], Fri Aug 27 09:58:17 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.2: +2 -4 lines
Diff to previous 1.2 (colored)

- if perfused is not already started (cannot connect to /dev/fuse),
FUSE filesystems will attempt to start it on their own, and will
communicate using a socketpair

- do not advertise NULL file handle as being valid when sending themback to the FUSE filesystem.

- unmount if we cannot talk to the FUSE process anymore

- set calling process gid properly

- debug message cleanup

Revision 1.2 / (download) - annotate - [select for diffs], Thu Aug 26 13:29:01 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN
Changes since 1.1: +3 -1 lines
Diff to previous 1.1 (colored)

- open the file before doing fsync: glusterfs wants that.

- Automatically call fsync on close for files. If we just close, fsync
will come later and we will have to reopen

- Add a PND_DIRTY flag to keep track of files that really need a sync.
perfuse_node_fsync only calls the FUSE fsync method if there are data
to push.

- Add a PND_OPEN flag to keep track of open files. Checking non NULL
fh is not enough, as some filesystems will always set fh to 0.

- Add a sync diagnostic flag, to watch fsync and dirty flag activity.
Make the fh diagnostic flag more verbose

- Send the fh in setattr (it was hardcoded to 0)

I am now able to build libperfuse in a glusterfs mounted filesystem. Yeah!

Revision 1.1 / (download) - annotate - [select for diffs], Wed Aug 25 07:16:00 2010 UTC (2 years, 8 months ago) by manu
Branch: MAIN

libperfuse(3) is a PUFFS relay to FUSE. In order to use it,
FUSE filesystem must be patched to #include <perfuse.h> in the source
files that open /dev/fuse and perform the mount(2) system call. The
FUSE filesystem must be linked with -lperfuse.

libperfuse(3) implements the FUSE kernel interface, on which libfuse or
any FUSE filesystem that opens /dev/fuse directly can be used.

For now, an external daemon called perfused(8) is used. This may change
in the future.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.




CVSweb <webmaster@jp.NetBSD.org>