Commit Graph

591 Commits

Author SHA1 Message Date
Antonio SJ Musumeci
610c75fa90 properly return const ref from tofrom string wrapper 2020-09-19 18:57:13 -04:00
Antonio SJ Musumeci
767039c492 option_parser: return 0 when requesting help or version 2020-09-10 21:58:23 -04:00
Antonio SJ Musumeci
fc3453932a branches: add per branch minfreespace w/ original value as default
example: /mnt/disk0=RW,1G:/mnt/disk1=RW,2G
2020-09-04 21:04:45 -04:00
Antonio SJ Musumeci
6311df774d optionally use lchmod depending on if on Linux or not (BSD) 2020-08-26 12:44:32 -04:00
Antonio SJ Musumeci
046844083f add {,ep,msp}pfrd policies
Percentage Free Random Distribution

Chooses a random branch based on the available space percentage free.

IE: if branch A has 1G free and branch B has 2G then B should be chosen
twice as often.
2020-08-25 22:19:01 -04:00
Antonio SJ Musumeci
7fd629ebf3 add #warning to make it more obvious what versions of functions are used 2020-08-18 19:28:36 -04:00
Antonio SJ Musumeci
2fe20b888e clean up and separate out fs_* files 2020-08-18 19:28:36 -04:00
Antonio SJ Musumeci
2696079601 break fs.hpp up into separate files 2020-08-18 19:28:36 -04:00
Antonio SJ Musumeci
ec15872a1f cleanup function signatures and definitions 2020-08-18 19:28:36 -04:00
Antonio SJ Musumeci
6cc6524997 change category to enum class 2020-08-18 19:28:36 -04:00
Antonio SJ Musumeci
0371b047f9 change from fasthash64 to wyhash
wyhash has very good performance for small keys (our usecase) and
works on platforms with alignment concerns.

A user had an issue where fasthash64 lead to misaligned reads and
signal exceptions. wyhash does not have such issues and is faster.
2020-08-06 19:00:05 -04:00
Antonio SJ Musumeci
30d13b7f77 inodecalc: add 32bit versions of hashs 2020-08-03 19:42:06 -04:00
Antonio SJ Musumeci
5989d41a86 readdir: use getdents64 for compatibility with ARM64 2020-08-02 18:43:09 -04:00
Antonio SJ Musumeci
0709b2e447 add missing options to usage 2020-07-30 16:55:18 -04:00
Antonio SJ Musumeci
15a0aedd25 cleanup: move some config data structures to separate files 2020-07-29 21:42:43 -04:00
Antonio SJ Musumeci
a93bd9f7fa freebsd: misc cleanups to get freebsd compiling 2020-07-29 13:08:38 -04:00
Antonio SJ Musumeci
139e61efaa nfsopenhack: remove empty file check 2020-07-26 17:11:06 -04:00
Antonio SJ Musumeci
93218a343a NFS open/creat hack
A hack to work around non-POSIX NFS <-> FUSE behavior where it turns
an open(O_EXCL|O_CREAT,0444) into multiple calls that results in
EACCES.
2020-07-23 19:36:10 -04:00
Antonio SJ Musumeci
3ec137c4ad policy: add "most shared path" policies
Like path preserving but walks back the path till a match is found. Should
cover the usecase where someone wants a "less strict" form of path
preservation.
2020-07-21 16:31:08 -04:00
Andrea Gelmini
3a6738475a Fix typos 2020-07-20 13:01:33 +02:00
Andrea Gelmini
468d42088a Removed duplicated include 2020-07-20 12:51:44 +02:00
Antonio SJ Musumeci
08d267fc61 moveonenospc: enhance the feature to allow using a policy
Just like functions you can now set a policy for moveonfreenospc. This
allows for more flexibility.

For backwards compatibility moveonfreenospc=true is converted to
moveonfreenospc=mfs.

