Commit Graph

50 Commits

Author SHA1 Message Date
lukem c4b7a9e794 bsd.own.mk: rename GCC_NO_* to CC_WNO_*
Rename compiler-warning-disable variables from
	GCC_NO_warning
to
	CC_WNO_warning
where warning is the full warning name as used by the compiler.

GCC_NO_IMPLICIT_FALLTHRU is CC_WNO_IMPLICIT_FALLTHROUGH

Using the convention CC_compilerflag, where compilerflag
is based on the full compiler flag name.
2023-06-03 09:09:01 +00:00
pho 1f6f9b8380 librefuse: Preparation of a proper API versioning; no more #ifdef woes in user code
The goal is to fully support FUSE API version 3.0 while maintaining
API/ABI compatibility with code written for 2.6 (or even older).

* <fuse.h> now emits a compiler warning if it's included without
  defining FUSE_USE_VERSION. It had been silently defaulted to the
  latest supported version prior to this change. This is permissive
  compared to the original FUSE, as it emits an error instead.

* <fuse.h> now emits a warning if FUSE_USE_VERSION is higher than what
  can be provided.

* Added a macro FUSE_MAKE_VERSION(maj, min). It was missing from
  librefuse <fuse.h>.

No actual API updates have been made (yet).
2021-12-04 06:42:39 +00:00
nia f96b5061e9 perfused: use SOL_LOCAL 2021-08-08 20:56:54 +00:00
nia 213aa76def introduce a SOL_LOCAL for unix-domain socket level socket options
as an alias of the current 0 used for these options, as in FreeBSD.

reviewed by many.
2021-08-08 20:54:48 +00:00
mrg de11d87641 introduce some common variables for use in GCC warning disables:
GCC_NO_FORMAT_TRUNCATION    -Wno-format-truncation (GCC 7/8)
GCC_NO_STRINGOP_TRUNCATION  -Wno-stringop-truncation (GCC 8)
GCC_NO_STRINGOP_OVERFLOW    -Wno-stringop-overflow (GCC 8)
GCC_NO_CAST_FUNCTION_TYPE   -Wno-cast-function-type (GCC 8)

use these to turn off warnings for most GCC-8 complaints.  many
of these are false positives, most of the real bugs are already
commited, or are yet to come.


we plan to introduce versions of (some?) of these that use the
"-Wno-error=" form, which still displays the warnings but does
not make it an error, and all of the above will be re-considered
as either being "fix me" (warning still displayed) or "warning
is wrong."
2019-10-13 07:28:04 +00:00
gutteridge e2f2539cb1 perfused.8: fix typos 2019-07-06 00:45:02 +00:00
maya bac778e85c fix typo 2019-04-17 12:30:51 +00:00
christos 82c75ae659 remove dup function 2016-10-19 01:31:05 +00:00
manu edb96218ee Make FUSE socket buffer tunable
When dealing with high I/O throughput, we could run out of buffer
space if the filesystem was not consuming requests fast enough.
Here we slightly raise the buffer size, and we make it tunable
through the PERFUSE_BUFSIZE environment variable so that we can
cope with higher requirement later.

While there, document PERFUSE_OPTIONS environment variable.
2016-10-18 15:06:17 +00:00
christos ffeb8dbf4e Define _KERNTYPES for things that need it. 2016-01-23 21:22:45 +00:00
manu d5cd8e94ec Survive if filesystem installs a signal handler
We tested for signal(3) to return 0 for success, which is incorrect:
signal(3) returns the previous handler. Success should be tested as
!= SIG_ERR, otherwise we fail when a signal handler was previously
installed by perfused(8) parrent process, which happens to be the
FUSE filesystem.
2014-12-12 09:58:39 +00:00
manu 440aad5bad Remove a warning that happens when the filesystem cleanly exits. Just
display a message when running in debug mode.
2014-08-16 16:32:04 +00:00
riz d41e703879 Disable default build of debugging info. 2012-09-06 16:39:07 +00:00
manu 075ba0e590 - 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.
2012-07-21 05:49:42 +00:00
manu 1d0360b1c9 Add placeholder so that we can later add allbacks without breaking the ABI 2012-06-05 15:04:18 +00:00
joerg 520acca96b Mark perfused_panic as dead. Canonical form of infinite loops is
for (;;). Remove completely redundant NOTREACHED markers.
2012-02-04 18:36:30 +00:00
manu 9724ab82d4 Make sure perfused exit when the filesystem crashed, so that unmount
is done. Failure to do so caused deadlocks, with operation that
held a lock on the root vnode and got stuck in perfused forever.

