Commit Graph

162 Commits

Author SHA1 Message Date
Ivan Shapovalov
ae818d9579 Makefile: avoid recursively expanding expensive variables
Specifically, do not recursively expand $(CFLAGS) because this leads to
repeatedly performing compile tests (e. g. cc-disable-warning) on every
recipe execution.

Without (nproc=32):
```
$ time env -i PATH=/usr/bin BCACHEFS_FUSE=1 NO_RUST=1 make -j$(nproc)
<...>
    [LD]     bcachefs
  72,48s user 11,29s system 190% cpu 44,036 total
```

With:
```
$ time env -i PATH=/usr/bin BCACHEFS_FUSE=1 NO_RUST=1 make -j$(nproc)
<...>
    [LD]     bcachefs
  66,79s user 5,17s system 1955% cpu 3,679 total
```
2023-12-22 11:41:54 +03:00
Thomas Bertschinger
2b97686ffa remove Rust artifacts during make clean
This should use `cargo clean` instead of `rm -rf ...`. Also,
due to a typo, the `rm` did not actually remove the Rust artifacts.

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-20 18:45:43 -05:00
Kent Overstreet
f2cb831b99 v1.3.6
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-18 23:29:06 -05:00
Kent Overstreet
d8e7f3671d Fix makefile when building without systemd
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-16 18:42:22 -05:00
Kent Overstreet
b6740e5392 Update bcachefs sources to 841a95c29f4c bcachefs: fix userspace build errors
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-15 22:20:39 -05:00
Chris Webb
cc98a16776 bcachefs-tools: Disable -Wgnu-variable-sized-type-not-at-end for clang
clang's default warnings include -Wgnu-variable-sized-type-not-at-end,
producing a lot of false alarms about the GNU extension for libbcachefs.
Disable these using cc-disable-warning when building with clang.

Signed-off-by: Chris Webb <chris@arachsys.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-09 23:29:04 -05:00
Tero Roponen
6b674b8817 bcachefs-tools: make 'all' the default Makefile goal
"fsck/bcachefsck_all:" coming before "all:" in the Makefile
causes the bcachefs binary not being built by default. Fix
this by explicitly setting the .DEFAULT_GOAL=all.

Signed-off-by: Tero Roponen <tero.roponen@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-08 15:07:32 -05:00
Kent Overstreet
8d8a9f3e9b Update bcachefs sources to 6d44812757dd bcachefs: BCH_IOCTL_FSCK_ONLINE
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-07 11:57:36 -05:00
Darrick J. Wong
74753de989 fsck: add a service to schedule and run bcachefsck@ services
Create a script that looks for mounted bcachefs filesystems and tries to
run as many of them in parallel as possible without two different
scrubbers hitting the same low level block device.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
2023-12-07 11:57:36 -05:00
Darrick J. Wong
fbfdd05ac5 fsck: add systemd service definitions for automatic online service
Add some systemd service files so that bcachefs can automatically fsck
mounted filesystems in the background.  Hopefully with minimal
disruption to frontend operations.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
2023-12-07 11:57:36 -05:00
Tautvydas Nesvarbu
bb50e50173 Multiple small fuse fixes for write, api, and hardlink
* changed in Makefile to use recomended fuse api 35;
* force foreground mode, because fuse_daemonize is forking after initalization other bcachefs threads;
* fix fuse_link, there where mistype in fuse_log (the paremeter need to be inum.inum);
* The write_aligned is fixed, by  wrapping struct bch_write_op into container with single closure and using end_io callback to release
      that closure.
2023-12-07 15:17:34 +02:00
Alexander Fougner
1c2cb80376 fix udev rules path
- include rules file in rpmspec
- update install docs with udev build requirement

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-06 15:41:05 -05:00
Darrick J. Wong
f407121d18 misc: don't allow udisks to automount bcachefs filesystems with no prompt
The unending stream of syzbot bug reports and overwrought filing of CVEs
for corner case handling (i.e. things that distract from actual user
complaints) in XFS has generated all sorts of of overheated rhetoric
about how every bug is a Serious Security Issue(tm) because anyone can
craft a malicious filesystem on a USB stick, insert the stick into a
victim machine, and mount will trigger a bug in the kernel driver that
leads to some compromise or DoS or something.

I thought that nobody would be foolish enough to automount an XFS
filesystem.  What a fool I was!  It turns out that udisks can be told
that it's okay to automount things, and then GNOME will do exactly that.
Including mounting mangled XFS filesystems!  Same with bcachefs!