minfreespace does apply which is slightly different from original behavior.
2020-07-15 19:33:05 -04:00
Antonio SJ Musumeci
c0990644e8 remove unnecessary libfuse flags nopath, nullpath_ok, and utime_omit_ok 2020-07-08 19:25:23 -04:00
Antonio SJ Musumeci
b4397f7f2e add 'inodecalc' option to allow selection of inode calculation algo 2020-06-28 20:02:07 -04:00
Antonio SJ Musumeci
dbdd3e22fc additional readdir refactor cleanup
Differences between readdir and getdents is minimal at best. Leaving code
for now to allow for possible expansion later.
2020-06-27 23:17:21 -04:00
Antonio SJ Musumeci
54c41c4994 rework config management
* Add standard way to do str2val and val2str conversion
* Add support for a config file
* Add support for reading and writing settings via ioctl
2020-06-18 18:54:25 -04:00
Antonio SJ Musumeci
698c4147fc fix getdent name length calculation 2020-03-12 23:45:20 -04:00
Antonio SJ Musumeci
3a46ec9fab fix filename hashing error 2020-03-07 12:09:40 -05:00
Antonio SJ Musumeci
9b2634a1e5 fix name length calculation for musc 2020-02-29 17:15:29 -05:00
Antonio SJ Musumeci
62873d2d3b use getdents64 on linux 2020-02-28 20:34:12 -05:00
Antonio SJ Musumeci
d119807adb restructure readdir, add readdir_plus
Does not enable READDIR_AUTO. Might add in the future.
2020-02-22 19:45:52 -05:00
Antonio SJ Musumeci
a646fe016d change inode conversion algo to reduce collision 2020-02-12 21:05:52 -05:00
Antonio SJ Musumeci
576ff3694e add cache.writeback to xattrs 2020-02-12 19:48:37 -05:00
Antonio SJ Musumeci
903d39f968 add writeback caching 2020-02-09 21:08:53 -05:00
Antonio SJ Musumeci
4d82ed9324 fix short writes on >2GB files when cloning file 2019-10-14 23:32:51 -04:00
Antonio SJ Musumeci
0fffabfbe3 only return 1 branch for rand/eprand policies 2019-09-07 17:25:06 -04:00
Antonio SJ Musumeci
50ad648ce4 initialize mutex to fix lockup 2019-09-07 14:10:36 -04:00
Antonio SJ Musumeci
4c4c27a93e set uid & gid when calling ioctl
Turns out certain ioctl calls check the effective user id (FS_IOC_SETFLAGS).
2019-06-17 13:37:15 -04:00
Antonio SJ Musumeci
5ca928e436 accept old arguments for backwards compatibility 2019-06-10 20:20:41 -04:00
Antonio SJ Musumeci
7cbd88ac81 allow setting of 'max_pages' (via 'fuse_msg_size')
Linux 4.20 and above allow setting the number of pages per FUSE message
upto 256 (4K * 256 = 1MiB). This can greatly increase read and write
speeds depending on the workload.
2019-06-03 21:01:19 -04:00
Antonio SJ Musumeci
8cb7195c3e add copy_file_range support 2019-06-03 07:12:05 -04:00
Antonio SJ Musumeci
529a953e30 add file caching across opens and runtime control 2019-05-30 00:10:08 -04:00
Antonio SJ Musumeci
ddf6a2f105 make async_read optional again 2019-05-28 15:57:50 -04:00
Antonio SJ Musumeci
2323c16316 add readdir caching 2019-05-23 22:11:33 -04:00
Antonio SJ Musumeci
1baa706d37 add symlink caching 2019-05-22 19:25:38 -04:00
Antonio SJ Musumeci
61cded5b34 fix for unlink race condition 2019-05-21 22:57:02 -04:00
Antonio SJ Musumeci
5f2221155c ensure parallel dirops is enabled if capable 2019-05-20 00:36:42 -04:00
Antonio SJ Musumeci
2b019b84b0 ensure async_aio is enabled if capable 2019-05-20 00:18:56 -04:00
trapexit
af1c0d78e8
Merge pull request #621 from trapexit/posix-acl
add support for POSIX ACLs
2019-05-19 18:26:49 -04:00
Antonio SJ Musumeci
80d56ac94e add support for POSIX ACLs 2019-05-19 18:17:55 -04:00
Antonio SJ Musumeci
1ca70521a4 remove 'remote' flock support 2019-05-19 17:34:56 -04:00
Antonio SJ Musumeci
e052446713 fix setting of fsname 2019-05-12 14:07:21 -04:00
Antonio SJ Musumeci
5883020784 tweak docs 2019-05-10 11:54:41 -04:00
Antonio SJ Musumeci
6ecc618d83 remove .fuse_hidden file creation
addresses #521

mergerfs is written using libfuse's high level API. The HLAPI forces a certain
behavior with regard to unlinking or rename overwriting of open files. It
renames the file to .fuse_hiddenXXXXXX and when incoming requests refer
to the unlinked file it will use path based calls and use that path.

This behavior leads to rmdirs failing or some software noticing
the .fuse_hidden files.

This patch changes the HLAPI and removes entirely the .fuse_hidden behavior.