Approved by releng.
2012-02-03 15:54:15 +00:00
christos 109f5fba24 - remove dup included files
- use intptr_t instead of long where appropriate
- use perfused_ instead of perfuse_ for our own functions.
- more static
Fixes namespace collision of perfuse_mount with this and libperfuse.
2012-01-30 22:49:03 +00:00
wiz f4788d8f8e New sentence, new line. Remove trailing whitespace.
Bump PKGREVISION for previous.
2012-01-29 11:32:23 +00:00
manu 8fcbc70792 Improve FUSE trace facility 2012-01-29 06:22:01 +00:00
joerg 5454e8a044 Rename perfuse_mount to not conflict with libperfuse. Mark it and
perfuse_trace as static.
2012-01-17 17:58:36 +00:00
wiz 8da3566432 Improve markup, remove tailing whitespace. 2011-12-28 18:56:38 +00:00
manu 4fba06add5 Add a FUSE trace facility, with statistics collection. This should help
tracking bugs and performance issues
2011-12-28 17:33:52 +00:00
wiz 4486afd401 Sort sections. Remove trailing whitespace. 2011-12-16 12:51:43 +00:00
manu a3a1865132 Document a bug when processes hang on uvn_fp2. FWIW, hung process exhibit
this stack backtrace:
sleepq_block
mtsleep
uvn_findpage
uvn_findpages
genfs_getpages
puffs_vnop_getpages
puffs_vnop_checkop
VOP_GETPAGES
uvn_get
uvm_fault_internal
trap
copyin
uiomove
ubc_uiomove
puffs_vnop_write
puffs_vnop_checkop
VOP_WRITE
vn_write
dofilewrite
sys_write
syscall
2011-12-16 10:57:43 +00:00
manu ff9e6ef6d0 Fix the confusion between nodeid and inode numbers 2011-10-30 05:17:41 +00:00
manu df227937ba openlog with LOG_NDELAY so that pzerfused does not deadlock later
on vnode recycling because it wants to log a message.

Patch from Manuel Bouyer.
2011-10-23 05:03:37 +00:00
manu 5a6d3e75bd 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.
2011-09-09 15:45:28 +00:00
joerg 9b838647dd Fast backward code to 1989 and use ANSI C consistently. Use __dead. 2011-08-30 20:17:00 +00:00
manu f8584de4e3 Fix warning 2011-08-09 07:00:13 +00:00
manu fb0fa57f18 Fix creds passed to FUSE when requests are done on behalf of the kernel.
We previously sent uid/gid set to -1, we now set it to 0.
2011-08-02 14:53:38 +00:00
manu 26381d518d 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
2011-05-30 14:50:08 +00:00
joerg a216da57a6 Default to -Wno-sign-compare -Wno-pointer-sign for clang.
Push -Wno-array-bounds down to the cases that depend on it.
Selectively disable warnings for 3rd party software or non-trivial
issues to be reviewed later to get clang -Werror to build most of the
tree.
2011-05-26 12:56:24 +00:00
njoly 1199515b5b Fix prologue macros order. 2011-05-10 12:16:18 +00:00
manu 73963ae9de Enable the build of perfused and libperfuse 2011-05-09 08:51:08 +00:00
manu dfdc5ae18f Display actual error from FUSE on failures 2011-05-06 13:45:35 +00:00
manu 33c1bbe9da - fix warnings
- try to handle ENOBUFS in a nicer way
- use errx() for usage message, not err(), as we do not waht strerror(errno)
2011-04-25 04:30:59 +00:00
manu f4f951a0c1 Remove code supporting SOCK_STREAM, as SOCK_DGRAM works fine 2010-10-11 05:37:58 +00:00
manu 160a586559 Interm hack raising buffers for /dev/fuse socket used in the filesystem.
This works around read(2) system callsfailing with ENOBUFS.

This is a hack bedause there is no way to know that 4 * FUSE_BUFSIZE
will be enough to hold queued FUSE frames. It seems good enough at
mine.
2010-10-11 01:12:25 +00:00
manu bcf6f2f32a == 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
2010-09-23 16:02:34 +00:00
manu 7ba588b3fb - Add debug santity checks
- Do not request peer creds anymore once we have them.
2010-09-20 06:45:38 +00:00
manu e9a8a6acc0 - 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...)
2010-09-15 01:51:43 +00:00
manu 1e672db8d2 - Do not checkfor peer credentials when perfused is autostarted and
therefore runs with filesystem privileges

- shut up warnings and debug messages when perfused is autostarted

- make perfused patch modifiable with CFLAGS for easier pkgsrc integration

- Fix build warnings
2010-09-07 02:11:04 +00:00
wiz 95b8a1f9e8 Fix some typos in messages. Make usage match manpage. 2010-09-06 13:15:29 +00:00
manu 5536686b23 More LP64 fixes 2010-09-06 01:40:24 +00:00
manu ef7e1877ae Build fixes for LP64 2010-09-01 14:57:24 +00:00
wiz cd9eb5b6d8 Various fixes and improvements. 2010-08-27 18:12:51 +00:00
manu 1326029781 - 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
2010-08-27 09:58:17 +00:00
manu 516b1c9016 - 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!
2010-08-26 13:29:01 +00:00
manu a18d4c5a69 perfused(8) creates a /dev/fuse socket and performs PUFFS to FUSE relaying.
This is still a work in progress.
2010-08-25 07:18:01 +00:00