<delete angry rant about poor decisionmaking and armchair fs developers
blasting us on X while not actually doing any of the work>

Turn off /this/ idiocy by adding a udev rule to tell udisks not to
automount bcachefs filesystems.

This will not stop a logged in user from unwittingly inserting a
malicious storage device and pressing [mount] and getting breached.
This is not a substitute for a thorough audit.  This is not a substitute
for lklfuse.  This does not solve the general problem of in-kernel fs
drivers being a huge attack surface.  I just want to give Kent a break
from some of the oceans of bu******.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-04 19:49:26 -05:00
Kent Overstreet
f27b135285 Update bcachefs sources to 71a5b27e017d bcachefs: Make backpointer fsck wb flush check more rigorous
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-30 02:20:51 -05:00
Kent Overstreet
06611a71a3 Update bcachefs sources to 783085c3cc44 kbuild: Allow gcov to be enabled on the command line
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-22 16:55:06 -05:00
Kent Overstreet
47bb2d53ce Version is now specified in the makefile
git describe doesn't work for tarball releases

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-11-16 15:24:22 -05:00
Alexander Fougner
26efa5cf2e downgrade rust deps to compile for MSRV
- add helper for cargo update, whilst respecting MSRV

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2023-11-04 20:29:28 -04:00
Kent Overstreet
6e8f2857af Create symlinks on install with ln -sf
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-26 01:05:29 -04:00
Kent Overstreet
731926b5e5 Kill shell script wrappers
nixos has trouble with the shell script wrappers - readlink isn't
available by default!

But, there's a better approach: just get rid of them and use symlinks
instead, and have main() check what we're supposed to be.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-09-22 14:09:51 -04:00
Kent Overstreet
505c326cbe Update bcachefs sources to a8115093df bcachefs: Fix divide by zero in rebalance_work() 2023-08-17 17:11:27 -04:00
Kent Overstreet
ae23e4541f fuse: Set fsname correctly
Also, add helpers for the fuse.bcachefs filesystem type; this means we
can now test the fuse version with fstests.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-08-11 18:32:23 -04:00
Alexander Fougner
caeeba5152 ci: set and verify MSRV
To prevent uncontrolled usage of new rust features, directly or from
dependencies, set a minimum supported Rust version and verify it builds.

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2023-08-04 20:13:38 +02:00
Bernhard M. Wiedemann
f43c9702e0 Sort input file list
so that libbcachefs.so builds in a reproducible way
in spite of non-deterministic filesystem readdir order.

See https://reproducible-builds.org/ for why this is good.
2023-06-08 15:07:48 +02:00
Kent Overstreet
8642d4ae10 Update bcachefs sources to 7c0fe6f104 bcachefs: Fix bch2_fsck_ask_yn()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-06-04 18:10:29 -04:00
Kent Overstreet
6b1f79d5df Update bcachefs sources to 6a20aede29 bcachefs: Fix quotas + snapshots
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-05-02 00:41:47 -04:00
Kent Overstreet
0f37f9f05f Add a NO_RUST option
For systems without working rust/llvm/bindgen, add an option for
building without Rust. This will be less of an option in the future, as
more code gets rewritten in Rust.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-04-20 12:36:16 -04:00
Kent Overstreet
700afe1939 Delete pytest
These tests have never been useful; drop them.

Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2023-04-20 12:18:59 -04:00
Kent Overstreet
d22c79d2ff Fix build dependencies
Incremental builds are fast again

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-03-19 15:32:43 -04:00
Eric Sandeen
3deb1e0b17 add rpm make target and fix up spec file
Add a new make target to build an rpm. This uses rpmbuild --build-in-place,
so no SRPM is created.

Also clean up the specfile to remove manually-added Requires: that will
be auto-generated, add a couple new BuildRequires: and use macros for
file locations.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2023-03-08 10:26:44 -05:00
Kent Overstreet
b0c9ad15f4 Update bcachefs sources to 171da96d76 bcachefs: Drop some anonymous structs, unions 2023-03-04 23:33:25 -05:00
Kent Overstreet
28f703cc25 Rust now integrated into bcachefs binary
Rust is now required for building the bcachefs tool, and rust code is
now fully integrated with the C codebase - meaning it is possible to
call back and forth.

The mount helper is now a subcommand, 'mount.bcachefs' is now a small
shell wrapper that invokes 'bcachefs mount'.

