Commit Graph

1509 Commits

Author SHA1 Message Date
Kent Overstreet
573d635b2c Update bcachefs sources to 1592eaa60418 bcachefs: Btree path tracepoints 2024-07-18 18:52:15 -04:00
Alexander Fougner
088e17a54a ci: bump upload-artifact action
Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2024-07-17 11:24:07 +02:00
Alexander Fougner
f8d6a67db0 ci: fix build for older debian deps
also drop ubuntu 20.04 from build matrix, include 24.04 instead which
is soon to go stable.

Signed-off-by: Alexander Fougner <fougner89@gmail.com>
2024-07-17 11:24:05 +02: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
Kent Overstreet
07913d1185 logging: kill quiet option
no logging by default, enabled with -v

logging by default broke fstests

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-15 23:20:54 -04:00
Kent Overstreet
e084e9f65b update debian/ from upstream
'make deb' works

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-15 21:23:38 -04:00
Kent Overstreet
8594891772 cmd_set_option: Can now set device options
This allows data_allowed (and others) to be set on an offline
filesystem.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-15 20:17:37 -04:00
Kent Overstreet
32fbdff2a9 Update bcachefs sources to 4a7a003763f5 bcachefs: Opt_durability can now be set via bch2_opt_set_sb() 2024-07-15 20:17:37 -04:00
Kent Overstreet
2d60567685 fix silly clippy warning
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-14 22:16:13 -04:00
Lauri Tirkkonen
7ebd67e63a mount: replace rpassword with rustix::termios
because rpassword unconditionally open()s /dev/tty, it fails with ENXIO
on the console without workarounds like busybox's cttyhack. in contrast,
bcachefs unlock works fine on console, so change the passphrase prompt
logic in mount to be closer to what it is in unlock.

Signed-off-by: Lauri Tirkkonen <lauri@hacktheplanet.fi>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-14 21:49:58 -04:00
Thomas Bertschinger
9e12dd06b9 include debuginfo in bcachefs binary by default
The debuginfo is used by the "bcachefs debug" and "bcachefs list_bkeys"
commands.

Rust 1.77 [1] changed Cargo's release profile to strip debuginfo by default,
but we always want it included.

[1] https://github.com/rust-lang/cargo/pull/13257

Signed-off-by: Thomas Bertschinger <tahbertschinger@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-14 16:20:17 -04:00
Kent Overstreet
061a9ff2a3 Update bcachefs sources to 4d1d53862afb bcachefs: show none if label is not set 2024-07-14 15:20:16 -04:00
Kent Overstreet
a1764e00cd Update bcachefs sources to 47d1e7a86242 bcachefs: drop packed, aligned from bkey_inode_buf
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-12 14:42:54 -04:00
Kent Overstreet
4be409afea provide atomic64_try_cmpxchg() for 32bit
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-12 14:24:38 -04:00
Kent Overstreet
0f9b409aee add i686-linux to nix flake
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-12 14:14:55 -04:00
Tavian Barnes
53d7722563 raid/cpu: Use memcpy() instead of type punning
The vendor may not be suitably aligned for uint32_t *.

Signed-off-by: Tavian Barnes <tavianator@tavianator.com>
2024-07-12 14:02:14 -04:00
Kent Overstreet
8b06995115 Update bcachefs sources to 2be6fc9b111c bcachefs: bch2_gc_btree() should not use btree_root_lock
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-07-05 09:16:45 -04:00
koverstreet
d061c7ea11
Merge pull request #309 from tmuehlbacher/improve-logging-exiting
Improve logging and exiting
2024-06-29 14:16:14 -04:00
Kent Overstreet
755788e2d6 Be explicit about which fsck implementation we're running
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-29 11:55:03 -04:00
Kent Overstreet
34b5654d9e Update bcachefs sources to 9404a01d3dc5 bcachefs: Make read_only a mount option again, but hidden
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-28 18:26:04 -04:00
Thomas Mühlbacher
5cce07e986 feat: use ExitCode over std::process:exit()
Should provide us with better outputs on process failure, also makes
unwinding better and is generally recommended over `exit()`.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-29 00:11:07 +02:00
Thomas Mühlbacher
176d76bceb feat: add --quiet cli argument
To silence log outputs on the CLI.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-28 21:29:47 +02:00
Thomas Mühlbacher
df09682869 feat: use env_logger
Instead of the custom logger impl, which limits the features we can
easily provide for users.

