id stringlengths 40 40 | instruction stringlengths 68 308 | input stringlengths 17 33.4k | output stringlengths 100 30k |
|---|---|---|---|
91f950e8b9d8419d72e9f06250b6471cdfd534d7 | Analyze and fix the following issue in the Linux kernel code: scripts/kernel-doc: match -Werror flag strictly | Problem Details:
In our CI testing, we use some commands as below to only turn a specific
type of warnings into errors, but we notice that kernel-doc warnings
are also turned into errors unexpectedly.
$ make KCFLAGS="-Werror=return-type" W=1 kernel/fork.o
kernel/fork.c:1406: warning: Function parameter or member 'mm'... | ```diff
diff --git a/scripts/kernel-doc b/scripts/kernel-doc
index 6e199a745ccb..d660e1f4b483 100755
--- a/scripts/kernel-doc
+++ b/scripts/kernel-doc
@@ -185,7 +185,7 @@ if (defined($ENV{'KBUILD_VERBOSE'}) && $ENV{'KBUILD_VERBOSE'} =~ '1') {
if (defined($ENV{'KCFLAGS'})) {
my $kcflags = "$ENV{'KCFLAGS'}";
- if ($... |
eda5a18efa99f51f0dbff3209684a57532c93f23 | Analyze and fix the following issue in the Linux kernel code: docs: sparse: add SPDX-License-Identifier | Problem Details:
Add SPDX-License-Identifier to fix the checkpatch warning:
WARNING:SPDX_LICENSE_TAG: Missing or malformed SPDX-License-Identifier tag in line 1
\#26: FILE: Documentation/translations/zh_TW/dev-tools/index.rst:1:
+.. include:: ../disclaimer-zh_TW.rst
Signed-off-by: Min-Hua Chen <minhuadotchen@gmail.co... | ```diff
diff --git a/Documentation/translations/zh_TW/dev-tools/index.rst b/Documentation/translations/zh_TW/dev-tools/index.rst
index 565e3868cc7a..0d38e5f80e54 100644
--- a/Documentation/translations/zh_TW/dev-tools/index.rst
+++ b/Documentation/translations/zh_TW/dev-tools/index.rst
@@ -1,3 +1,5 @@
+.. SPDX-License-... |
0c180317c654a494fe429adbf7bc9b0793caf9e2 | Analyze and fix the following issue in the Linux kernel code: ksmbd: add support for surrogate pair conversion | Problem Details:
ksmbd is missing supporting to convert filename included surrogate pair
characters. It triggers a "file or folder does not exist" error in
Windows client.
[Steps to Reproduce for bug]
1. Create surrogate pair file
touch $(echo -e '\xf0\x9d\x9f\xa3')
touch $(echo -e '\xf0\x9d\x9f\xa4')
2. Try to ope... | ```diff
diff --git a/fs/smb/server/unicode.c b/fs/smb/server/unicode.c
index 393dd4a7432b..43ed29ee44ea 100644
--- a/fs/smb/server/unicode.c
+++ b/fs/smb/server/unicode.c
@@ -13,46 +13,10 @@
#include "unicode.h"
#include "smb_common.h"
-/*
- * smb_utf16_bytes() - how long will a string be after conversion?
- * @fro... |
ecce70cf17d91c3dd87a0c4ea00b2d1387729701 | Analyze and fix the following issue in the Linux kernel code: ksmbd: fix missing RDMA-capable flag for IPoIB device in ksmbd_rdma_capable_netdev() | Problem Details:
Physical ib_device does not have an underlying net_device, thus its
association with IPoIB net_device cannot be retrieved via
ops.get_netdev() or ib_device_get_by_netdev(). ksmbd reads physical
ib_device port GUID from the lower 16 bytes of the hardware addresses on
IPoIB net_device and match its under... | ```diff
diff --git a/fs/smb/server/transport_rdma.c b/fs/smb/server/transport_rdma.c
index 3b269e1f523a..c5629a68c8b7 100644
--- a/fs/smb/server/transport_rdma.c
+++ b/fs/smb/server/transport_rdma.c
@@ -2140,8 +2140,7 @@ static int smb_direct_ib_client_add(struct ib_device *ib_dev)
if (ib_dev->node_type != RDMA_NODE_... |
807252f028c59b9a3bac4d62ad84761548c10f11 | Analyze and fix the following issue in the Linux kernel code: ksmbd: fix recursive locking in vfs helpers | Problem Details:
Running smb2.rename test from Samba smbtorture suite against a kernel built
with lockdep triggers a "possible recursive locking detected" warning.
This is because mnt_want_write() is called twice with no mnt_drop_write()
in between:
-> ksmbd_vfs_mkdir()
-> ksmbd_vfs_kern_path_create()
-> ... | ```diff
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index 2e37939a8ba0..1053127f71ad 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -173,10 +173,6 @@ int ksmbd_vfs_create(struct ksmbd_work *work, const char *name, umode_t mode)
return err;
}
- err = mnt_want_write(path.mnt);
- if (err)
... |
3354db668808d5b6d7c5e0cb19ff4c9da4bb5e58 | Analyze and fix the following issue in the Linux kernel code: ksmbd: fix kernel-doc comment of ksmbd_vfs_setxattr() | Problem Details:
Fix argument list that the kdoc format and script verified in
ksmbd_vfs_setxattr().
fs/smb/server/vfs.c:929: warning: Function parameter or member 'path'
not described in 'ksmbd_vfs_setxattr'
Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-... | ```diff
diff --git a/fs/smb/server/vfs.c b/fs/smb/server/vfs.c
index b5a5e50fc9ca..2e37939a8ba0 100644
--- a/fs/smb/server/vfs.c
+++ b/fs/smb/server/vfs.c
@@ -919,7 +919,7 @@ ssize_t ksmbd_vfs_getxattr(struct mnt_idmap *idmap,
/**
* ksmbd_vfs_setxattr() - vfs helper for smb set extended attributes value
* @idmap: ... |
1819a904299942b309f687cc0f08b123500aa178 | Analyze and fix the following issue in the Linux kernel code: ksmbd: reorganize ksmbd_iov_pin_rsp() | Problem Details:
If ksmbd_iov_pin_rsp fail, io vertor should be rollback.
This patch moves memory allocations to before setting the io vector
to avoid rollbacks.
Fixes: e2b76ab8b5c9 ("ksmbd: add support for read compound")
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microso... | ```diff
diff --git a/fs/smb/server/ksmbd_work.c b/fs/smb/server/ksmbd_work.c
index 51def3ca74c0..a2ed441e837a 100644
--- a/fs/smb/server/ksmbd_work.c
+++ b/fs/smb/server/ksmbd_work.c
@@ -95,11 +95,28 @@ bool ksmbd_queue_work(struct ksmbd_work *work)
return queue_work(ksmbd_wq, &work->work);
}
-static int ksmbd_rea... |
1460720c5913c11415e4d7c4df5a287eb2ad3f3e | Analyze and fix the following issue in the Linux kernel code: cifs: Add client version details to NTLM authenticate message | Problem Details:
The NTLM authenticate message currently sets the NTLMSSP_NEGOTIATE_VERSION
flag but does not populate the VERSION structure. This commit fixes this
bug by ensuring that the flag is set and the version details are included
in the message.
Signed-off-by: Meetakshi Setiya <msetiya@microsoft.com>
Reviewed... | ```diff
diff --git a/fs/smb/client/ntlmssp.h b/fs/smb/client/ntlmssp.h
index 2c5dde2ece58..875de43b72de 100644
--- a/fs/smb/client/ntlmssp.h
+++ b/fs/smb/client/ntlmssp.h
@@ -133,8 +133,8 @@ typedef struct _AUTHENTICATE_MESSAGE {
SECURITY_BUFFER WorkstationName;
SECURITY_BUFFER SessionKey;
__le32 NegotiateFlags;
... |
475efd9808a3094944a56240b2711349e433fb66 | Analyze and fix the following issue in the Linux kernel code: smb3: fix touch -h of symlink | Problem Details:
For example:
touch -h -t 02011200 testfile
where testfile is a symlink would not change the timestamp, but
touch -t 02011200 testfile
does work to change the timestamp of the target
Suggested-by: David Howells <dhowells@redhat.com>
Reported-by: Micah Veilleux <micah.veilleux@iba-group.com>... | ```diff
diff --git a/fs/smb/client/cifsfs.c b/fs/smb/client/cifsfs.c
index 22869cda1356..ea3a7a668b45 100644
--- a/fs/smb/client/cifsfs.c
+++ b/fs/smb/client/cifsfs.c
@@ -1191,6 +1191,7 @@ const char *cifs_get_link(struct dentry *dentry, struct inode *inode,
const struct inode_operations cifs_symlink_inode_ops = {
... |
f663507e29ff061d3b6e5e8f3b75689ee9dc7214 | Analyze and fix the following issue in the Linux kernel code: SUNRPC: Force close the socket when a hard error is reported | Problem Details:
Fix up xs_wake_error() to close the socket when a hard error is being
reported. Usually, that means an ECONNRESET was received on a connection
attempt.
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com> | ```diff
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index a15bf2ede89b..58f3dc8d0d71 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1181,6 +1181,7 @@ static void xs_sock_reset_state_flags(struct rpc_xprt *xprt)
{
struct sock_xprt *transport = container_of(xprt, struct sock_xprt, xp... |
4b09ca1508a60be30b2e3940264e93d7aeb5c97e | Analyze and fix the following issue in the Linux kernel code: SUNRPC: ECONNRESET might require a rebind | Problem Details:
If connect() is returning ECONNRESET, it usually means that nothing is
listening on that port. If so, a rebind might be required in order to
obtain the new port on which the RPC service is listening.
Fixes: fd01b2597941 ("SUNRPC: ECONNREFUSED should cause a rebind.")
Signed-off-by: Trond Myklebust <tr... | ```diff
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 9c210273d06b..f6074a4b9eab 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2171,6 +2171,7 @@ call_connect_status(struct rpc_task *task)
task->tk_status = 0;
switch (status) {
case -ECONNREFUSED:
+ case -ECONNRESET:
/* A positive refusa... |
2508b608f4028c6fe0d63698f64a9bfc3eb6b780 | Analyze and fix the following issue in the Linux kernel code: m68k: 68000: fix warning in timer code | Problem Details:
When building with W=1:
CC arch/m68k/68000/timers.o
arch/m68k/68000/timers.c:120:5: warning: no previous prototype for ‘m68328_hwclk’ [-Wmissing-prototypes]
int m68328_hwclk(int set, struct rtc_time *t)
^~~~~~~~~~~~
Include m68328.h to get prototype for m68328_hwclk().
S... | ```diff
diff --git a/arch/m68k/68000/timers.c b/arch/m68k/68000/timers.c
index 0d0417cebc7f..00fb0dd12faa 100644
--- a/arch/m68k/68000/timers.c
+++ b/arch/m68k/68000/timers.c
@@ -25,6 +25,8 @@
#include <asm/machdep.h>
#include <asm/MC68VZ328.h>
+#include "m68328.h"
+
/**********************************************... |
19f144f43f4cf5d56409a8908125405e5cf6c3e0 | Analyze and fix the following issue in the Linux kernel code: m68k: 68000: fix warnings in 68000 interrupt handling | Problem Details:
When building with W=1:
CC arch/m68k/68000/ints.o
arch/m68k/68000/ints.c:77:6: warning: no previous prototype for ‘process_int’ [-Wmissing-prototypes]
void process_int(int vec, struct pt_regs *fp)
^~~~~~~~~~~
arch/m68k/68000/ints.c:153:13: warning: no previous prototy... | ```diff
diff --git a/arch/m68k/68000/ints.c b/arch/m68k/68000/ints.c
index f9a5ec781408..2ba9926e91ae 100644
--- a/arch/m68k/68000/ints.c
+++ b/arch/m68k/68000/ints.c
@@ -14,6 +14,7 @@
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/irq.h>
+#include <linux/cpu.h>
#include <asm/traps.h>
#includ... |
3b4497668f721513eb7287f6bb0c4d651759c7c4 | Analyze and fix the following issue in the Linux kernel code: m68k: coldfire: fix warnings in uboot argument processing | Problem Details:
When building with W=1:
CC arch/m68k/kernel/uboot.o
arch/m68k/kernel/uboot.c: In function ‘parse_uboot_commandline’:
arch/m68k/kernel/uboot.c:68:36: warning: variable ‘uboot_initrd_end’ set but not used [-Wunused-but-set-variable]
unsigned long uboot_initrd_start, uboot_initrd... | ```diff
diff --git a/arch/m68k/kernel/uboot.c b/arch/m68k/kernel/uboot.c
index 928dbd33fc4a..8bb1cb3a7490 100644
--- a/arch/m68k/kernel/uboot.c
+++ b/arch/m68k/kernel/uboot.c
@@ -27,6 +27,7 @@
#include <asm/irq.h>
#include <asm/machdep.h>
#include <asm/sections.h>
+#include <asm/bootinfo.h>
/*
* parse_uboot_com... |
7c2aa8d195cd34ec47ac26994adac43bfd5037b8 | Analyze and fix the following issue in the Linux kernel code: m68k: coldfire: make mcf_maskimr() static | Problem Details:
When building with W=1:
CC arch/m68k/coldfire/intc.o
arch/m68k/coldfire/intc.c:83:6: warning: no previous prototype for ‘mcf_maskimr’ [-Wmissing-prototypes]
void mcf_maskimr(unsigned int mask)
^~~~~~~~~~~
The mcf_maskimr() function is only used within this file, make it ... | ```diff
diff --git a/arch/m68k/coldfire/intc.c b/arch/m68k/coldfire/intc.c
index 20c084e932c8..b434371e2b99 100644
--- a/arch/m68k/coldfire/intc.c
+++ b/arch/m68k/coldfire/intc.c
@@ -56,7 +56,7 @@ void mcf_clrimr(int index)
__raw_writew(imr & ~(0x1 << index), MCFSIM_IMR);
}
-void mcf_maskimr(unsigned int mask)
+st... |
b6880019ff3ed72b0813b6bcb5c23afdf8b8e75c | Analyze and fix the following issue in the Linux kernel code: m68k: coldfire: add and use "vectors.h" | Problem Details:
When building with W=1:
arch/m68k/coldfire/vectors.c:43:13: warning: no previous prototype for ‘trap_init’ [-Wmissing-prototypes]
void __init trap_init(void)
^~~~~~~~~
Fix this by introducing a new header file "vectors.h" for holding the
prototypes of functions implemented i... | ```diff
diff --git a/arch/m68k/coldfire/vectors.c b/arch/m68k/coldfire/vectors.c
index 3bf0d69eec9e..c26c255b530d 100644
--- a/arch/m68k/coldfire/vectors.c
+++ b/arch/m68k/coldfire/vectors.c
@@ -18,6 +18,8 @@
#include <asm/mcfsim.h>
#include <asm/mcfwdebug.h>
+#include "vectors.h"
+
/******************************... |
7bc3db03e3dd344c3dc93c1dfe684d53d2a5ffbf | Analyze and fix the following issue in the Linux kernel code: m68knommu: fix compilation for ColdFire/Cleopatra boards | Problem Details:
The ColdFire based Cleopatra family of boards use mostly the same
external pin arrangements as the NETtel board family. The build uses the
NETtel specific code as needed, but not all the conditional defines
allow for this. If you have the CONFIG_NETtel config option set
everything compiles as expected,... | ```diff
diff --git a/arch/m68k/include/asm/nettel.h b/arch/m68k/include/asm/nettel.h
index 45716ead7b9d..3bd4b7a4613f 100644
--- a/arch/m68k/include/asm/nettel.h
+++ b/arch/m68k/include/asm/nettel.h
@@ -14,9 +14,8 @@
#define nettel_h
/****************************************************************************/
-
... |
7413ab70cbc15bd8f35a78569ec5a778fb9a3e1e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Refactor memcpy into direct assignment | Problem Details:
The memcpy() in bch2_bkey_append_ptr() is operating on an embedded fake
flexible array which looks to the compiler like it has 0 size. This
causes W=1 builds to emit warnings due to -Wstringop-overflow:
In file included from include/linux/string.h:254,
from include/linux/bitmap.... | ```diff
diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h
index 978ae5e7e8b1..879e7d218b6a 100644
--- a/fs/bcachefs/extents.h
+++ b/fs/bcachefs/extents.h
@@ -633,6 +633,8 @@ void bch2_bkey_extent_entry_drop(struct bkey_i *, union bch_extent_entry *);
static inline void bch2_bkey_append_ptr(struct bkey_i *k,... |
795413c5488536476dacff9e565e53a51d7798d8 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix drop_alloc_keys() | Problem Details:
For consistency with the rest of the reconstruct_alloc option, we should
be skipping all alloc keys.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index cd037f2e4235..4cd660650e5b 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -35,13 +35,27 @@
#define QSTR(n) { { { .len = strlen(n) } }, .name = n }
+static bool btree_id_is_alloc(enum btree_id id)
+{
+ switch (id) {
+ ca... |
1e2d399970ca1d66fa1c715f4d80a0251f2a122e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix snapshot skiplists during snapshot deletion | Problem Details:
In snapshot deleion, we have to pick new skiplist nodes for entries that
point to nodes being deleted.
The function that finds a new skiplist node, skipping over entries being
deleted, was incorrect: if n = 0, but the parent node is being deleted,
we also need to skip over that node.
Signed-off-by: K... | ```diff
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index 3ecc17b8d6fc..b8c32d1cbd76 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -1288,6 +1288,9 @@ static inline u32 bch2_snapshot_nth_parent_skip(struct bch_fs *c, u32 id, u32 n,
snapshot_id_list *skip)
{
rcu_read_lock(... |
be47e0ba4fc92bd065ac0b7ad345913eea1bc6fc | Analyze and fix the following issue in the Linux kernel code: bcachefs: KEY_TYPE_error now counts towards i_sectors | Problem Details:
KEY_TYPE_error is used when all replicas in an extent are marked as
failed; it indicates that data was present, but has been lost.
So that i_sectors doesn't change when replacing extents with
KEY_TYPE_error, we now have to count error keys as allocations - this
fixes fsck errors later.
Signed-off-by:... | ```diff
diff --git a/fs/bcachefs/extents.h b/fs/bcachefs/extents.h
index db1863165d62..978ae5e7e8b1 100644
--- a/fs/bcachefs/extents.h
+++ b/fs/bcachefs/extents.h
@@ -520,6 +520,7 @@ static inline bool bkey_extent_is_allocation(const struct bkey *k)
case KEY_TYPE_reflink_v:
case KEY_TYPE_inline_data:
case KEY_TYP... |
6929d5e74e473fb8b15875c627f7c5ad963c1889 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix handling of unknown bkey types | Problem Details:
min_val_size was U8_MAX for unknown key types, causing us to flag any
known key as invalid - it should have been 0.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c
index be9f012fc7be..d9fb1fc81f1e 100644
--- a/fs/bcachefs/bkey_methods.c
+++ b/fs/bcachefs/bkey_methods.c
@@ -121,7 +121,6 @@ const struct bkey_ops bch2_bkey_ops[] = {
};
const struct bkey_ops bch2_bkey_null_ops = {
- .min_val_size = U8_MA... |
69d1f052d1675c2af7da496f0265f68673328afb | Analyze and fix the following issue in the Linux kernel code: bcachefs: Correctly initialize new buckets on device resize | Problem Details:
bch2_dev_resize() was never updated for the allocator rewrite with
persistent freelists, and it wasn't noticed because the tests weren't
running fsck - oops.
Fix this by running bch2_dev_freespace_init() for the new buckets.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 4059d3d4b7f5..2d516207e223 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -1831,29 +1831,33 @@ void bch2_do_invalidates(struct bch_fs *c)
bch2_write_ref_put(c, BCH_WRITE_REF_invalidate);
}... |
4fc1f402c6c259b1f44e45c096ac6666925a9b87 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix another smatch complaint | Problem Details:
This should be harmless, but initialize last_seq anyways.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index 9dbaf080dcdd..cd037f2e4235 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -644,7 +644,7 @@ int bch2_fs_recovery(struct bch_fs *c)
{
struct bch_sb_field_clean *clean = NULL;
struct jset *last_journal_entry = NULL;
- u64 ... |
dc08c661a291f5e479fdde8322a4c295c69a3aef | Analyze and fix the following issue in the Linux kernel code: bcachefs: Use strsep() in split_devs() | Problem Details:
Minor refactoring to fix a smatch complaint.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index 73a3cebd734f..bc009ef497d0 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1595,7 +1595,7 @@ static struct bch_fs *bch2_path_to_fs(const char *path)
static char **split_devs(const char *_dev_name, unsigned *nr)
{
char *dev_name = NULL, **devs =... |
3c40841cdcf374d661ff14e7a707681342565166 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix crc32c checksum merge byte order problem | Problem Details:
An fsstress task on a big endian system (s390x) quickly produces a
bunch of CRC errors in the system logs. Most of these are related to
the narrow CRCs path, but the fundamental problem can be reduced to
a single write and re-read (after dropping caches) of a previously
merged extent.
The key merge pa... | ```diff
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
index 50bf4a58f37d..839f00dce50f 100644
--- a/fs/bcachefs/checksum.c
+++ b/fs/bcachefs/checksum.c
@@ -362,7 +362,7 @@ struct bch_csum bch2_checksum_merge(unsigned type, struct bch_csum a,
state.type = type;
bch2_checksum_init(&state);
- state.se... |
4220666398de7f5127bab5437b5276b3eb155282 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_inode_delete_keys() | Problem Details:
bch2_inode_delete_keys() was using BTREE_ITER_NOT_EXTENTS, on the
assumption that it would never need to split extents.
But that caused a race with extents being split by other threads -
specifically, the data move path. Extents iterators have the iterator
position pointing to the start of the extent,... | ```diff
diff --git a/fs/bcachefs/inode.c b/fs/bcachefs/inode.c
index 4a695a8e7a3b..bb3f443d8381 100644
--- a/fs/bcachefs/inode.c
+++ b/fs/bcachefs/inode.c
@@ -780,6 +780,7 @@ static int bch2_inode_delete_keys(struct btree_trans *trans,
struct btree_iter iter;
struct bkey_s_c k;
struct bkey_i delete;
+ struct bpos... |
d281701b00fc857755cd0fc08a415a694d5f49c0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix looping around bch2_propagate_key_to_snapshot_leaves() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index cdf9eda2ee02..3ecc17b8d6fc 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -1636,9 +1636,15 @@ int bch2_propagate_key_to_snapshot_leaves(struct btree_trans *trans,
if (!bch2_snapshot_is_ancestor(c, id, k.k->p.snapshot) ||
... |
1e3b40980b931728f5d2c0ef8352f6aed6799a69 | Analyze and fix the following issue in the Linux kernel code: bcachefs: More assertions for nocow locking | Problem Details:
- assert in shutdown path that no nocow locks are held
- check for overflow when taking nocow locks
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/nocow_locking.c b/fs/bcachefs/nocow_locking.c
index 396357cd8f2f..3c21981a4a1c 100644
--- a/fs/bcachefs/nocow_locking.c
+++ b/fs/bcachefs/nocow_locking.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "bcachefs.h"
+#include "bkey_methods.h"
#include "nocow_locking.h"
... |
efedfc2ece141389a9f522a298781cc929262701 | Analyze and fix the following issue in the Linux kernel code: bcachefs: nocow locking: Fix lock leak | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io_write.c b/fs/bcachefs/io_write.c
index d2a0de886c7a..6e4f85eb6ec8 100644
--- a/fs/bcachefs/io_write.c
+++ b/fs/bcachefs/io_write.c
@@ -1376,10 +1376,12 @@ err_get_ioref:
/* Fall back to COW path: */
goto out;
err_bucket_stale:
- while (--i >= 0)
+ while (i >= 0) {
bch2_bucket... |
793a06d984511593c6375d219b38cc84f5a71aff | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fixes for building in userspace | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
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_... |
b560e32ef78f8e748b74a27009ee417b9072dd88 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Always check for invalid bkeys in main commit path | Problem Details:
Previously, we would check for invalid bkeys at transaction commit time,
but only if CONFIG_BCACHEFS_DEBUG=y.
This check is important enough to always be on - it appears there's been
corruption making it into the journal that would have been caught by it.
Signed-off-by: Kent Overstreet <kent.overstre... | ```diff
diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c
index 183db5d67a26..04c1f4610972 100644
--- a/fs/bcachefs/btree_trans_commit.c
+++ b/fs/bcachefs/btree_trans_commit.c
@@ -776,7 +776,6 @@ static noinline void bch2_drop_overwrites_from_journal(struct btree_trans *trans
bch2_jour... |
eebe8a8459f78bbac5a12d0ef76838929d736ad2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Make sure to initialize equiv when creating new snapshots | Problem Details:
Previously, equiv was set in the snapshot deletion path, which is where
it's needed - equiv, for snapshot ID equivalence classes, would ideally
be a private data structure to the snapshot deletion path.
But if a new snapshot is created while snapshot deletion is running,
move_key_to_correct_snapshot()... | ```diff
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index f27e8c4fc10a..cdf9eda2ee02 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -343,7 +343,7 @@ int bch2_snapshot_lookup(struct btree_trans *trans, u32 id,
BTREE_ITER_WITH_UPDATES, snapshot, s);
}
-int bch2_snapsho... |
82142a5541063addd15c84fcda890675035df8aa | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a null ptr deref in bch2_get_alloc_in_memory_pos() | Problem Details:
Reported-by: smatch
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index 43defeaa1718..cc856150a948 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -703,7 +703,7 @@ static int bch2_get_alloc_in_memory_pos(struct btree_trans *trans,
--btree_nodes;
if (!btree_nodes) {
- *en... |
d8b6f8c3c6fe7eb279d031c5f7bdde086185f0d1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix changing durability using sysfs | Problem Details:
Signed-off-by: Torge Matthies <openglfreak@googlemail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/sysfs.c b/fs/bcachefs/sysfs.c
index 03dbea4d95ce..b700be5b6664 100644
--- a/fs/bcachefs/sysfs.c
+++ b/fs/bcachefs/sysfs.c
@@ -977,7 +977,7 @@ STORE(bch2_dev)
mutex_lock(&c->sb_lock);
mi = &bch2_sb_get_members(c->disk_sb.sb)->members[ca->dev_idx];
- if (v != BCH_MEMBER_DURABILIT... |
7239f8e0ee7fb0504d18b9570172688684f3606d | Analyze and fix the following issue in the Linux kernel code: bcachefs: initial freeze/unfreeze support | Problem Details:
Initial support for the vfs superblock freeze and unfreeze
operations. Superblock freeze occurs in stages, where the vfs
attempts to quiesce high level write operations, page faults, fs
internal operations, and then finally calls into the filesystem for
any last stage steps (i.e. log flushing, etc.) be... | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index bfbd4f004edc..73a3cebd734f 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1716,6 +1716,35 @@ static void bch2_put_super(struct super_block *sb)
__bch2_fs_stop(c);
}
+/*
+ * bcachefs doesn't currently integrate intwrite freeze protection but t... |
40a53b92150fe9576538f775138413c40cdb30cf | Analyze and fix the following issue in the Linux kernel code: bcachefs: More minor smatch fixes | Problem Details:
- fix a few uninitialized return values
- return a proper error code in lookup_lostfound()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update.c b/fs/bcachefs/btree_update.c
index 3342718de45d..324767c0ddcc 100644
--- a/fs/bcachefs/btree_update.c
+++ b/fs/bcachefs/btree_update.c
@@ -124,7 +124,7 @@ int __bch2_insert_snapshot_whiteouts(struct btree_trans *trans,
struct bkey_s_c old_k, new_k;
snapshot_id_list s;... |
51c801bc6414e88d686fb3229c54d7dda1508778 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Minor bch2_btree_node_get() smatch fixes | Problem Details:
- it's no longer possible for trans to be NULL
- also, move "wait for read to complete" to the slowpath,
__bch2_btree_node_get().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_cache.c b/fs/bcachefs/btree_cache.c
index ef9492f7e937..82cf243aa288 100644
--- a/fs/bcachefs/btree_cache.c
+++ b/fs/bcachefs/btree_cache.c
@@ -746,7 +746,7 @@ static noinline struct btree *bch2_btree_node_fill(struct btree_trans *trans,
six_unlock_intent(&b->c.lock);
/* Unl... |
97ecc23632fad75c43809b3f5010800289884a08 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix strndup_user() error checking | Problem Details:
strndup_user() returns an error pointer, not NULL.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c
index e8b6733e7f71..f69e15dc699c 100644
--- a/fs/bcachefs/chardev.c
+++ b/fs/bcachefs/chardev.c
@@ -86,10 +86,9 @@ static long bch2_ioctl_assemble(struct bch_ioctl_assemble __user *user_arg)
devs[i] = strndup_user((const char __user *)(unsigned long)... |
75e0c4789b623db0abae497160202bc5f5d2522e | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix error checks in bch2_chacha_encrypt_key() | Problem Details:
crypto_alloc_sync_skcipher() returns an ERR_PTR, not NULL.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
index 3f385d499026..c70262b7fd6e 100644
--- a/fs/bcachefs/checksum.c
+++ b/fs/bcachefs/checksum.c
@@ -159,15 +159,16 @@ int bch2_chacha_encrypt_key(struct bch_key *key, struct nonce nonce,
crypto_alloc_sync_skcipher("chacha20", 0, 0);
int ret;
... |
a55fc65eb2c71da5d422937db767a78c6438f9b6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix an overflow check | Problem Details:
When bucket sector counts were changed from u16s to u32s, a few things
were missed. This fixes an overflow check, and a truncation that
prevented the overflow check from firing.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/buckets.c b/fs/bcachefs/buckets.c
index 994129142d39..e7f4506f69ca 100644
--- a/fs/bcachefs/buckets.c
+++ b/fs/bcachefs/buckets.c
@@ -680,7 +680,7 @@ static int check_bucket_ref(struct btree_trans *trans,
struct bch_fs *c = trans->c;
struct bch_dev *ca = bch_dev_bkey_exists(c, ptr->... |
f7f6943a8c6dccbd085600bbb7bae4f6f6047dc4 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix copy_to_user() usage in flush_buf() | Problem Details:
copy_to_user() returns the number of bytes successfully copied - not an
errcode.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/debug.c b/fs/bcachefs/debug.c
index 404148bd348a..75a3dc7cbd47 100644
--- a/fs/bcachefs/debug.c
+++ b/fs/bcachefs/debug.c
@@ -319,16 +319,16 @@ static ssize_t flush_buf(struct dump_iter *i)
{
if (i->buf.pos) {
size_t bytes = min_t(size_t, i->buf.pos, i->size);
- int err = copy_to... |
3e55189b504f961e68e631b72a2ed71991397ef9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix race between journal entry close and pin set | Problem Details:
bcachefs freeze testing via fstests generic/390 occasionally
reproduces the following BUG from bch2_fs_read_only():
BUG_ON(atomic_long_read(&c->btree_key_cache.nr_dirty));
This indicates that one or more dirty key cache keys still exist
after the attempt to flush and quiesce the fs. The sequence th... | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index be61d43458eb..fc3dd5bef386 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -132,13 +132,21 @@ journal_error_check_stuck(struct journal *j, int error, unsigned flags)
return stuck;
}
-/* journal entry close/open: */
-
-void b... |
fc08031bb84b2b4660406faf9f30db8cdd09d022 | Analyze and fix the following issue in the Linux kernel code: bcachefs: prepare journal buf put to handle pin put | Problem Details:
bcachefs freeze testing has uncovered some raciness between journal
entry open/close and pin list reference count management. The
details of the problem are described in a separate patch. In
preparation for the associated fix, refactor the journal buffer put
path a bit to allow it to eventually handle ... | ```diff
diff --git a/fs/bcachefs/journal.c b/fs/bcachefs/journal.c
index 210a2b90bb50..be61d43458eb 100644
--- a/fs/bcachefs/journal.c
+++ b/fs/bcachefs/journal.c
@@ -134,7 +134,7 @@ journal_error_check_stuck(struct journal *j, int error, unsigned flags)
/* journal entry close/open: */
-void __bch2_journal_buf_put... |
d67a72bfc92b0c0dab9c134964090c4700892e67 | Analyze and fix the following issue in the Linux kernel code: bcachefs: snapshot: Add missing assignment in bch2_delete_dead_snapshots() | Problem Details:
This code accidentally left out the "ret = " assignment so the errors
from for_each_btree_key2() are not checked.
Fixes: 53534482a250 ("bcachefs: for_each_btree_key2()")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index ff7f71576d5c..0acfca00a6af 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -1405,8 +1405,8 @@ int bch2_delete_dead_snapshots(struct bch_fs *c)
goto err;
}
- for_each_btree_key2(trans, iter, BTREE_ID_snapshots,
- P... |
1f12900ab52304a7c41714b6ad86990eb428fbc9 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fs-ioctl: Fix copy_to_user() error code | Problem Details:
The copy_to_user() function returns the number of bytes that it wasn't
able to copy but we want to return -EFAULT to the user.
Fixes: e0750d947352 ("bcachefs: Initial commit")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs-ioctl.c b/fs/bcachefs/fs-ioctl.c
index 141bcced031e..0679b2f79fd6 100644
--- a/fs/bcachefs/fs-ioctl.c
+++ b/fs/bcachefs/fs-ioctl.c
@@ -122,7 +122,10 @@ static int bch2_ioc_fsgetxattr(struct bch_inode_info *inode,
fa.fsx_projid = inode->ei_qid.q[QTYP_PRJ];
- return copy_to_user(... |
b6c22147e0fcfd16e672093178d940db3ea6923e | Analyze and fix the following issue in the Linux kernel code: bcachefs: acl: Add missing check in bch2_acl_chmod() | Problem Details:
The "ret = bkey_err(k);" assignment was accidentally left out so the
call to bch2_btree_iter_peek_slot() is not checked for errors.
Fixes: 53306e096d91 ("bcachefs: Always check for transaction restarts")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overs... | ```diff
diff --git a/fs/bcachefs/acl.c b/fs/bcachefs/acl.c
index 6b1579e96dfe..f3809897f00a 100644
--- a/fs/bcachefs/acl.c
+++ b/fs/bcachefs/acl.c
@@ -427,9 +427,10 @@ int bch2_acl_chmod(struct btree_trans *trans, subvol_inum inum,
return bch2_err_matches(ret, ENOENT) ? 0 : ret;
k = bch2_btree_iter_peek_slot(&it... |
e9a0a26ed05a93034f3d49374dd5ef943db2d5b7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: acl: Uninitialized variable in bch2_acl_chmod() | Problem Details:
The clean up code at the end of the function uses "acl" so it needs
to be initialized to NULL.
Fixes: 53306e096d91 ("bcachefs: Always check for transaction restarts")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/acl.c b/fs/bcachefs/acl.c
index 9653401957b3..6b1579e96dfe 100644
--- a/fs/bcachefs/acl.c
+++ b/fs/bcachefs/acl.c
@@ -417,7 +417,7 @@ int bch2_acl_chmod(struct btree_trans *trans, subvol_inum inum,
struct btree_iter iter;
struct bkey_s_c_xattr xattr;
struct bkey_i_xattr *new;
- st... |
265cc423155d56030e44068680085adb59800326 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wself-assign | Problem Details:
Fixes the following observed error reported by Nathan on IRC.
fs/bcachefs/io_misc.c:467:6: error: explicitly assigning value of
variable of type 'int' to itself [-Werror,-Wself-assign]
467 | ret = ret;
| ~~~ ^ ~~~
Reported-by: Nathan Chancellor <nathan@kernel.org>
Sign... | ```diff
diff --git a/fs/bcachefs/io_misc.c b/fs/bcachefs/io_misc.c
index 668493bcfe36..32432bdddac4 100644
--- a/fs/bcachefs/io_misc.c
+++ b/fs/bcachefs/io_misc.c
@@ -462,9 +462,9 @@ btree_err:
bch2_logged_op_update(trans, &op->k_i));
}
- fallthrough;
+ break;
case LOGGED_OP_FINSERT_finish:
- ret = ret;
+ bre... |
3b59fbec86e3cda0fae2ad15139ac458e024fab1 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Remove duplicate include | Problem Details:
./fs/bcachefs/btree_update.h: journal.h is included more than once.
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=6573
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_update.h b/fs/bcachefs/btree_update.h
index 4bfe602ce8e3..9816d2286540 100644
--- a/fs/bcachefs/btree_update.h
+++ b/fs/bcachefs/btree_update.h
@@ -4,7 +4,6 @@
#include "btree_iter.h"
#include "journal.h"
-#include "journal.h"
struct bch_fs;
struct btree;
``` |
867c1fe0187f6df4dca84a34332e00f21ef80f69 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix error checking in bch2_fs_alloc() | Problem Details:
There is a typo here where it uses ";" instead of "?:". The result is
that bch2_fs_fs_io_direct_init() is called unconditionally and the errors
from it are not checked.
Fixes: 0060c68159fc ("bcachefs: Split up fs-io.[ch]")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Ov... | ```diff
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 2990eed85adf..e94a63a22704 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -852,7 +852,7 @@ static struct bch_fs *bch2_fs_alloc(struct bch_sb *sb, struct bch_opts opts)
bch2_fs_compress_init(c) ?:
bch2_fs_ec_init(c) ?:
... |
4ba985b84de627ba4f257c9843d0dd7146df2180 | Analyze and fix the following issue in the Linux kernel code: bcachefs: chardev: fix an integer overflow (32 bit only) | Problem Details:
On 32 bit systems, "sizeof(*arg) + replica_entries_bytes" can have an
integer overflow leading to memory corruption. Use size_add() to
prevent this.
Fixes: b44dd3797034 ("bcachefs: Redo filesystem usage ioctls")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <k... | ```diff
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c
index e5e9fddddfb5..51d671267741 100644
--- a/fs/bcachefs/chardev.c
+++ b/fs/bcachefs/chardev.c
@@ -421,7 +421,7 @@ static long bch2_ioctl_fs_usage(struct bch_fs *c,
if (get_user(replica_entries_bytes, &user_arg->replica_entries_bytes))
return -EFA... |
301e0237cadfc7c446e16eab6df38073ade3631d | Analyze and fix the following issue in the Linux kernel code: bcachefs: chardev: return -EFAULT if copy_to_user() fails | Problem Details:
The copy_to_user() function returns the number of bytes remaining but
we want to return -EFAULT to the user.
Fixes: e0750d947352 ("bcachefs: Initial commit")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/chardev.c b/fs/bcachefs/chardev.c
index fb603df099a5..e5e9fddddfb5 100644
--- a/fs/bcachefs/chardev.c
+++ b/fs/bcachefs/chardev.c
@@ -149,9 +149,10 @@ static long bch2_global_ioctl(unsigned cmd, void __user *arg)
static long bch2_ioctl_query_uuid(struct bch_fs *c,
struct bch_ioctl_... |
8c2d82a6fe6fa0e3503c56c08d7fc599d66e2b79 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Change bucket_lock() to use bit_spin_lock() | Problem Details:
bucket_lock() previously open coded a spinlock, because we need to cram
a spinlock into a single byte.
But it turns out not all archs support xchg() on a single byte; since we
need struct bucket to be small, this means we have to play fun games
with casts and ifdefs for endianness.
This fixes buildin... | ```diff
diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h
index 0eff05c79c65..ecbeb7280f87 100644
--- a/fs/bcachefs/buckets.h
+++ b/fs/bcachefs/buckets.h
@@ -40,15 +40,42 @@ static inline size_t sector_to_bucket_and_offset(const struct bch_dev *ca, secto
for (_b = (_buckets)->b + (_buckets)->first_bucket; \
... |
439c172bc763fc1ef33246a0fb23920c1e01ffa7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Kill other unreachable() uses | Problem Details:
Per previous commit, bare unreachable() considered harmful, convert to
BUG()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bset.c b/fs/bcachefs/bset.c
index cff7486ef446..bb73ba9017b0 100644
--- a/fs/bcachefs/bset.c
+++ b/fs/bcachefs/bset.c
@@ -1189,7 +1189,7 @@ struct bkey_packed *__bch2_bset_search(struct btree *b,
case BSET_RO_AUX_TREE:
return bset_search_tree(b, t, search, lossy_packed_search);
d... |
3764647b255aafb590d03066d5c1a344463e3637 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Remove undefined behavior in bch2_dev_buckets_reserved() | Problem Details:
In general it's a good idea to avoid using bare unreachable() because it
introduces undefined behavior in compiled code. In this case it even
confuses GCC into emitting an empty unused
bch2_dev_buckets_reserved.part.0() function.
Use BUG() instead, which is nice and defined. While in theory it shoul... | ```diff
diff --git a/fs/bcachefs/buckets.h b/fs/bcachefs/buckets.h
index f192809f50cf..0eff05c79c65 100644
--- a/fs/bcachefs/buckets.h
+++ b/fs/bcachefs/buckets.h
@@ -180,7 +180,7 @@ static inline u64 bch2_dev_buckets_reserved(struct bch_dev *ca, enum bch_waterma
switch (watermark) {
case BCH_WATERMARK_NR:
- unr... |
71933fb69b7c5fe5efd2119b645d4fde337a6f3f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix use-after-free in bch2_dev_add() | Problem Details:
If __bch2_dev_attach_bdev() fails, bch2_dev_free() is called twice.
Once here and another time in the error handling path.
This leads to several use-after-free.
Remove the redundant call and only rely on the error handling path.
Fixes: 6a44735653d4 ("bcachefs: Improved superblock-related error messa... | ```diff
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 94e296397e32..9f852a6dd76a 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -1613,10 +1613,8 @@ int bch2_dev_add(struct bch_fs *c, const char *path)
bch2_dev_usage_init(ca);
ret = __bch2_dev_attach_bdev(ca, &sb);
- if (ret) {
- bch... |
a9737e0b38352e984fc67d5694b2c207c6b9679f | Analyze and fix the following issue in the Linux kernel code: bcachefs: add module description to fix modpost warning | Problem Details:
modpost produces the following warning:
WARNING: modpost: missing MODULE_DESCRIPTION() in fs/bcachefs/bcachefs.o
Add a module description for bcachefs.
Signed-off-by: Brian Foster <bfoster@redhat.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index a00dc4a4a2c9..94e296397e32 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -69,6 +69,7 @@
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Kent Overstreet <kent.overstreet@gmail.com>");
+MODULE_DESCRIPTION("bcachefs filesystem");
#define KTY... |
e82f5f40f2b936063361812cad9338ce792dde2f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wcompare-distinct-pointer-types in bch2_copygc_get_buckets() | Problem Details:
When building bcachefs for 32-bit ARM, there is a warning when using
max() to compare an expression involving 'size_t' with an 'unsigned
long' literal:
fs/bcachefs/movinggc.c:159:21: error: comparison of distinct pointer types ('typeof (16UL) *' (aka 'unsigned long *') and 'typeof (buckets_in_flight... | ```diff
diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index 2371fd61ea58..83ebb56a3fae 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -148,7 +148,7 @@ static int bch2_copygc_get_buckets(struct btree_trans *trans,
struct bch_fs *c = trans->c;
struct btree_iter iter;
struct bkey_... |
53eda6f7130adb194cb3b089bc38fc32d9a1f7d5 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wcompare-distinct-pointer-types in do_encrypt() | Problem Details:
When building bcachefs for 32-bit ARM, there is a warning when using
min() to compare a variable of type 'size_t' with an expression of type
'unsigned long':
fs/bcachefs/checksum.c:142:22: error: comparison of distinct pointer types ('typeof (len) *' (aka 'unsigned int *') and 'typeof (((1UL) << 12)... | ```diff
diff --git a/fs/bcachefs/checksum.c b/fs/bcachefs/checksum.c
index 36939020f67d..ff0c3cd39ee2 100644
--- a/fs/bcachefs/checksum.c
+++ b/fs/bcachefs/checksum.c
@@ -139,7 +139,7 @@ static inline int do_encrypt(struct crypto_sync_skcipher *tfm,
for (i = 0; i < pages; i++) {
unsigned offset = offset_in_pag... |
1f70225d7791e67084073e54489440d7cf8017e0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wincompatible-function-pointer-types-strict from key_invalid callbacks | Problem Details:
When building bcachefs with -Wincompatible-function-pointer-types-strict,
a clang warning designed to catch issues with mismatched function
pointer types, which will be fatal at runtime due to kernel Control Flow
Integrity (kCFI), there are several instances along the lines of:
fs/bcachefs/bkey_meth... | ```diff
diff --git a/fs/bcachefs/bkey_methods.c b/fs/bcachefs/bkey_methods.c
index 91e28ee3efff..82f30ffbfb86 100644
--- a/fs/bcachefs/bkey_methods.c
+++ b/fs/bcachefs/bkey_methods.c
@@ -26,7 +26,7 @@ const char * const bch2_bkey_types[] = {
};
static int deleted_key_invalid(const struct bch_fs *c, struct bkey_s_c ... |
0940863fd2186c521d91aaf58b28d872fb1bba6c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wformat in bch2_bucket_gens_invalid() | Problem Details:
When building bcachefs for 32-bit ARM, there is a compiler warning in
bch2_bucket_gens_invalid() due to use of an incorrect format specifier:
fs/bcachefs/alloc_background.c:530:10: error: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned int') [-Werror,-Wformat]... | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index a012fffb1dc4..ee21aeece39e 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -526,7 +526,7 @@ int bch2_bucket_gens_invalid(const struct bch_fs *c, struct bkey_s_c k,
struct printbuf *err... |
14f63ff3f6617902cd54edb468b906214ab00f34 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wformat in bch2_alloc_v4_invalid() | Problem Details:
When building bcachefs for 32-bit ARM, there is a compiler warning in
bch2_alloc_v4_invalid() due to use of an incorrect format specifier:
fs/bcachefs/alloc_background.c:246:30: error: format specifies type 'unsigned long' but the argument has type 'unsigned int' [-Werror,-Wformat]
245 | ... | ```diff
diff --git a/fs/bcachefs/alloc_background.c b/fs/bcachefs/alloc_background.c
index 5c60f956b598..a012fffb1dc4 100644
--- a/fs/bcachefs/alloc_background.c
+++ b/fs/bcachefs/alloc_background.c
@@ -242,7 +242,7 @@ int bch2_alloc_v4_invalid(const struct bch_fs *c, struct bkey_s_c k,
struct bkey_s_c_alloc_v4 a = b... |
f7ed15eb177ffd55e97c5817e2ccaacc364be4cd | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wformat in bch2_btree_key_cache_to_text() | Problem Details:
When building bcachefs for 32-bit ARM, there is a compiler warning in
bch2_btree_key_cache_to_text() due to use of an incorrect format
specifier:
fs/bcachefs/btree_key_cache.c:1060:36: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'long' [-Werror,-Wformat]
1... | ```diff
diff --git a/fs/bcachefs/btree_key_cache.c b/fs/bcachefs/btree_key_cache.c
index 505e7c365ab7..a74ee6d8a7cf 100644
--- a/fs/bcachefs/btree_key_cache.c
+++ b/fs/bcachefs/btree_key_cache.c
@@ -1053,7 +1053,7 @@ int bch2_fs_btree_key_cache_init(struct btree_key_cache *bc)
void bch2_btree_key_cache_to_text(struc... |
fac1250a8cc3af0e45c07ad59d7e1eabf5213688 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix -Wformat in bch2_set_bucket_needs_journal_commit() | Problem Details:
When building bcachefs for 32-bit ARM, there is a compiler warning in
bch2_set_bucket_needs_journal_commit() due to a debug print using the
wrong specifier:
fs/bcachefs/buckets_waiting_for_journal.c:137:30: error: format specifies type 'size_t' (aka 'unsigned int') but the argument has type 'unsigne... | ```diff
diff --git a/fs/bcachefs/buckets_waiting_for_journal.c b/fs/bcachefs/buckets_waiting_for_journal.c
index 81ab685cdef9..ec1b636ef78d 100644
--- a/fs/bcachefs/buckets_waiting_for_journal.c
+++ b/fs/bcachefs/buckets_waiting_for_journal.c
@@ -133,7 +133,7 @@ retry_rehash:
b->t = n;
kvfree(t);
- pr_debug("took... |
6bf3766b5211dde53e5a2f88082d71073ea6e7df | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a handful of spelling mistakes in various messages | Problem Details:
There are several spelling mistakes in error messages. Fix these.
Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/backpointers.c b/fs/bcachefs/backpointers.c
index 8747c5e19f99..bec62e5b21e5 100644
--- a/fs/bcachefs/backpointers.c
+++ b/fs/bcachefs/backpointers.c
@@ -357,7 +357,7 @@ static int bch2_check_btree_backpointer(struct btree_trans *trans, struct btree_
int ret = 0;
if (fsck_err_on(!... |
b030e262b517b6bddc4bfa88ed8d335ef9de7671 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Log truncate operations | Problem Details:
Previously, we guaranteed atomicity of truncate after unclean shutdown
with the BCH_INODE_I_SIZE_DIRTY flag - which required a full scan of the
inodes btree.
Recently the deleted inodes btree was added so that we no longer have to
scan for deleted inodes, but truncate was unfinished and that change
le... | ```diff
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index 31efa9e381ce..3c9e788f1c9d 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -370,7 +370,8 @@ static inline void bkey_init(struct bkey *k)
x(backpointer, 28) \
x(inode_v3, 29) \
x(bucket_... |
c7afec9bd63dc00047c35f9b747aa2be505533e6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch_sb_handle type | Problem Details:
blk_mode_t was recently introduced; we should be using it now, instead
of fmode_t.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/super_types.h b/fs/bcachefs/super_types.h
index 08faeedba326..597a8db73585 100644
--- a/fs/bcachefs/super_types.h
+++ b/fs/bcachefs/super_types.h
@@ -8,7 +8,7 @@ struct bch_sb_handle {
struct bio *bio;
void *holder;
size_t buffer_size;
- fmode_t mode;
+ blk_mode_t mode;
... |
c872afa22420cbbeb8c78656926928b9e2abae18 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_propagate_key_to_snapshot_leaves() | Problem Details:
When we handle a transaction restart in a nested context, we need to
return -BCH_ERR_transaction_restart_nested because we invalidated the
outer context's iterators and locks.
bch2_propagate_key_to_snapshot_leaves() wasn't doing this, this patch
fixes it to use trans_was_restarted().
Signed-off-by: K... | ```diff
diff --git a/fs/bcachefs/btree_iter.h b/fs/bcachefs/btree_iter.h
index 4469b2e166eb..b885e4e210d4 100644
--- a/fs/bcachefs/btree_iter.h
+++ b/fs/bcachefs/btree_iter.h
@@ -276,9 +276,11 @@ int bch2_trans_relock_notrace(struct btree_trans *);
void bch2_trans_unlock(struct btree_trans *);
bool bch2_trans_locked(... |
5b7fbdcd5b04b618178d6339e36435997ef6b086 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix silent enum conversion error | Problem Details:
This changes mark_btree_node_locked() to take an enum
btree_node_locked_type, not a six_lock_type, since BTREE_NODE_UNLOCKED
is -1 which may cause problems converting back and forth to
six_lock_type if short enums are in use.
With this change, we never store BTREE_NODE_UNLOCKED in a six_lock_type
enum... | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index 98cf52c5e132..1dbb4d7dfb45 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -689,7 +689,7 @@ void bch2_trans_node_add(struct btree_trans *trans, struct btree *b)
if (t != BTREE_NODE_UNLOCKED) {
btree_node_unlo... |
5cfd69775eb5460ef78bb5034a37eb0dc52ab65d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Array bounds fixes | Problem Details:
It's no longer legal to use a zero size array as a flexible array
member - this causes UBSAN to complain.
This patch switches our zero size arrays to normal flexible array
members when possible, and inserts casts in other places (e.g. where we
use the zero size array as a marker partway through an arr... | ```diff
diff --git a/fs/bcachefs/bcachefs_format.h b/fs/bcachefs/bcachefs_format.h
index f17238be494c..1cce2504bca6 100644
--- a/fs/bcachefs/bcachefs_format.h
+++ b/fs/bcachefs/bcachefs_format.h
@@ -723,7 +723,7 @@ struct bch_inode {
__le64 bi_hash_seed;
__le32 bi_flags;
__le16 bi_mode;
- __u8 fields[0];
... |
197763a70b6a530d959659abb917166a2f193520 | Analyze and fix the following issue in the Linux kernel code: bcachefs: restart journal reclaim thread on ro->rw transitions | Problem Details:
Commit c2d5ff36065a4 ("bcachefs: Start journal reclaim thread
earlier") tweaked reclaim thread management to start a bit earlier
in the mount sequence by moving the start call from
__bch2_fs_read_write() to bch2_fs_journal_start(). This has the side
effect of never starting the reclaim thread on a ro->... | ```diff
diff --git a/fs/bcachefs/super.c b/fs/bcachefs/super.c
index 60424865980d..29cd71445a94 100644
--- a/fs/bcachefs/super.c
+++ b/fs/bcachefs/super.c
@@ -421,6 +421,10 @@ static int __bch2_fs_read_write(struct bch_fs *c, bool early)
return ret;
}
+ ret = bch2_journal_reclaim_start(&c->journal);
+ if (ret)
+... |
097d4cc8fde898334569271c9b3e24d99788ade0 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix snapshot_skiplist_good() | Problem Details:
We weren't correctly checking snapshot skiplist nodes - we were checking
if they were in the same tree, not if they were an actual ancestor.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index 07e5c1b44b06..9da09911466e 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -655,28 +655,18 @@ u32 bch2_snapshot_skiplist_get(struct bch_fs *c, u32 id)
return id;
}
-static int snapshot_skiplist_good(struct btree_trans *t... |
4491283f8d827bdfc6baed27028ae636494bdbac | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix a double free on invalid bkey | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c
index e099fe570962..f498513d35f3 100644
--- a/fs/bcachefs/btree_trans_commit.c
+++ b/fs/bcachefs/btree_trans_commit.c
@@ -801,7 +801,6 @@ static noinline int bch2_trans_commit_bkey_invalid(struct btree_trans *trans, un
bch2_inc... |
da525760802b9f18cd9eb9ecdb23952f41723de2 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix btree write buffer with snapshots btrees | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_trans_commit.c b/fs/bcachefs/btree_trans_commit.c
index 83cc7f64c57c..e099fe570962 100644
--- a/fs/bcachefs/btree_trans_commit.c
+++ b/fs/bcachefs/btree_trans_commit.c
@@ -97,6 +97,7 @@ bool bch2_btree_bset_insert_key(struct btree_trans *trans,
EBUG_ON(bpos_gt(insert->k.p, b->da... |
66487c54ad8207ef1c029df45ffaeaafbcc11f77 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix is_ancestor bitmap | Problem Details:
The is_ancestor bitmap is at optimization for bch2_snapshot_is_ancestor;
once we get sufficiently close to the ancestor ID we're searching for we
test a bitmap.
But initialization of the is_ancestor bitmap was broken; we do it by
using bch2_snapshot_parent(), but we call that on nodes that haven't
bee... | ```diff
diff --git a/fs/bcachefs/snapshot.c b/fs/bcachefs/snapshot.c
index 0284250ac6cc..56961c074674 100644
--- a/fs/bcachefs/snapshot.c
+++ b/fs/bcachefs/snapshot.c
@@ -88,6 +88,20 @@ static int bch2_snapshot_tree_create(struct btree_trans *trans,
/* Snapshot nodes: */
+static bool bch2_snapshot_is_ancestor_earl... |
7573041ab958a14407621ef9756be49548f937e6 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_mount error path | Problem Details:
In the bch2_mount() error path, we were calling
deactivate_locked_super(), which calls ->kill_sb(), which in our case
was calling bch2_fs_free() without __bch2_fs_stop().
This changes bch2_mount() to just call bch2_fs_stop() directly.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs.c b/fs/bcachefs/fs.c
index d2f93a8af4ac..48431700b83e 100644
--- a/fs/bcachefs/fs.c
+++ b/fs/bcachefs/fs.c
@@ -1906,7 +1906,10 @@ out:
return dget(sb->s_root);
err_put_super:
+ sb->s_fs_info = NULL;
+ c->vfs_sb = NULL;
deactivate_locked_super(sb);
+ bch2_fs_stop(c);
return E... |
d0445e131e3ff1a68492f7f6e754cd672db4774d | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix divide by zero in rebalance_work() | Problem Details:
This fixes https://github.com/koverstreet/bcachefs-tools/issues/159
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/rebalance.c b/fs/bcachefs/rebalance.c
index c3d577236ce2..15ce3ecba0ba 100644
--- a/fs/bcachefs/rebalance.c
+++ b/fs/bcachefs/rebalance.c
@@ -113,6 +113,10 @@ static void rebalance_work_accumulate(struct rebalance_work *w,
unsigned percent_full;
u64 work = dev_work + unknown_dev;
... |
62898dd12ba017c56c39a74ef891845118b0c190 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix swallowing of data in buffered write path | Problem Details:
In __bch2_buffered_write, if we fail to write to an entire !uptodate
folio, we have to back out the write, bail out and retry.
But we were missing an iov_iter_revert() call, so the data written to
the folio was lost and the rest of the write shifted to the wrong
offset.
Signed-off-by: Kent Overstreet... | ```diff
diff --git a/fs/bcachefs/fs-io-buffered.c b/fs/bcachefs/fs-io-buffered.c
index 102c70887f76..dc22182d532f 100644
--- a/fs/bcachefs/fs-io-buffered.c
+++ b/fs/bcachefs/fs-io-buffered.c
@@ -909,6 +909,7 @@ static int __bch2_buffered_write(struct bch_inode_info *inode,
if (!folio_test_uptodate(f) &&
f_cop... |
8c9b0f7bdc4183573d57f0442693d99cc9758617 | Analyze and fix the following issue in the Linux kernel code: bcachefs: fix up wonky error handling in bch2_seek_pagecache_hole() | Problem Details:
The folio_hole_offset() helper returns a mix of bool and int types.
The latter is to support a possible -EAGAIN error code when using
nonblocking locks. This is not only confusing, but the only caller
also essentially ignores errors outside of stopping the range
iteration. This means an -EAGAIN error c... | ```diff
diff --git a/fs/bcachefs/fs-io-pagecache.c b/fs/bcachefs/fs-io-pagecache.c
index 2c1ef13d9bcd..1e60eead2981 100644
--- a/fs/bcachefs/fs-io-pagecache.c
+++ b/fs/bcachefs/fs-io-pagecache.c
@@ -698,20 +698,26 @@ loff_t bch2_seek_pagecache_data(struct inode *vinode,
return end_offset;
}
+/*
+ * Search for a ho... |
029b85fe417c36b5689093dd4861c7980299a50f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bkey format calculation | Problem Details:
For extents, we increase the number of bits of the size field to allow
extents to get bigger due to merging - but this code didn't check for
overflow.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey.c b/fs/bcachefs/bkey.c
index d6960e259c80..0a5bfe6e9a2d 100644
--- a/fs/bcachefs/bkey.c
+++ b/fs/bcachefs/bkey.c
@@ -591,8 +591,10 @@ struct bkey_format bch2_bkey_format_done(struct bkey_format_state *s)
/* allow for extent merging: */
if (ret.bits_per_field[BKEY_FIELD_SIZE])... |
c8ef8c3eb573ae2d7f7f41d93f0e34b8f6dfcd6f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix bch2_extent_fallocate() | Problem Details:
- There was no need for a retry loop in bch2_extent_fallocate(); if we
have to retry we may be overwriting something different and we need
to return an error and let the caller retry.
- The bch2_alloc_sectors_start() error path was wrong, and wasn't
running our cleanup at the end of the funct... | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index a3dc944d63cf..3c614c864b6e 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -380,10 +380,10 @@ int bch2_extent_fallocate(struct btree_trans *trans,
struct bch_fs *c = trans->c;
struct disk_reservation disk_res = { 0 };
struct closure cl;
- stru... |
ff5b741c25fb9546d876ca4c0c1d8720f6a2471c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Zero btree_paths on allocation | Problem Details:
This fixes a bug in the cycle detector, bch2_check_for_deadlock() - we
have to make sure the node pointers in the btree paths array are set to
something not-garbage before another thread may see them.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_iter.c b/fs/bcachefs/btree_iter.c
index ad95849845a5..d22412dc5b46 100644
--- a/fs/bcachefs/btree_iter.c
+++ b/fs/bcachefs/btree_iter.c
@@ -2898,12 +2898,14 @@ static void bch2_trans_alloc_paths(struct btree_trans *trans, struct bch_fs *c)
#ifdef __KERNEL__
p = this_cpu_xchg(c-... |
e9679b4a0618b0b55d22ec555bc9c6b2dab39809 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix 'pointer to invalid device' check | Problem Details:
This fixes the device removal tests, which have been failing at random
due to the fact that when we're running the .key_invalid checks in the
write path the key may actually no longer exist - we might be racing
with the keys being deleted.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/extents.c b/fs/bcachefs/extents.c
index d7f74db4c83e..1b25f84e4b9c 100644
--- a/fs/bcachefs/extents.c
+++ b/fs/bcachefs/extents.c
@@ -1059,6 +1059,7 @@ void bch2_bkey_ptrs_to_text(struct printbuf *out, struct bch_fs *c,
static int extent_ptr_invalid(const struct bch_fs *c,
... |
df5a915a15a7343170f6ce707d807daa9efc245c | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix lifetime in bch2_write_done(), add assertion | Problem Details:
We're hunting for an open_bucket leak, add an assertion to help track it
down: also, we can't use the bch_fs after dropping our write ref to it.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index f42d9da2e16e..499585d7cc5d 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -710,13 +710,15 @@ static void bch2_write_done(struct closure *cl)
struct bch_write_op *op = container_of(cl, struct bch_write_op, cl);
struct bch_fs *c = op->c;
+ EBUG... |
c294ea50da4b1a0ee84253f46391aa87a6efe91c | Analyze and fix the following issue in the Linux kernel code: bcachefs: six locks: Fix missing barrier on wait->lock_acquired | Problem Details:
Six locks do lock handoff via the wakeup path: the thread doing the
wakeup also takes the lock on behalf of the waiter, which means the
waiter only has to look at its waitlist entry, and doesn't have to touch
the lock cacheline while another thread is using it.
Linus noticed that this needs a real bar... | ```diff
diff --git a/fs/bcachefs/six.c b/fs/bcachefs/six.c
index 7ce45aeaee8d..0473aa4dd18a 100644
--- a/fs/bcachefs/six.c
+++ b/fs/bcachefs/six.c
@@ -221,14 +221,16 @@ again:
if (ret <= 0)
goto unlock;
- __list_del(w->list.prev, w->list.next);
task = w->task;
+ __list_del(w->list.prev, w->list.next);
... |
e0a2b00a42e347a1be596fd9d1c071f0cd8c3f1f | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix check_version_upgrade() | Problem Details:
We were failing to upgrade to the latest compatible version - whoops.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/recovery.c b/fs/bcachefs/recovery.c
index bd4a99c0d21f..33a68a335be6 100644
--- a/fs/bcachefs/recovery.c
+++ b/fs/bcachefs/recovery.c
@@ -507,7 +507,7 @@ static struct recovery_pass_fn recovery_pass_fns[] = {
static void check_version_upgrade(struct bch_fs *c)
{
- unsigned latest_co... |
83b3d9598a650d28071dbda0b97c7a9a6abd6e4a | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix 'journal not marked as containing replicas' | Problem Details:
This fixes the replicas_write_errors test: the patch
bcachefs: mark journal replicas before journal write submission
partially fixed replicas marking for the journal, but it broke the case
where one replica failed - this patch re-adds marking after the journal
write completes, when we know how many ... | ```diff
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 378b3f9170d4..50a7c3330807 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -1305,18 +1305,14 @@ int bch2_journal_read(struct bch_fs *c,
bch2_replicas_entry_sort(&replicas.e);
- /*
- * If we're mounting in de... |
1e81f89b020758fb424f8bb0f13405706d29dfc7 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix assorted checkpatch nits | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/alloc_types.h b/fs/bcachefs/alloc_types.h
index 804a843f23c1..b91b7a461056 100644
--- a/fs/bcachefs/alloc_types.h
+++ b/fs/bcachefs/alloc_types.h
@@ -105,7 +105,7 @@ struct write_point {
struct dev_stripe_state stripe;
u64 sectors_allocated;
- } __attribute__((__aligned__(SMP_... |
6fe893eade864665c0956a2ac2eff78b86dc8145 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix for sb buffer being misaligned | Problem Details:
On old kernels, kmalloc() may return an allocation that's not naturally
aligned - this resulted in a bug where we allocated a bio with not
enough biovecs. Fix this by using buf_pages().
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/super-io.c b/fs/bcachefs/super-io.c
index beb00f799fe4..a58b9750b6ce 100644
--- a/fs/bcachefs/super-io.c
+++ b/fs/bcachefs/super-io.c
@@ -203,8 +203,14 @@ int bch2_sb_realloc(struct bch_sb_handle *sb, unsigned u64s)
if (dynamic_fault("bcachefs:add:super_realloc"))
return -BCH_ERR_E... |
c4e382e234778197c95c5553024e0b3f93103382 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Convert journal validation to bkey_invalid_flags | Problem Details:
This fixes a bug where we were already passing bkey_invalid_flags
around, but treating the parameter as just read/write - so the compat
code wasn't being run correctly.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/journal_io.c b/fs/bcachefs/journal_io.c
index 86ca2c2d9f72..798d4c8c7200 100644
--- a/fs/bcachefs/journal_io.c
+++ b/fs/bcachefs/journal_io.c
@@ -242,7 +242,7 @@ static void journal_entry_err_msg(struct printbuf *out,
journal_entry_err_msg(&buf, version, jset, entry); \
prt_printf(... |
e08e63e44e65761e6eb53fcd568d194f607daa61 | Analyze and fix the following issue in the Linux kernel code: bcachefs: BCH_COMPAT_bformat_overflow_done no longer required | Problem Details:
Awhile back, we changed bkey_format generation to ensure that the packed
representation could never represent fields larger than the unpacked
representation.
This was to ensure that bkey_packed_successor() always gave a sensible
result, but in the current code bkey_packed_successor() is only used in
a... | ```diff
diff --git a/fs/bcachefs/bkey.c b/fs/bcachefs/bkey.c
index 67f205992629..d6960e259c80 100644
--- a/fs/bcachefs/bkey.c
+++ b/fs/bcachefs/bkey.c
@@ -424,6 +424,24 @@ static bool bkey_packed_successor(struct bkey_packed *out,
return false;
}
+
+static bool bkey_format_has_too_big_fields(const struct bkey_form... |
58705da67aedc3f68db322d2529ff52a5cdec0fa | Analyze and fix the following issue in the Linux kernel code: bcachefs: kill EBUG_ON() redefinition in bkey.c | Problem Details:
our debug mode assertions in bkey.c haven't been getting run, whoops
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bkey.c b/fs/bcachefs/bkey.c
index 34a8fe48581c..67f205992629 100644
--- a/fs/bcachefs/bkey.c
+++ b/fs/bcachefs/bkey.c
@@ -7,14 +7,6 @@
#include "bset.h"
#include "util.h"
-#undef EBUG_ON
-
-#ifdef DEBUG_BKEYS
-#define EBUG_ON(cond) BUG_ON(cond)
-#else
-#define EBUG_ON(cond)
-#endif... |
4198bf03bed27aa758de36595416beb604600912 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix lock thrashing in __bchfs_fallocate() | Problem Details:
We've observed significant lock thrashing on fstests generic/083 in
fallocate, due to dropping and retaking btree locks when checking the
pagecache for data.
This adds a nonblocking mode to bch2_clamp_data_hole(), where we only
use folio_trylock(), and can thus be used safely while btree locks are
hel... | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index c461b65ab57a..917ad1c8f46d 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -35,7 +35,7 @@
#include <trace/events/writeback.h>
-static void bch2_clamp_data_hole(struct inode *, u64 *, u64 *, unsigned);
+static int bch2_clamp_data_hol... |
f6e6f42bbbe5e421b57182bb0c92a237701ca889 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix for bch2_copygc() spuriously returning -EEXIST | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/movinggc.c b/fs/bcachefs/movinggc.c
index 5242f20bb680..256431a6dc0c 100644
--- a/fs/bcachefs/movinggc.c
+++ b/fs/bcachefs/movinggc.c
@@ -220,8 +220,10 @@ static int bch2_copygc(struct btree_trans *trans,
f = move_bucket_in_flight_add(buckets_in_flight, *i);
ret = PTR_ERR_OR_ZER... |
73adfcaf54c8fae86d80da9acad828ee2001cd60 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix btree_err() macro | Problem Details:
Error code wasn't being propagated correctly, change it to match
fsck_err()
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/btree_io.c b/fs/bcachefs/btree_io.c
index 224ed5216b0a..80bd84f90dbf 100644
--- a/fs/bcachefs/btree_io.c
+++ b/fs/bcachefs/btree_io.c
@@ -630,8 +630,11 @@ fsck_err:
({ \
int _ret = __btree_err(type, c, ca, b, i, write, have_retry, msg, ##__VA_ARGS__);\
\
- if (_ret ... |
0ed4ca146efda60057782ccda6dc056bf538cc75 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Ensure topology repair runs | Problem Details:
This fixes should_restart_for_topology_repair() - previously it was
returning false if the btree io path had already seleceted topology
repair to run, even if it hadn't run yet.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/bcachefs.h b/fs/bcachefs/bcachefs.h
index 019d534b7325..3b39597a677a 100644
--- a/fs/bcachefs/bcachefs.h
+++ b/fs/bcachefs/bcachefs.h
@@ -995,6 +995,7 @@ struct bch_fs {
enum bch_recovery_pass curr_recovery_pass;
/* bitmap of explicitly enabled recovery passes: */
u64 recovery_p... |
77212d3a76a4becabeac8736b686a533dd75913b | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix shift by 64 in set_inc_field() | Problem Details:
UBSAN was complaining about a shift by 64 in set_inc_field().
This only happened when the value being shifted was 0, so in theory
should be harmless - a shift by 64 (or register width) should logically
give a result of 0, but CPUs will in practice leave the input unchanged
when the number of bits to s... | ```diff
diff --git a/fs/bcachefs/bkey.c b/fs/bcachefs/bkey.c
index b7b77f459724..34a8fe48581c 100644
--- a/fs/bcachefs/bkey.c
+++ b/fs/bcachefs/bkey.c
@@ -184,6 +184,28 @@ static u64 get_inc_field(struct unpack_state *state, unsigned field)
return v + offset;
}
+__always_inline
+static void __set_inc_field(struct ... |
0a6d694584aeb739b976bf69646fa3c23ee117c3 | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix folio leak in folio_hole_offset() | Problem Details:
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index 0661dfd9a8d0..c461b65ab57a 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -3830,6 +3830,7 @@ static bool folio_hole_offset(struct address_space *mapping, loff_t *offset,
ret = false;
unlock:
folio_unlock(folio);
+ folio_put(folio);... |
e2bd06178c458d0178265f75d7210e6c090bbfdb | Analyze and fix the following issue in the Linux kernel code: bcachefs: Fix overlapping extent repair | Problem Details:
A number of smallish fixes for overlapping extent repair, and (part of)
a new unit test. This fixes all the issues turned up by bhzhu203, in his
filesystem image from running mongodb + snapshots.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> | ```diff
diff --git a/fs/bcachefs/fsck.c b/fs/bcachefs/fsck.c
index 31eb9176eb39..28dc8b4e3ed7 100644
--- a/fs/bcachefs/fsck.c
+++ b/fs/bcachefs/fsck.c
@@ -408,6 +408,28 @@ static inline void snapshots_seen_init(struct snapshots_seen *s)
memset(s, 0, sizeof(*s));
}
+static int snapshots_seen_add_inorder(struct bch_... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.