This will make it easier to start rewriting other subcommands in rust,
and eventually the whole command line interface.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-21 01:03:08 -05:00
Kent Overstreet
a104f0407b Update bcachefs sources to ea93c26e98 fixup! bcachefs: We can handle missing btree roots for all alloc btrees
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-09 18:36:24 -05:00
Kent Overstreet
97880a7ce4 Makefile: build with -Wno-deprecated-declarations
This fixes a ZSTD warning.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-02-01 16:34:14 -05:00
Daniel Hill
ccaca683b2 make: remove libbcachefs.so when cleaning.
Signed-off-by: Daniel Hill <daniel@gluo.nz>
2023-01-03 16:58:55 +13:00
Eric Sandeen
d9905d97d0 bcachefs-tools: add tarball make target
This makes it easy to generate a tarball, which should eventually
facilitate packaging:  "make tarball"

Note that it's currently using the $(VERSION) from git describe
which may not be ideal once point releases are happening, but that
holds true for everywhere $(VERSION) is used.

All tar.xz files are removed via "make clean"

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2022-11-15 14:54:13 -05:00
Eric Sandeen
cde2d0e2fc bcachefs-tools: Prettify make output
Make the default "make" output look more like kbuild; this makes
errors and warnings much easier to spot. "Make V=1" will revert to
showing the full command lines.

This is done by redefining some implicit rules to add the echo and
the quiet variable.  These changes are similar to those in xfsprogs.
and btrfs-progs

This patch also silences things if pytest-3 is not found.

Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
2022-11-15 14:18:47 -05:00
Kent Overstreet
c1e4d447f6 Update bcachefs sources to 8d3fc97ca3 bcachefs: Fixes for building in userspace 2022-11-13 20:07:22 -05:00
Kent Overstreet
e0a51ccce8 Update bcachefs sources to 3e93567c51 bcachefs: Switch to local_clock() for fastpath time source 2022-10-15 01:04:30 -04:00
Kent Overstreet
dded444b20 Update bcachefs sources to dfaf9a6ee2 lib/printbuf: Clean up headers 2022-08-18 12:49:48 -04:00
Kent Overstreet
986533d8d5 Update bcachefs sources to 6ddf061e68 bcachefs: Use a genradix for reading journal entries 2022-04-08 19:26:30 -04:00
Brett Holman
74c00c643e check for libkeyutils with pkg-config 2022-03-24 11:16:35 -06:00
Daniel B. Hill
2c0d0c4b7b Makefile: We need to exclude hidden folders
Sometimes user-specific apps create .c files in hidden folders breaking make.

Signed-off-by: Daniel B. Hill <daniel@gluo.nz>
2022-01-12 17:31:04 +13:00
Kent Overstreet
b3984515eb Fix makefile for building docs
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
2022-01-10 21:38:14 -05:00
Kent Overstreet
1388212eb8 Delete old bcachefs.5 from makefile 2021-12-20 15:24:22 -05:00
Kent Overstreet
d06f5690fa Update bcachefs sources to ff3a76e1af bcachefs: Change need_whiteout_for_snapshot() to clone iterator 2021-12-19 19:37:29 -05:00
Chris Webb
49923376d1 Use scrypt from libsodium
bcachefs-tools has both libscrypt and libsodium as build dependencies,
but libsodium already includes the same scrypt implementation as libscrypt,
originally written by Colin Percival.

Use the libsodium copy, dropping the extra libscrypt dependency.

Explicitly adopt the default scrypt N, r and p values from libscrypt to
avoid unintended changes in the default work parameters for bcachefs.

Signed-off-by: Chris Webb <chris@arachsys.com>
2021-10-23 12:16:08 -04:00
Kayla Firestack
ae3d49e823 Makefile: fix rst2man lookup and add pytest lookup
add pytest and rst2man lookups though command-v and which if available,
default to ENV/ARGS in the case of user specified locations and otherwise lookup via shell

Signed-off-by: Kayla Firestack <dev@kaylafire.me>
2021-10-20 09:30:16 -04:00
Kayla Firestack
045f7d2ba1 Makefile: prefix libbcachefs.so installation with DESTDIR
Signed-off-by: Kayla Firestack <dev@kaylafire.me>
2021-10-19 14:43:08 -04:00
Kayla Firestack
f403ef61e7 rst2man: convert which to command -v
Signed-off-by: Kayla Firestack <dev@kaylafire.me>
2021-10-19 14:28:34 -04:00
Igor Velkov
a77c35a1c4 fix "no rst2man found!" build error on debian and ubuntu 2021-10-18 17:41:11 -04:00