This introduces the `BCACHEFS_LOG` environment variable for setting the
log verbosity. Setting `BCACHEFS_LOG=trace`, e.g. in a test environment,
will yield all log messages.

Also I think it's reasonable to print INFO level logs by default.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-28 21:29:20 +02:00
koverstreet
b0eb3c2930
Merge pull request #305 from Artturin/use-ar-var
Use the AR variable in Makefile
2024-06-28 11:21:19 -04:00
Thomas Mühlbacher
7a17d429d5 feat(key): make UnlockPolicy::Fail more useful
We already can check if an fs is encrypted with `bcachefs unlock -c`.
With this option we can now instead check if we have a key but not
actually mount by not specifying a mount point. e.g.

```sh
if bcachefs mount -k fail "$blkdev"`; then
    echo "device is unlocked!"
fi
```

Not sure what the original intent for this was. For scenarios where
encryption is simply not supported on principle?

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26 19:14:45 +02:00
Thomas Mühlbacher
ee5f3719d3 refactor(key): split up unlocking functions
This is more similar to the existing C code, which is already in nice
small chunks.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26 19:14:45 +02:00
Thomas Mühlbacher
795585e289 refactor: simplify branches for parsing dev
Less repetition and no nested if/else.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26 19:14:45 +02:00
Thomas Mühlbacher
9bd3ada1d1 feat(mount): make unlock policy optional/explict
This changes the semantics of some arguments related to unlocking and
slightly changes the unlocking logic. Also update help formatting/text.

Instead of defaulting to `UnlockPolicy::Ask`, the argument becomes
optional. That means if it is specified, the user really wants that
specific policy. Similar to how `passphrase_file` also works.

This also extends `UnlockPolicy` to override `isatty` detection.

Fixes: #292
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26 19:14:45 +02:00
Thomas Mühlbacher
a411e7237f refactor(mount): rename opt => cli
The term option is already used for mount options and the `Option` type.
In other modules it's just called `cli`, so let's do that here as well.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26 19:14:45 +02:00
Thomas Mühlbacher
cf180e8f34 refactor: rm function param only used for log msg
We lose that bit of info but it's weird to require a parameter simply
because we want to use it for a log message.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-26 19:14:45 +02:00
Artturin
91e67ab2bd Use the AR variable in Makefile
For cross-compiling
2024-06-24 21:00:08 +03:00
David Disseldorp
411df4e53f key: use c_long type for keyctl_search() helper fn
The keyctl_search() C function returns a long, which is already
reflected in the KeyHandle._id type. The search_keyring() helper
function currently returns a Result<i64>, which breaks 32-bit builds for
e.g. armv7l:
  error[E0308]: mismatched types
     --> src/key.rs:121:16
      |
  121 |             Ok(key_id)
      |             -- ^^^^^^ expected `i64`, found `i32`
      |             |
      |             arguments to this enum variant are incorrect
...
  error[E0308]: mismatched types
     --> src/key.rs:135:24
      |
  135 |                 _id:   id,
      |                        ^^ expected `i32`, found `i64`

Fix this by changing search_keyring() to return a Result<c_long>.

Fixes: f72ded6a ("fix(key): search for key in all relevant keyrings")
Signed-off-by: David Disseldorp <ddiss@suse.de>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-20 08:52:12 -04: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
02aa11829a Merge commit '41df701a089fbf19fe16d65fbb6df46854b1f3df' of https://github.com/tmuehlbacher/bcachefs-tools 2024-06-19 12:09:32 -04:00
Kent Overstreet
adb63be479 update Cargo.lock version
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-19 09:23:49 -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
Thomas Mühlbacher
41df701a08 fix(logger): log to stderr
Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-18 20:56:25 +02:00
Thomas Mühlbacher
f72ded6a4f fix(key): search for key in all relevant keyrings
Previously, using `bcachefs unlock -k session` would still cause mount
to ask for a passphrase.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-18 20:56:17 +02:00
Thomas Mühlbacher
e4271d7a3e fix(key): remove any newlines from passphrase
To match the behavior of the C code and because there may be newlines
under some conditions.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-18 20:56:15 +02:00
Thomas Mühlbacher
87ab1fd7ed chore(editorconfig): extend for sh scripts
To match with what's already in the repo.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-18 20:56:06 +02:00
koverstreet
c909480560
Merge pull request #302 from koverstreet/update_flake_lock_action
flake.lock: Update
2024-06-17 14:21:10 -04:00
github-actions[bot]
33ce7dd90c flake.lock: Update
Flake lock file updates:

• Updated input 'crane':
    'github:ipetkov/crane/17d9e9dedd58dde2c562a4296934c6d6a0844534?narHash=sha256-hGLeRxSEeFz9WvmQ4s4AuMJ5InLSZvoczDdXkWSFi1A%3D' (2024-06-09)
  → 'github:ipetkov/crane/0095fd8ea00ae0a9e6014f39c375e40c2fbd3386?narHash=sha256-UKrfy/46YF2TRnxTtKCYzqf2f5ZPRRWwKCCJb7O5X8U%3D' (2024-06-15)
• Updated input 'nixpkgs':
    'github:nixos/nixpkgs/051f920625ab5aabe37c920346e3e69d7d34400e?narHash=sha256-4q0s6m0GUcN7q%2BY2DqD27iLvbcd1G50T2lv08kKxkSI%3D' (2024-06-07)
  → 'github:nixos/nixpkgs/e9ee548d90ff586a6471b4ae80ae9cfcbceb3420?narHash=sha256-4Zu0RYRcAY/VWuu6awwq4opuiD//ahpc2aFHg2CWqFY%3D' (2024-06-13)
• Updated input 'treefmt-nix':
    'github:numtide/treefmt-nix/4fc1c45a5f50169f9f29f6a98a438fb910b834ed?narHash=sha256-npYqVg%2BWk4oxnWrnVG7416fpfrlRhp/lQ6wQ4DHI8YE%3D' (2024-06-08)
  → 'github:numtide/treefmt-nix/68eb1dc333ce82d0ab0c0357363ea17c31ea1f81?narHash=sha256-ULzoKzEaBOiLRtjeY3YoGFJMwWSKRYOic6VNw2UyTls%3D' (2024-06-16)
2024-06-17 18:20:02 +00:00
koverstreet
a87faa2e30
Merge pull request #301 from tmuehlbacher/fix-nix-install
fix(nix): install paths from pkg-config properly
2024-06-17 14:19:23 -04:00
Kent Overstreet
d915c62f17 Update bcachefs sources to 792ca5ba3c9a bcachefs: kill key cache arg to bch2_assert_pos_locked() 2024-06-17 14:08:42 -04:00
Kent Overstreet
fc06a0ea5e Update bcachefs sources to c56e1ec97dfd bcachefs: Fix bch2_sb_downgrade_update()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-17 12:38:43 -04:00
Thomas Mühlbacher
b46d3a2710 fix(nix): install paths from pkg-config properly
Because we were using `DESTDIR` instead of `PREFIX` for some reason, no
one noticed that this didn't work.

Signed-off-by: Thomas Mühlbacher <tmuehlbacher@posteo.net>
2024-06-17 18:31:40 +02:00
Ariel Miculas
ab83e348fb Preserve directory {a,m,c} times by calling copy_times() after the recursion
Otherwise the directory {a,m,c} times will be modified by the recursive
copy of the directory tree.

Signed-off-by: Ariel Miculas <ariel.miculas@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-16 14:09:18 -04:00
Ariel Miculas
3a4a096cd2 Fix incomplete file copy due to copy_data misuse
The copy_data function takes a start and an end parameter as the range
of bytes to copy, but it was called with a start and a length parameter.
This resulted in incomplete file copies. Fix it by passing the end of
the range instead of the length.

Signed-off-by: Ariel Miculas <ariel.miculas@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-16 14:09:13 -04:00
Ariel Miculas
ed675b8d64 Fix performance regression of update_inode
This kernel commit: 65bd442397274347e721a89c2c4882a392bae982 removes
BTREE_ITER_cached from bch2_btree_insert_trans, which causes the
update_inode function to take a long time (~20s). Add this flag back in
the update_inode function.

Signed-off-by: Ariel Miculas <ariel.miculas@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-16 14:08:59 -04:00
Ariel Miculas
d750b2b98b bcachefs: allow initializing a bcachefs filesystem from a source directory
Add a new source command line argument which specifies the directory
tree that will be copied onto the newly formatted bcachefs filesystem.

This commit also fixes an issue in copy_link where uninitialized data is
copied into the symlink because of a round_up of the buffer size.

Signed-off-by: Ariel Miculas <ariel.miculas@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
2024-06-16 14:08:52 -04:00