See the README for more.
2019-04-13 21:41:51 -04:00
Antonio SJ Musumeci
2a075ead92 fall back to other file copy methods in clonefile 2019-04-13 15:08:13 -04:00
Antonio SJ Musumeci
b69819e4b2 ioctl: don't set outbufsz when not needed 2019-03-20 10:18:55 -04:00
Antonio SJ Musumeci
0918dfd117 make attr, entry, negative_entry cache timeouts runtime configurable 2019-02-23 01:03:20 -05:00
Antonio SJ Musumeci
95c0cc741d replace libfuse's autoconf with makefile 2019-02-18 21:36:32 -05:00
Antonio SJ Musumeci
7bf607bb6b fix FS_IOC_{GET,SET}{FLAGS,VERSION} ioctl calls 2019-02-17 11:48:19 -05:00
Antonio SJ Musumeci
940c323251 misc fixes for FreeBSD 2019-02-06 23:20:28 -05:00
Antonio SJ Musumeci
5ab7d2dd72 remove O_LARGEFILE 2019-02-06 21:06:11 -05:00
Antonio SJ Musumeci
9d9ee7b71d general code cleanup 2019-01-31 22:47:09 -05:00
Antonio SJ Musumeci
c5b2415daf remove defaults, hard code atomic_o_trunc, big_writes, and default_permissions
`defaults` is a value used by all filesystems and isn't passed through to
mergerfs when mounting via the fstab or the mount command. This led
to inconsistent application of options. atomic_o_trunc, big_writes, and
default_permissions should be enabled all the time anyway and splice_*
can lead to issues so they are not always enabled.
2019-01-30 22:46:21 -05:00
Antonio SJ Musumeci
5be7e007ce add statfs cache 2019-01-23 23:06:07 -05:00
Antonio SJ Musumeci
7a057daa0c add policy cache for 'open'
A fusepath -> basepath cache for `open` to limit the overhead of FUSE in 'open, read/write, close' patterns (such as Transmission).
2019-01-22 09:21:15 -05:00
Antonio SJ Musumeci
9fd3b968fc make ioctl on directories use open policy 2019-01-18 22:41:52 -05:00
Antonio SJ Musumeci
87b2795f2b set direct_io per open/create, now runtime configurable 2019-01-11 15:23:14 -05:00
Antonio SJ Musumeci
10f7f8bdea optimize link_cow eligibility check 2019-01-04 10:21:28 -05:00
Antonio SJ Musumeci
dfa1c1ad6f check minfreespace on newest policy create 2018-12-12 15:53:53 -05:00
Antonio SJ Musumeci
6ae68465cf fix building on alpine w/ musl 2018-11-28 17:08:40 -05:00
trapexit
3c1f19e85a
Merge pull request #534 from trapexit/xattr
change xattr setting notsup to nosys
2018-11-19 23:32:07 -05:00
Antonio SJ Musumeci
7d9458fdd1 change xattr setting notsup to nosys 2018-11-19 23:30:39 -05:00
Antonio SJ Musumeci
43b676a6e2 fix indexing of truncate targets 2018-11-19 23:25:16 -05:00
Antonio SJ Musumeci
c46134c03a fix building on platforms without O_PATH 2018-11-06 07:59:28 -05:00
Antonio SJ Musumeci
3631ab7df2 optimize readdir file dedup
Use fasthash64 to hash filenames to uint64_t and store in khash
set. Significantly reduces malloc/free'ing and memory usage.
2018-11-06 00:05:30 -05:00
Antonio SJ Musumeci
680f8194f9 add ability to change statfs behavior 2018-11-05 21:33:27 -05:00
Antonio SJ Musumeci
7524e57262 rename NW (no write) to NC (no create) 2018-11-01 23:37:45 -04:00
Antonio SJ Musumeci
b55ebba4ed add tagging branches RW/RO/NW
This allows users to tag a branch as readonly or not for writing regardless
of how the filesystem is mounted. Should simplify deployments and offer
more flexibility.
2018-11-01 23:13:49 -04:00
Antonio SJ Musumeci
9e0ab1f518 misc cleanups 2018-10-24 22:38:36 -04:00
Antonio SJ Musumeci
8a48b74cb4 policy return cleanup 2018-10-15 19:03:02 -04:00
Antonio SJ Musumeci
85026d5780 add FICLONE and copy_file_range to clonefile
If available FICLONE and copy_file_range will be tried in addition to sendfile
when copying data between two files. The fallback is a tradition read/write
loop. On systems that support these it should improve performance.
2018-10-12 10:18:49 -04:00
Antonio SJ Musumeci
1885a82cce remove libattr dependency 2018-10-09 13:50:45 -04:00
Antonio SJ Musumeci
65f482e483 add ability to turn on/off xattr support at runtime 2018-10-09 08:41:31 -04:00
Antonio SJ Musumeci
8d1a1564bf fix building on certain platforms 2018-10-09 08:23:37 -04:00
Antonio SJ Musumeci
93f7d7d927 add link_cow feature
When enabled if a regular file is opened which has a link count > 1 it will
copy the file to a temporary file and rename over the original. Effectively
breaking the link. This behavior is similar to cow-shell and other LD_PRELOAD
based "CoW" solutions.
2018-10-06 22:05:05 -04:00
Antonio SJ Musumeci
9afefef032 keep literal when glob fails 2018-10-01 16:56:40 -04:00
Antonio SJ Musumeci
f8563369bc add security_capability option 2018-09-30 23:30:53 -04:00
Andrey Mazo
ec6adaa376
options: move "-o threads=" help text to libfuse/
Parsing of and acting upon "-o threads" option is done in the bundled `libfuse/`,
so move the corresponding help text there too.
This make help text consistent with behavior
when building against system libfuse,
which doesn't support this option.
2018-08-19 21:04:35 +03:00
Antonio SJ Musumeci
9830e29945 fix version generation 2018-03-09 21:06:00 -05:00
Antonio SJ Musumeci
cfe9c28a10 ignore clonepath metadata errors. fixes #470 2018-03-08 16:55:35 -05:00
Antonio SJ Musumeci
f48c16d162 stop clonepath at base directory. fixes #467 2018-03-07 18:46:32 -05:00
Antonio SJ Musumeci
1d6d22727c call 32bit versions of set/geteuid on 32bit platforms 2017-10-17 22:21:29 -04:00
Antonio SJ Musumeci
75ed37a11a add setting of thread pool size 2017-07-02 23:50:39 -04:00
Antonio SJ Musumeci
0708110ec1 improve khash performance 2017-07-01 11:53:35 -04:00
Antonio SJ Musumeci
a7b126cb48 use pragma once in headers 2017-06-30 11:38:34 -04:00
Antonio SJ Musumeci
a2bddec8c7 add 'ignore path preserving on rename' feature 2017-06-30 00:01:00 -04:00
Antonio SJ Musumeci
aea2b40dda use temp files (then rename) when moving files for moveonenospc 2017-06-28 21:17:47 -04:00
Antonio SJ Musumeci
bfd410def2 use fusepath from fileinfo. closes #417 2017-06-24 17:03:41 -04:00
Antonio SJ Musumeci
7296d3d90d add time.h to fix compiling on some platforms 2017-06-15 19:35:28 -04:00
Antonio SJ Musumeci
de0985c135 add libfuse 2.9.7 to repo and build against libfuse.a 2017-06-02 11:25:25 -04:00
Antonio SJ Musumeci
87c2f2f9dc add nullrw feature to facilitate benchmarking 2017-05-26 18:11:18 -04:00
Antonio SJ Musumeci
6a7675f2bf symlinkify: file -> symlink-to-original-file after timeout 2017-05-05 00:14:04 -04:00
Antonio SJ Musumeci
8ba3a08f40 make dropcacheonclose runtime configurable 2017-04-21 16:58:39 -04:00
Antonio SJ Musumeci
ccaa458739 better handle incomplete reads/writes in copying files 2017-04-13 12:55:34 -04:00
Antonio SJ Musumeci
162b99e6b8 enable nopath and nullpath_ok 2017-04-12 13:52:06 -04:00
Antonio SJ Musumeci
f15437c713 tweak movefile behavior 2017-04-11 15:24:09 -04:00
Antonio SJ Musumeci
2fbeb67dd9 hide fs::fadvise as it's not used directly 2017-04-11 09:42:33 -04:00
Antonio SJ Musumeci
8b976ab3c1 support older libfuse without utime_omit_ok flag 2017-04-11 09:23:40 -04:00
Antonio SJ Musumeci
1a1fa06aa3 fadvise cleanup 2017-04-11 09:02:05 -04:00
Antonio SJ Musumeci
617195d71e enable utime_omit_ok flag 2017-04-10 21:36:56 -04:00
Antonio SJ Musumeci
be3eb7e3ed work around getgrouplist signature difference on osx 2017-04-07 16:23:18 -04:00
Antonio SJ Musumeci
0600734942 handle 32bit and 64bit inode recalculation 2017-04-07 09:47:19 -04:00
Antonio SJ Musumeci
9d0798dbfb restructure fadvise 2017-04-07 00:12:57 -04:00
Antonio SJ Musumeci
e2acffe55b restructure fallocate abstraction 2017-04-06 23:35:31 -04:00
Antonio SJ Musumeci
42d454ac27 abstract futimesat 2017-04-06 23:13:02 -04:00
Antonio SJ Musumeci
0b2bf17cd7 abstract access to highres atime/mtime 2017-04-06 22:16:17 -04:00
Antonio SJ Musumeci
e20d566f96 use correct integer types 2017-04-06 21:29:39 -04:00
Antonio SJ Musumeci
c043ef95a3 make fs::attr return ENOTSUP on EINVAL #381 2017-04-03 21:11:20 -04:00
Antonio SJ Musumeci
6aa62d03ff add option to drop file caches before closing files 2017-02-18 16:06:29 -05:00
Antonio SJ Musumeci
492d895632 check metadata on chown/chmod errors when cloning 2017-02-15 09:08:27 -05:00
Antonio SJ Musumeci
9cc9bb9de2 misc document updates 2017-01-31 19:10:54 -05:00
Antonio SJ Musumeci
a60d815e92 add ifndefs to all headers 2017-01-17 11:45:44 -05:00
Antonio SJ Musumeci
e93c946198 limit need to explicitly call .c_str() 2017-01-17 11:45:44 -05:00
Antonio SJ Musumeci
7b4e1ea36d remove clone command 2017-01-17 11:45:44 -05:00
Antonio SJ Musumeci
726b88e039 restructure error calculation 2017-01-17 11:45:43 -05:00
Antonio SJ Musumeci
d67d5dec77 check for system.posix_acl_default before setting umask 2017-01-16 12:19:58 -05:00
Antonio SJ Musumeci
1aa76a54c2 use different read and write functions when using direct_io 2016-12-20 17:06:34 -05:00
Antonio SJ Musumeci
67b48fcb3a compute inode in readdir 2016-12-16 10:57:24 -05:00
Antonio SJ Musumeci
c8fa51c81a support setting of inodes (using use_ino option)
creates a 64bit inode value from the underlying device value + original inode

