Commit Graph

189 Commits

Author SHA1 Message Date
Integral
511a714ed3 bcachefs-tools: update VERSION in Makefile to 1.13.0
Update VERSION in Makefile to 1.13.0.

Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-27 16:15:00 -04:00
Integral
b7831af74d bcachefs-tools: fix in fuse feature in RUSTFLAGS
Currently, when "BCACHEFS_FUSE=1" is set, fusemount subcommand
still cannot be identified. Change RUSTFLAGS in Makefile to fix
this problem.

Signed-off-by: Integral <integral@archlinuxcn.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-27 16:15:00 -04:00
Alyssa Ross
3666da87f2 Pass -C default-linker-libraries to rustc
By default, rustc passes -nodefaultlibs to the linker.  In some cases,
this can cause compiler builtins (e.g. __cpu_model, used by
__builtin_cpu_supports) not to be linked in:

= note: /nix/store/s2cjhni3s6shh0n35ay1hpj8d85k44qk-x86_64-unknown-linux-musl-binutils-2.43.1/bin/x86_64-unknown-linux-musl-ld: ./libbcachefs.a(tools-util.o): in function `resolve_crc32c':
        /build/source/c_src/tools-util.c:457:(.text+0x1023): undefined reference to `__cpu_model'
        collect2: error: ld returned 1 exit status

I saw this with static musl GCC builds, and others have reported it with
Clang.

Link: https://github.com/koverstreet/bcachefs-tools/issues/300
Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-10-12 17:20:56 -04:00
Alyssa Ross
f9ec00d5ca Remove udev from PKGCONFIG_LIBS in Makefile
libudev.pc is the pkg-config file for the udev libraries.  udev.pc is
just there to define the directory that rules etc. should be installed
into.  It therefore doesn't need to be included in the list of libraries
passed to pkg-config --cflags or pkg-config --libs.

At least one implementation of the libudev API, libudev-zero, does not
provide a udev.pc file, because it does not implement the udev rules
language, just the library API.  With this change, it's possible to
build bcachefs-tools against libudev-zero by pointing PKGCONFIG_UDEVDIR
somewhere on the make command line.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-09-04 15:38:46 -04:00
Kent Overstreet
b422b19f63 Update bcachefs sources to 22fa8fc32e6a bcachefs: rcu_pending now works in userspace 2024-08-23 19:34:30 -04:00
Reed Riley
481a50f0a9 version bump to v1.11.1 2024-08-22 16:26:18 -05:00
Kent Overstreet
60ff4f2f3c bump version to 1.9.5
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-18 20:48:14 -04:00
Kent Overstreet
9020d202a4 kill old python tests
these were never used, kill a dependency

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-15 23:34:58 -04:00
Artturin
91e67ab2bd Use the AR variable in Makefile
For cross-compiling
2024-06-24 21:00:08 +03:00
Kent Overstreet
277ba6d4ac v1.9.1
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-19 14:48:31 -04:00
Kent Overstreet
dd275b1c5f Update version to 1.9.0
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-19 09:05:50 -04:00
Kent Overstreet
0e0aa31912 Update bcachefs sources to 0389c09b2fb7 bcachefs: Fix bio alloc in check_extent_checksum()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-04-17 17:34:56 -04:00
Kent Overstreet
59e04ddf40 1.7.0 - mi_btree_bitmap
New on disk forat feature - per member 64 bit bitmap of regions with
btree nodes, to accelerate recovering by scanning for btree nodes.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-04-17 03:25:28 -04:00
Kent Overstreet
abfdc593a5 Update bcachefs sources to 83338f5b2cb8 bcachefs: fix for building in userspace 2024-03-16 19:40:33 -04:00
Kent Overstreet
010182e790 v1.6.4
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-02-23 19:25:27 -05:00
Thomas Bertschinger
3388cf009a powerpc: use "long long" for 64-bit types in userspace
This resolves build warnings and failures for architectures where the
Linux userspace `asm/types.h` header defines 64-bit types (u64, s64) as
`long` instead of `long long`.

By defining `__SANE_USERSPACE_TYPES__`, these types are defined as
`long long` instead.

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-02-23 17:26:28 -05:00
Kent Overstreet
de9c798382 v1.6.3
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-02-20 18:42:07 -05:00
Kent Overstreet
6ff5313cbe cmd_fsck: Collect return code of kernel fsck with close()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-02-17 23:31:47 -05:00
Kent Overstreet
f3f005c76e Update bcachefs sources to 50847e296b34 bcachefs: Check subvol <-> inode pointers in check_inode()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-02-06 01:07:16 -05:00
Frederik Schwan
1d39ee23af cosmetic refactoring of Makefile
Make clear that LIBEXECDIR is an option.
2024-02-05 20:47:54 -05:00
Steinar H. Gunderson
e9fec00f86 Make initramfs hook install mount.bcachefs
Now that the bcachefs tool unconditionally includes the mount parts
(or more correctly, you cannot build it at all if you don't have Rust),
we can call copy_exec on mount.bcachefs, to get the symlink installed.
In particular, this helps with mounting UUID mounts as /.

See also https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1060411
for the remaining parts needed in initramfs-tools itself.
2024-02-04 14:44:54 +01:00
Ryan Lahfa
ec277463e9 fix(build): clean should delete top-level libbcachefs.a
I spent some minutes pestering Kent about weird counters issues, when, actually, `make clean`
was keeping this artifact on my filesystem.

Signed-off-by: Ryan Lahfa <bcachefs@lahfa.xyz>
2024-01-27 05:15:19 +01:00
Kent Overstreet
b5fd066153 Move c_src dirs back to toplevel
We just wanted c sourcefiles out of the top level, not c source
directories.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 17:17:23 -05:00
Thomas Bertschinger
f5baaf48e3 move Rust sources to top level, C sources into c_src
This moves the Rust sources out of rust_src/ and into the top level.
Running the bcachefs executable out of the development tree is now:

$ ./target/release/bcachefs command
or
$ cargo run --profile release -- command

instead of "./bcachefs command".

Building and installing is still:

$ make && make install

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 01:47:05 -05:00
Thomas Bertschinger
0a284fc4ff convert main() from C to Rust
This moves the main() function from C to Rust. It also updates the name
of the Rust package from "bcachefs-rust" to "bcachefs-tools".

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-01-16 01:46:41 -05:00
Neal Gompa
89abdd8727 Makefile, fsck: Use libexec instead of lib
These are executables that need to be installed in a non-path location.
Most distributions now install these into /usr/libexec, and the
path variable for this is LIBEXECDIR, so use that instead.
2023-12-24 08:34:16 -05:00
Kent Overstreet
bc1680d488 v1.4.0: Split brain detection
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2023-12-23 19:39:01 -05:00
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