diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2023-09-24 01:07:16 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:10:15 +0200 |
commit | 793a06d984511593c6375d219b38cc84f5a71aff (patch) | |
tree | 7cdd18dffcd3ccb3e1272263008c42b835634332 /fs/bcachefs | |
parent | bcachefs: Ignore unknown mount options (diff) | |
download | linux-793a06d984511593c6375d219b38cc84f5a71aff.tar.xz linux-793a06d984511593c6375d219b38cc84f5a71aff.zip |
bcachefs: Fixes for building in userspace
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs')
-rw-r--r-- | fs/bcachefs/checksum.c | 20 | ||||
-rw-r--r-- | fs/bcachefs/checksum.h | 3 | ||||
-rw-r--r-- | fs/bcachefs/fs.h | 2 | ||||
-rw-r--r-- | fs/bcachefs/io_read.c | 2 | ||||
-rw-r--r-- | fs/bcachefs/super-io.c | 2 |
5 files changed, 27 insertions, 2 deletions
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c index c70262b7fd6e..1948119edbf4 100644 --- a/fs/bcachefs/checksum.c +++ b/fs/bcachefs/checksum.c @@ -559,6 +559,26 @@ int bch2_request_key(struct bch_sb *sb, struct bch_key *key) return ret; } +#ifndef __KERNEL__ +int bch2_revoke_key(struct bch_sb *sb) +{ + key_serial_t key_id; + struct printbuf key_description = PRINTBUF; + + prt_printf(&key_description, "bcachefs:"); + pr_uuid(&key_description, sb->user_uuid.b); + + key_id = request_key("user", key_description.buf, NULL, KEY_SPEC_USER_KEYRING); + printbuf_exit(&key_description); + if (key_id < 0) + return errno; + + keyctl_revoke(key_id); + + return 0; +} +#endif + int bch2_decrypt_sb_key(struct bch_fs *c, struct bch_sb_field_crypt *crypt, struct bch_key *key) diff --git a/fs/bcachefs/checksum.h b/fs/bcachefs/checksum.h index 779f175029a8..13998388c545 100644 --- a/fs/bcachefs/checksum.h +++ b/fs/bcachefs/checksum.h @@ -47,6 +47,9 @@ struct bch_csum bch2_checksum(struct bch_fs *, unsigned, struct nonce, int bch2_chacha_encrypt_key(struct bch_key *, struct nonce, void *, size_t); int bch2_request_key(struct bch_sb *, struct bch_key *); +#ifndef __KERNEL__ +int bch2_revoke_key(struct bch_sb *); +#endif int bch2_encrypt(struct bch_fs *, unsigned, struct nonce, void *data, size_t); diff --git a/fs/bcachefs/fs.h b/fs/bcachefs/fs.h index 10e11119ded2..5edf1d4b9e6b 100644 --- a/fs/bcachefs/fs.h +++ b/fs/bcachefs/fs.h @@ -197,7 +197,7 @@ int bch2_vfs_init(void); #else -#define bch2_inode_update_after_write(_trans, _inode, _inode_u, _fields) do {} while (0) +#define bch2_inode_update_after_write(_trans, _inode, _inode_u, _fields) ({ do {} while (0); }) static inline void bch2_evict_subvolume_inodes(struct bch_fs *c, snapshot_id_list *s) {} diff --git a/fs/bcachefs/io_read.c b/fs/bcachefs/io_read.c index 9a57da00573d..443c3ea65527 100644 --- a/fs/bcachefs/io_read.c +++ b/fs/bcachefs/io_read.c @@ -24,6 +24,8 @@ #include "subvolume.h" #include "trace.h" +#include <linux/sched/mm.h> + #ifndef CONFIG_BCACHEFS_NO_LATENCY_ACCT static bool bch2_target_congested(struct bch_fs *c, u16 target) diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c index 55bc03d2e8ed..c9bf342d14aa 100644 --- a/fs/bcachefs/super-io.c +++ b/fs/bcachefs/super-io.c @@ -675,7 +675,7 @@ retry: #ifndef __KERNEL__ if (opt_get(*opts, direct_io) == false) - sb->mode |= FMODE_BUFFERED; + sb->mode |= BLK_OPEN_BUFFERED; #endif if (!opt_get(*opts, noexcl)) |