final_ino = orig_ino | (dev << 32)

not perfect but given few filesystems use 64bit inodes nor is st_dev more than 16bit usually it should be fine
2016-12-14 18:53:21 -05:00
Antonio SJ Musumeci
822204ff34 replace std::set with klib's khash to increase readdir performance 2016-12-14 17:24:48 -05:00
Antonio SJ Musumeci
35075bb0cd return clonepath errors
currently the error is ignored and it was expected the primary call would
fail. problem is it returns confusing errors as a result. (eg ENOENT vs EPERM)
2016-12-06 16:48:52 -05:00
Antonio SJ Musumeci
3c5351af93 ignore filesystems which return zeros for statfs. closes #335 2016-11-15 23:27:17 -05:00
Antonio SJ Musumeci
157dae0d2f define O_LARGEFILE and O_NOATIME if needed 2016-10-28 22:04:15 -04:00
Antonio SJ Musumeci
00c814dc58 consolidate and simplify utime 2016-10-28 22:04:09 -04:00
Antonio SJ Musumeci
6d6fb45a3b check if fdatasync is available and return ENOSYS if not 2016-10-27 16:59:04 -04:00
Antonio SJ Musumeci
d0b6cd1f38 further abstraction of system calls 2016-10-20 16:51:49 -04:00
Antonio SJ Musumeci
1dc7bff6e6 wrap most posix filesystem functions 2016-10-19 16:58:52 -04:00
Antonio SJ Musumeci
8f594e17d7 add flock 2016-10-19 11:58:44 -04:00
Antonio SJ Musumeci
3fb7f8919a add EDQUOT to errors which trigger moveonenospc 2016-10-06 13:54:57 -04:00
Antonio SJ Musumeci
d9a79062b8 use SYS_setgroup32 syscall if available. closes #319 2016-09-19 17:04:11 -04:00
Antonio SJ Musumeci
7e423cd9ce small tweaks to build on Debian kFreeBSD 2016-09-14 08:36:06 -04:00
Antonio SJ Musumeci
0395e7c776 fix futimes version of utimes wrapper 2016-09-13 21:30:45 -04:00
Antonio SJ Musumeci
93923177ee fix #define typo 2016-09-13 17:40:23 -04:00
Antonio SJ Musumeci
1513c92cbc abstract posix_fadvise 2016-09-13 17:36:28 -04:00
Antonio SJ Musumeci
1a698e5ef5 rename include cpp files to have icpp extension 2016-08-26 14:41:56 -04:00
Antonio SJ Musumeci
2ee6b4f581 include sys/types.h to pick up ssize_t 2016-08-26 13:09:15 -04:00
Antonio SJ Musumeci
709dda5069 support systems without ENODATA 2016-08-26 12:59:32 -04:00
Antonio SJ Musumeci
49474f01ca make futimes crossplatform 2016-08-07 14:42:54 -04:00
Antonio SJ Musumeci
f7547d7cf5 Merge pull request #299 from trapexit/realpath
use dynamic buffer for realpath
2016-08-04 17:14:09 -04:00
Antonio SJ Musumeci
bb02ab2cba Merge pull request #298 from trapexit/fssendfile
split sendfile wrapper into separate files
2016-08-04 17:13:28 -04:00
Antonio SJ Musumeci
34d38cb0fb split sendfile wrapper into separate files 2016-08-04 17:11:23 -04:00
Antonio SJ Musumeci
192a9d54d1 make fs_attr compile on unsupported platforms 2016-08-04 17:10:02 -04:00
Antonio SJ Musumeci
40574bd138 use dynamic buffer for realpath 2016-08-04 14:52:27 -04:00
Antonio SJ Musumeci
45f757dc60 add osx version of fallocate 2016-08-02 17:14:45 -04:00
Antonio SJ Musumeci
0fceb8e0a3 add epall and eprand policies 2016-08-01 16:08:02 -04:00
Antonio SJ Musumeci
7634eb1440 replace nonstandard eaccess with POSIX.1-2008 faccessat 2016-07-29 12:39:44 -04:00
Antonio SJ Musumeci
a93ab6c2f5 add existing path first found policy. closes #289 2016-07-11 20:42:56 -04:00
Antonio SJ Musumeci
43cbd9c670 move size calculations to use uint64_t. fixes #287 2016-07-11 09:04:47 -04:00
Antonio SJ Musumeci
cb35a374ac rework fallocate logic 2016-05-11 13:19:44 -04:00
Antonio SJ Musumeci
23b8e4582e fix ioctl on directories 2016-05-11 11:22:00 -04:00
Antonio SJ Musumeci
be6341e6f0 create eplus (existing path, least used space) policy. closes #273 2016-05-07 15:15:51 -04:00
Antonio SJ Musumeci
f7d3e8bf47 create lus (least used space) policy. closes #273 2016-05-07 14:59:42 -04:00
Antonio SJ Musumeci
070ed08caa properly check errors of xattr. closes #255 2016-03-10 18:37:09 -05:00
Antonio SJ Musumeci
2061211894 fix rename failing on non-path preserving policies 2016-03-06 02:21:23 -05:00
Antonio SJ Musumeci
12cf57dc5a re-add minfreespace check to epmfs policy 2016-03-04 13:52:31 -05:00
Antonio SJ Musumeci
4ecf3c5797 clearly separate usage of statvfs from stat for file existance
Used statvfs to also check for existance vs lstat. On dead symlinks
this resulted in ENOENT making certain functions fail.

