Commit Graph

438 Commits

Author SHA1 Message Date
rillig 388550b026 lib: remove CONSTCOND comment
Since 2021-01-31, lint doesn't need it anymore for the common pattern of
'do ... while (0)'.
2022-04-19 20:32:14 +00:00
pho 0585557a98 Allow calling puffs_mount(3) before puffs_daemon(3)
puffs_daemon(3) creates a pipe before forking, and the parent process
waits for the child to either complete puffs_mount(3) or fail. If a
user calls puffs_daemon(3) after puffs_mount(3), the function
deadlocks. While this error-reporting functionality is really a nice
thing to have, deadlocking is not great. If the filesystem has already
been mounted, puffs_mount(3) should just daemonize the process and
return.

This became an issue because fuse_daemonize(3) in FUSE API had no such
requirement and some FUSE filesystems in the wild suffered deadlocks.
2022-01-22 07:35:26 +00:00
pho f347108ede Use size_t in place of voff_t in puffs_setrootinfo(3)
Chuck Silvers pointed out that voff_t was also supposed to be
kernel-only. The correct type to use in userland would be off_t, but
since changing vsize_t to either voff_t or off_t is an ABI change on
32-bit platforms, we use size_t knowing that it is technically
incorrect.
2021-12-03 17:12:17 +00:00
pho 52a1252312 Avoid using register_t or vsize_t in <puffs.h>
<puffs.h> is a user-space header, and should not use any of
kernel-only types. It's not reasonable to require user-land
filesystems to #define _KERNTYPES.
2021-12-03 14:00:59 +00:00
nia 8221e07e84 puffs(3): Replace realloc(x * y) with reallocarr 2021-10-30 10:34:18 +00:00
andvar 207defd036 Add missing double p and d for stopped and overriden accordingly.
Fix few more typos along the way, mainly in copy-pasted comments.
2021-09-11 20:28:03 +00:00
andvar 461f07c9e2 fix typos in puffs man pages. 2021-08-04 09:31:25 +00:00
christos e24596a734 cast to the proper enums for lint 2021-03-08 17:34:10 +00:00
msaitoh 417c7af79c s/conjuction/conjunction/ 2019-12-27 10:13:59 +00:00
tnn 3896b31418 puffs_null_node_fsync: don't leak directory handle
Directory handles returned by opendir must be closed by closedir.
Also directory(3) says we mustn't close(2) descriptors returned by dirfd(3)
2019-11-02 18:14:36 +00:00
christos 38a0431bfa Restore binary compatibility by using the statvfs90 structure internally. 2019-09-23 12:00:57 +00:00
christos 1765287814 revert previous now that MAP_ALIGNED has been fixed. 2018-07-09 00:47:47 +00:00
christos de03d6cb9a correct previous cast. 2018-07-08 16:48:47 +00:00
christos 606587dd27 cast for lint 2018-07-08 16:39:27 +00:00
christos a17e2f9d4b use a switch. 2018-06-30 16:05:44 +00:00
dholland 32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
christos 2b98159f0b fix error messages (use __func__, quotes)
also differentiate between canonical and non-relative.
2017-11-05 15:33:15 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
christos 65fe324251 remove now unnecessary casts. 2017-06-14 16:39:41 +00:00
christos 79e2355ab8 Adjust to prototype. 2017-05-31 17:56:00 +00:00
christos 518a4ef5c5 Only add a write filter for sockets. It is not supported for vnodes, or
for 1/2 closed fifos (which we both have now).
2017-05-09 21:15:30 +00:00
tnn 523a6b00a9 mention puffs_node_pathconf and puffs_node_advlock 2016-08-29 01:13:56 +00:00
christos 6b3f51ca99 there is no pflags, just flags. 2016-04-11 00:47:19 +00:00
christos ffeb8dbf4e Define _KERNTYPES for things that need it. 2016-01-23 21:22:45 +00:00
christos 05dbf82446 consistency fixes. 2015-11-12 17:51:05 +00:00
christos ab2f8d0338 fix return type 2015-11-09 15:12:12 +00:00
christos 5521b51a7a fix error messages 2015-06-17 00:15:26 +00:00
wiz bcb2129dc2 filesystem -> file system 2015-02-16 10:48:56 +00:00
wiz 8ca9874e72 Sort sections. 2015-02-16 10:48:50 +00:00
wiz 0c9e1ca798 Bump date for previous.
filesystem -> file system
2015-02-16 10:48:34 +00:00
manu 8abab6b782 Add PUFFS_KFLAG_NOFLUSH_META to prevent sending metadata flush to FUSE
FUSE filesystems do not expect to get metadata updates for [amc]time
and size, they updates the value on their own after operations.

The PUFFS PUFFS_KFLAG_NOFLUSH_META option prevents regular metadata cache
flushes to the filesystem , and libperfuse uses it to match Linux FUSE
behavior.