closes #239
2016-02-29 23:04:59 -05:00
Antonio SJ Musumeci
779143f4b6 add minfreespace checks to policy ff's create and remove fwfs
fwfs is now covered by ff with the minfreespace and readonly checks
2016-02-29 18:06:59 -05:00
Antonio SJ Musumeci
14886a27f4 add readonly and minfreespace filters to all policy for creates. closes #236 2016-02-29 10:15:53 -05:00
Antonio SJ Musumeci
9819cf6133 fix clonepath being called on wrong source 2016-02-26 17:16:09 -05:00
Antonio SJ Musumeci
e593927095 normalize error handling in rename policy 2016-02-24 17:10:56 -05:00
Antonio SJ Musumeci
7c85cd906a ff policy tweaks 2016-02-24 12:40:02 -05:00
Antonio SJ Musumeci
5cf3bb7c98 override standard libfuse version flag 2016-02-24 06:36:33 -05:00
Antonio SJ Musumeci
25a039942c minor tweaks to filesystem utility functions 2016-02-23 12:28:20 -05:00
Antonio SJ Musumeci
792c9b9808 use stat/2 rather than statvfs/2 to find file drive 2016-02-23 12:06:16 -05:00
Antonio SJ Musumeci
d4ec341c4f remove unnecessary policies 2016-02-21 18:24:15 -05:00
Antonio SJ Musumeci
5813d1e477 ignore drives mounted as readonly from create policies. closes #224 2016-02-21 14:34:40 -05:00
Antonio SJ Musumeci
f3e75a0544 use stat.st_dev to uniquely identify mounts for statfs. closes #213 2016-02-15 22:55:47 -05:00
Antonio SJ Musumeci
b3248a8f78 simplify policies 2016-02-15 02:06:58 -05:00
Antonio SJ Musumeci
7bf1ca45e4 add existing path, least free space policy. closes #216 2016-02-12 10:06:41 -05:00
Antonio SJ Musumeci
6086620e23 use references to srcmounts rather than copies 2016-02-11 21:09:31 -05:00
Antonio SJ Musumeci
f779f82ed6 fix statvfs drive dedup. closes #209 2016-01-22 10:15:24 -05:00
Antonio SJ Musumeci
ea325755a7 make symlink function like mknod/mkdir. closes #204 2016-01-20 17:55:20 -05:00
Antonio SJ Musumeci
1d1694bbb5 fix indexing of mknod targets. closes #202 2016-01-20 17:24:50 -05:00
Antonio SJ Musumeci
25265f4e85 dedup based on full statvfs struct rather than fsid. closes #183 2016-01-20 16:44:05 -05:00
Antonio SJ Musumeci
62f8fc524e have link act similar to rename
closes #193
2016-01-19 16:08:02 -05:00
Antonio SJ Musumeci
242af777be move from MIT to ISC license. closes #194 2016-01-14 16:56:38 -05:00
Antonio SJ Musumeci
4c77ac4d24 all action functions return success should at least one succeed. closes #189 2016-01-14 07:58:57 -05:00
Antonio SJ Musumeci
a3e6a0352d rework rename algo to minimize likelihood of EXDEV being returned. closes #187 2016-01-12 16:23:12 -05:00
Antonio SJ Musumeci
eb6d1a1bc2 change to using template for policy class 2015-12-29 16:14:37 -05:00
Antonio SJ Musumeci
c731b7035c fix building without xattr 2015-12-14 18:48:04 -05:00
Antonio SJ Musumeci
9e24796429 add mergerfs pid to xattrs 2015-12-07 21:20:12 -05:00
Antonio SJ Musumeci
5e880bddba use SYS_setgroups rather than setgroups 2015-10-29 23:20:37 -04:00
Antonio SJ Musumeci
93cedabe9c fix misc issues flagged by clang scan-build 2015-10-22 18:06:11 -04:00
Antonio SJ Musumeci
1c7de2d83e fix minor integer casting issues 2015-10-13 23:33:33 -04:00
Antonio SJ Musumeci
58446f9124 misc fixes to compile on older platforms 2015-10-12 19:51:57 -04:00
Antonio SJ Musumeci
40f569be37 rewrite gid cache system
Uses fixed storage so as to not require C++11 local thread storage or memory allocation.
2015-10-11 15:01:57 -04:00
Antonio SJ Musumeci
53e3284b26 remove usage of UINT32_MAX macro 2015-10-01 10:26:12 -04:00
Antonio SJ Musumeci
09ffc8c903 provide usage text and version info. closes #146 2015-09-29 07:29:10 -04:00
Antonio SJ Musumeci
5808ab7795 move on enospc when writing feature. closes #141
This feature mimics the standard mhddfs behavior but is more thorough.
If a write fails and the errno is set to ENOSPC then mergerfs will (if
the feature is enabled) attempt to move the file to the drive with
the most free space but only if it has enough room for the file plus
the amount to be written. If that transfer is successful it will then
unlink the original file and attempt the previously failed write again.