While there, fix a bug in SETATTR: do not update kernel metadata cache
from SETATTR reply when the request is asynchronous, as we do not have
the reply yet.
2015-02-15 20:21:29 +00:00
manu 8ee430e576 Do not warn about relative path because of trailing slash
libpuffs calls realpath() to obtain an absolute path to use for mounting.
If the obtained path is different from the one given by the caller, a
warning is issued. This included the situation where the path passed by
the caller just have trailing slashes, a situation where we just want them
to be striped without a warning.
2014-12-22 08:16:21 +00:00
wiz a2ba5a05a6 Bump date for previous. Remove trailing space. 2014-10-31 14:01:16 +00:00
manu cf73d5332b libpuffs support for fallocate and fdiscard operations 2014-10-31 13:56:04 +00:00
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
wiz 70e44a6c96 Bump date for previous. 2014-08-16 21:50:15 +00:00
manu ccfb03f9b0 Add an open2 method, like open but with an additionnal oflags used
by the filesystem to send back information about the file.
This is used to implement PUFFS_OPEN_IO_DIRECT by which the filesystem
tells the kernel that read/write should bypass the page cache.
2014-08-16 16:25:44 +00:00
riastradh 6cb10275d0 Merge riastradh-drm2 to HEAD. 2014-03-18 18:20:35 +00:00
christos 27c90c0e19 revert previous, will turn off globally. 2013-11-06 19:56:38 +00:00
christos 48ec4b4e3a XXX: gcc initialization (mc68k gcc-4.5.x gcc-4.8.x) 2013-11-06 19:50:10 +00:00
wiz a5684d07dd Use Mt for email addresses. 2013-07-20 21:39:55 +00:00
riastradh 8b3a72d661 Assert equality, not assignment, in puffs__fsframe_cmp. 2013-01-23 20:22:34 +00:00
wiz 9cdff3cdd6 Bump date for previous. 2012-08-16 11:28:48 +00:00
wiz 0e61416223 Whitespace fixes. Bump date for previous. 2012-08-16 11:28:38 +00:00
manu d256e38414 Fix regression that has been introduced when the lookup/reclaim race
condition was addressed in libpuffs by counting lookups.

The fix assumes that cookies map to struct puffs_cookie, which has not
been documented as a requirement for filesystems using libpuffs. As an
example, we got burnt by this assumption in libp2k (kern/46734), and
we fixed bit by actually mapping libp2k cookies to struct puffs_node.

It is unlikely, but there may be third party filesystems that use cookies
unmapped to struct puffs_node, and they were left broken for now.

- we introduce a puffs_init() flag PUFFS_FLAG_PNCOOKIE that let filesystems
inform libpuffs that they map cookies to struct puffs_node. Is that flag
is used, the lookup/reclaim race condition fix is enabled. We enable the
flag for libp2k.

- filesystems that use puffs_pn_new() obviouslty use struct puffs_node
and gain PUFFS_FLAG_PNCOOKIE automatically even if they did not specify
it in puffs_init(). This include all our PUFFS filesystem in-tree except
libp2k.

- for filesystems not willing to use struct puffs_node, we introduce a
reclaim2 vnop, which is reclaim with an additionnal lookup count argument.
This vnop let the filesystem implement the lookup/reclaim race fix on
its own.
2012-08-16 09:25:43 +00:00
wiz aceedc0215 Use more markup. New sentence, new line. Bump date for previous. 2012-08-10 21:00:45 +00:00
manu 2a9a80bb36 Add PUFFS_KFLAG_CACHE_DOTDOT so that vnodes hold a reference on their
parent, keeping them active, and allowing to lookup .. without sending
a request to the filesystem.

Enable the featuure for perfused, as this is how FUSE works.
2012-08-10 16:49:35 +00:00
manu 244cd4a742 Fix race condition between (create|mknod|mkdir|symlino) and reclaim, just
like we did it between lookup and reclaim.
2012-08-10 08:42:10 +00:00
njoly 6ddf50a26a Kill extra Fc macro. 2012-07-28 09:56:09 +00:00
manu 8502ba8ea3 - Improve PUFFS_KFLAG_CACHE_FS_TTL by reclaiming older inactive nodes.
The normal kernel behavior is to retain inactive nodes in the freelist
until it runs out of vnodes. This has some merit for local filesystems,
where the cost of an allocation is about the same as the cost of a
lookup. But that situation is not true for distributed filesystems.
On the other hand, keeping inactive nodes for a long time hold memory
in the file server process, and when the kernel runs out of vnodes, it
produce reclaim avalanches that increase lattency for other operations.

We do not reclaim inactive vnodes immediatly either, as they may be
looked up again shortly. Instead we introduce a grace time and we
reclaim nodes that have been inactive beyond the grace time.

- Fix lookup/reclaim race condition.

The above improvement undercovered a race condition between lookup and
reclaim. If we reclaimed a vnode associated with a userland cookie while
a lookup returning that same cookiewas inprogress, then the kernel ends
up with a vnode associated with a cookie that has been reclaimed in
userland. Next operation on the cookie will crash (or at least confuse)
the filesystem.

We fix this by introducing a lookup count in kernel and userland. On
reclaim, the kernel sends the count, which enable userland to detect
situation where it initiated a lookup that is not completed in kernel.
In such a situation, the reclaim must be ignored, as the node is about
to be looked up again.
2012-07-21 05:17:10 +00:00