The copy includes copying the path and file including the acls, owners,
attributes, extended attributes, and timestamps.
2015-09-25 15:14:17 -04:00
Antonio SJ Musumeci
a960a7ef46 cleanup controlfile manipulation 2015-09-14 22:40:49 -04:00
Antonio SJ Musumeci
e0cf97261c include default_permissions in default arguments
closes #130
2015-09-14 22:12:24 -04:00
Antonio SJ Musumeci
3163258a33 make changing credentials opportunistic + per thread setgroups cache
closes #129,#131
2015-09-14 19:00:07 -04:00
Antonio SJ Musumeci
ce9352987c realpath'ize all source mount points. closes #117 2015-09-06 18:24:36 -04:00
Antonio SJ Musumeci
2d899479c3 fix non-suffixed setxattr of user.mergerfs.minfreespace 2015-09-05 23:08:11 -04:00
Antonio SJ Musumeci
b22528bac4 add user.mergerfs.version xattr 2015-09-05 21:48:15 -04:00
Antonio SJ Musumeci
e377d54c93 add user.mergerfs.policies xattr 2015-09-05 19:49:08 -04:00
Antonio SJ Musumeci
8178bf518c refactor and simplify getxattr for user.mergerfs.\* 2015-09-03 16:56:54 -04:00
Antonio SJ Musumeci
bc77b0fd2a add minfreespace check to epmfs create policy 2015-09-01 22:28:35 -04:00
Antonio SJ Musumeci
1f1e481075 rework rename
Return EXDEV if directories of tragets differ. If the old and new path exist in the same directory first rename each old found by the policy and then unlink/rmdir any new on a drive which didn't rename. The unlink/rmdir will occur only if there were no rename errors. Any failures of unlink/rmdir are ignored. The last rename error is returned.
2015-09-01 18:32:31 -04:00
Antonio SJ Musumeci
7a93198d4a forgot to add einval to policy 2015-08-30 17:08:24 -04:00
Antonio SJ Musumeci
bbc75f6ff1 create errno policies for simulating errors. closes #107 2015-08-27 22:38:23 -04:00
Antonio SJ Musumeci
126df0fbf1 fix epmfs failing to pick the existing path. closes #102 2015-08-24 15:51:17 -04:00
Antonio SJ Musumeci
8767db971a remove unused variable 2015-08-05 11:59:39 -04:00
Antonio SJ Musumeci
838c081b8c Merge pull request #94 from trapexit/config-cleanup
config get and struct naming cleanup
2015-08-05 11:51:33 -04:00
Antonio SJ Musumeci
267f2d291c move requesting of FUSE flags to init from cli args 2015-08-05 11:50:21 -04:00
Antonio SJ Musumeci
f130d07fd8 config get and struct naming cleanup 2015-08-05 09:28:53 -04:00
Antonio SJ Musumeci
52d80299b5 passthrough ioctl args without processing. closes #90 2015-08-05 09:18:34 -04:00
Antonio SJ Musumeci
c60d03831f use gte rather than gt for mtime comparisons. fixes #91 2015-08-04 14:03:44 -04:00
Antonio SJ Musumeci
80b2c35175 add creation of full path for open 2015-07-16 16:57:01 -04:00
Antonio SJ Musumeci
983fa9100d change fuse functions to use the fuse namespace 2015-07-15 10:53:13 -04:00
Antonio SJ Musumeci
efadd2c8d8 Merge pull request #86 from trapexit/readdir-cleanup
remove unused readdir function
2015-07-15 10:51:43 -04:00
Antonio SJ Musumeci
e5359ebd05 remove unused readdir function 2015-07-15 10:50:25 -04:00
Antonio SJ Musumeci
f00cd1467e use pthread_getugid_np instead of gete{u,g}id on OSX. fixes #84 2015-07-15 10:39:47 -04:00
Antonio SJ Musumeci
4d605388a4 ignore ENOTSUP errors when cloning paths. fixes #82 2015-07-13 12:20:19 -04:00
Antonio SJ Musumeci
aafc1e9394 add str to size_t conversion code 2015-07-05 21:02:42 -04:00
Antonio SJ Musumeci
b3109ac506 add minfreespace to xattr interface 2015-07-05 19:36:23 -04:00
Antonio SJ Musumeci
b2cd79154a stop auto calculating and storing fullpath in policies 2015-07-03 10:40:47 -04:00
Antonio SJ Musumeci
0c60701b29 create different policies based on category of use 2015-07-03 08:53:36 -04:00
Antonio SJ Musumeci
51b6d3f647 add category to policies so as to distinguish between creates and searches 2015-07-03 08:51:19 -04:00
Antonio SJ Musumeci
6ca43893ea separate policies into individual modules 2015-06-23 22:27:01 -04:00
Antonio SJ Musumeci
3c8f12281f move policy function type from fs to policy 2015-06-23 00:24:14 -04:00
Antonio SJ Musumeci
2bd44568a1 move Path object to separate file 2015-06-22 23:22:51 -04:00
Antonio SJ Musumeci
8e5b79647b create lfs policy. closes #73 2015-06-22 11:06:36 -04:00
Antonio SJ Musumeci
58167c3636 first w/ free space policy. closes #72 2015-06-22 10:53:39 -04:00
Antonio SJ Musumeci
ccb22c1fbe create minfreespace option. closes #71 2015-06-22 09:59:16 -04:00
Antonio SJ Musumeci
45b73e53be fix calling of lgetxattr. closes #68 2015-06-04 09:31:43 -04:00
Antonio SJ Musumeci
5fb277529f attempt to set priority to -10 on startup. closes #65 2015-03-17 20:39:20 -04:00
Antonio SJ Musumeci
4b204b8fba restrict who can setxattr the pseudo file. closes #64 2015-03-13 20:31:02 -04:00
Antonio SJ Musumeci
33c837a560 provide 'defaults' option. closes #58 2015-03-11 18:21:28 -04:00
Antonio SJ Musumeci
951b22b671 set FUSE subtype to 'mergerfs'. closes #59 2015-03-11 14:00:47 -04:00
Antonio SJ Musumeci
08366a35be match cli options to xattrs 2015-03-10 18:44:45 -04:00
Antonio SJ Musumeci
91671d7364 remove FileInfo and keep only file descriptor 2015-03-05 22:15:54 -05:00
Antonio SJ Musumeci
c022741ffb revert removal of 'all' policy and relevant behavior. closes #54 2015-03-05 21:01:22 -05:00
Antonio SJ Musumeci
12f393a55e per FUSE function policies. closes #52, #53 2015-02-23 20:02:50 -05:00
Antonio SJ Musumeci
283a2b2285 Try RLIMIT_INFINITY first, then cur = max, then loop and try to increase till error. closes #50 2015-02-17 11:46:54 -05:00
Antonio SJ Musumeci
1a1c9db37b close file after getting ioc flags. closes #48 2015-02-17 00:28:27 -05:00
Antonio SJ Musumeci
d30cae217b add user.mergerfs.allpaths and user.mergerfs.relpath to getxattr 2015-02-07 18:27:47 -05:00
Antonio SJ Musumeci
2e95c6e78e merge action and search category 2015-02-05 18:23:01 -05:00
Antonio SJ Musumeci
b411c63df1 Remove 'all' policy and simplify logic 2015-02-02 23:59:45 -05:00
Antonio SJ Musumeci
1f90203025 use standard platform macros. closes #43 2015-02-02 21:30:31 -05:00
Antonio SJ Musumeci
c2cbb93c25 elevate privileges when calling clonepath. closes #41 2015-01-29 14:28:38 -05:00
Antonio SJ Musumeci
6276ce9779 handle EEXIST while cloning a path. closes #40 2015-01-29 14:28:38 -05:00
Antonio SJ Musumeci
d1f3bd82e8 add clonepath tool 2015-01-29 14:28:34 -05:00
Antonio SJ Musumeci
031b87f674 slight refactoring 2015-01-27 16:08:13 -05:00
Antonio SJ Musumeci
5dd072962b remove longest common prefix from fsname. closes #38 2015-01-22 16:30:12 -05:00
Antonio SJ Musumeci
90b0fcd5f5 Merge pull request #35 from trapexit/dttoif
provide stat to readdir filler. closes #32
2014-11-10 21:11:17 -05:00
Antonio SJ Musumeci
6c3ff01a0a pass const strings by reference. closes #33 2014-11-10 21:01:20 -05:00
Antonio SJ Musumeci
d7ede20abe provide stat to readdir filler. closes #32 2014-11-10 07:41:15 -05:00
Antonio SJ Musumeci
613b996296 support RHEL6. closes #29 2014-11-04 13:52:04 -05:00
Antonio SJ Musumeci
075d62d647 add support for ioctl on directories. closes #27 2014-09-26 18:33:20 -04:00
Antonio SJ Musumeci
cfe7609bcd find functions now return errors. closes #24 2014-08-23 11:44:40 -04:00
Antonio SJ Musumeci
8f35406000 use lstat to confirm file existance instead of eaccess. closes #25 2014-08-22 17:54:38 -04:00
Antonio SJ Musumeci
4ea1adbf96 use f_frsize rather than f_bsize for mfs calculations. closes #26 2014-08-22 17:06:59 -04:00
Antonio SJ Musumeci
7e9ccd0317 support runtime setting of srcmounts. closes #12 2014-08-08 10:20:27 -04:00
Antonio SJ Musumeci
b82db46e29 getxattr for user.mergerfs.{base,full}path returns the source paths. closes #23 2014-07-30 15:26:49 -04:00
Antonio SJ Musumeci
7b0d703f00 only allow manipulation of runtime settings via xattrs. closes #22 2014-07-29 09:26:11 -04:00
Antonio SJ Musumeci
45cec2d301 use int instead of long for ioctl. fixes #21 2014-07-22 07:07:25 -04:00
Antonio SJ Musumeci
2295714548 on ENOENT try cloning the dest path to source drive. closes #20 2014-07-07 21:54:38 -04:00
Antonio SJ Musumeci
ccb0ac1463 generate the controlfile data on the fly. closes #19 2014-06-25 15:17:26 -04:00
Antonio SJ Musumeci
15a0416eed don't flush if it's the .mergerfs pseudo file. closes #18 2014-06-25 14:40:07 -04:00
Antonio SJ Musumeci
ec38a9c783 fix rename'ing to local device 2014-06-24 16:13:49 -04:00
Antonio SJ Musumeci
3b6c74878c use geteuid syscall as well 2014-06-23 12:17:09 -04:00
Antonio SJ Musumeci
0e12d79659 platform specific code to deal with sete{u,g}id. closes #17 2014-06-17 19:12:09 -04:00
Antonio SJ Musumeci
716453596a add flush callback. closes #16 2014-06-13 11:04:26 -04:00
Antonio SJ Musumeci
dd666079b6 add {read,write}_buf functions. closes #15 2014-06-13 11:02:46 -04:00
Antonio SJ Musumeci
45a2e09fbe reverse source and destination mount points to match fstab requirements. closes #13 2014-06-05 07:30:04 -04:00
Antonio SJ Musumeci
645c823778 source mount paths can contain globing. closes #10 2014-05-31 17:54:18 -04:00
Antonio SJ Musumeci
18358261af fsname set to list of src mounts. closes #9 2014-05-30 23:23:45 -04:00
Antonio SJ Musumeci
e2e0359eb2 fix free space calculations. closes #8 2014-05-30 18:41:42 -04:00
Antonio SJ Musumeci
36887e456f when readdir's filler returns non-zero return ENOMEM. closes #7 2014-05-28 18:04:38 -04:00
Antonio SJ Musumeci
652a299ac1 add fgetattr. closes #5 2014-05-28 06:35:08 -04:00
Antonio SJ Musumeci
aab90b0503 rework policy code 2014-05-28 05:35:58 -04:00
Antonio SJ Musumeci
345d0bbdc4 use eaccess to determine permissions for ffwp. closes #2 2014-05-27 18:17:54 -04:00
Antonio SJ Musumeci
4c7095ccf6 remove stat'ing of files in readdir. closes #3 2014-05-27 12:41:40 -04:00
Antonio SJ Musumeci
bbc4b594fe fs::make_path should check for forward slashes, add if missing 2014-05-27 07:17:32 -04:00
Antonio SJ Musumeci
16fe0cf90c remove statfs policy 2014-05-23 07:28:05 -04:00
Antonio SJ Musumeci
29ed2bca01 add FS_IOC_{GET}VERSION to ioctl 2014-05-20 13:48:46 -04:00
Antonio SJ Musumeci
243a193e66 use long instead of int to limit possibility of overflow in switch, closes #1 2014-05-20 10:40:13 -04:00
Antonio SJ Musumeci
97ce6f5f21 use {get,list,set}xattr to modify runtime 2014-05-19 23:37:18 -04:00
Antonio SJ Musumeci
7f640c4d9e fix building without libattr 2014-05-19 09:34:31 -04:00
Antonio SJ Musumeci
bb7a966296 initial code commit 2014-05-19 07:05:53 -04:00