Re: [PATCH] btrfs: Annotate structs with __counted_by()

2024-08-14 Thread David Sterba
On Wed, Aug 14, 2024 at 09:01:42PM +0200, Thorsten Blum wrote: > On 14. Aug 2024, at 20:02, Nathan Chancellor wrote: > > On Mon, Aug 12, 2024 at 02:03:44PM +0200, Thorsten Blum wrote: > >> On 12. Aug 2024, at 12:54, Johannes Thumshirn > >> wrote: > >>> On 12.08.24 12:37, Thorsten Blum wrote: > >

Re: [PATCH] btrfs: Annotate struct name_cache_entry with __counted_by()

2024-08-13 Thread David Sterba
On Tue, Aug 13, 2024 at 12:53:15PM +0200, Thorsten Blum wrote: > Add the __counted_by compiler attribute to the flexible array member > name to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and > CONFIG_FORTIFY_SOURCE. > > Signed-off-by: Thorsten Blum Thanks, Reviewed-by: David Sterba

Re: [PATCH] btrfs: Annotate structs with __counted_by()

2024-08-12 Thread David Sterba
On Mon, Aug 12, 2024 at 12:36:20PM +0200, Thorsten Blum wrote: > Add the __counted_by compiler attribute to the flexible array member > stripes to improve access bounds-checking via CONFIG_UBSAN_BOUNDS and > CONFIG_FORTIFY_SOURCE. > > Signed-off-by: Thorsten Blum Reviewed-by: David Sterba

Re: [PATCH 1/4] module: Add module_subinit{_noexit} and module_subeixt helper macros

2024-07-26 Thread David Sterba
On Fri, Jul 26, 2024 at 11:09:02AM -0700, Christoph Hellwig wrote: > On Fri, Jul 26, 2024 at 01:58:00PM -0400, Theodore Ts'o wrote: > > Yeah, that's my reaction as well. This only saves 50 lines of code in > > ext4, and that includes unrelated changes such as getting rid of "int > > i" and putting

Re: [PATCH 1/4] module: Add module_subinit{_noexit} and module_subeixt helper macros

2024-07-26 Thread David Sterba
On Fri, Jul 26, 2024 at 07:04:35AM -0700, Christoph Hellwig wrote: > On Fri, Jul 26, 2024 at 04:54:59PM +0800, Youling Tang wrote: > > Based on this patch, we may need to do these things with this > > > > > > 1. Change the order of *.o in the Makefile (the same order as before the > > change) > >

Re: [PATCH v2 09/11] btrfs: convert to multigrain timestamps

2024-07-01 Thread David Sterba
On Mon, Jul 01, 2024 at 09:57:43AM -0400, Jeff Layton wrote: > On Mon, 2024-07-01 at 09:49 -0400, Josef Bacik wrote: > > On Mon, Jul 01, 2024 at 06:26:45AM -0400, Jeff Layton wrote: > > > Enable multigrain timestamps, which should ensure that there is an > > > apparent change to the timestamp whene

Re: [PATCH 44/82] btrfs: Refactor intentional wrap-around test

2024-01-23 Thread David Sterba
tps://github.com/KSPP/linux/issues/344 [4] > Cc: Chris Mason > Cc: Josef Bacik > Cc: David Sterba > Cc: linux-btrfs@vger.kernel.org > Signed-off-by: Kees Cook Acked-by: David Sterba

Re: [PATCH 13/82] btrfs: Refactor intentional wrap-around calculation

2024-01-22 Thread David Sterba
ithub.com/KSPP/linux/issues/26 [2] > Link: https://github.com/KSPP/linux/issues/27 [3] > Link: https://github.com/KSPP/linux/issues/344 [4] > Cc: Chris Mason > Cc: Josef Bacik > Cc: David Sterba > Cc: linux-btrfs@vger.kernel.org > Signed-off-by: Kees Cook Acked-by: David Sterba

Re: [PATCH][next] btrfs: Add __counted_by for struct btrfs_delayed_item and use struct_size()

2023-10-09 Thread David Sterba
On Mon, Oct 09, 2023 at 02:44:54PM -0600, Gustavo A. R. Silva wrote: > Prepare for the coming implementation by GCC and Clang of the __counted_by > attribute. Flexible array members annotated with __counted_by can have > their accesses bounds-checked at run-time via CONFIG_UBSAN_BOUNDS (for > array

Re: [PATCH v5 1/3] btrfs: zoned: reset zones of relocated block groups

2021-04-20 Thread David Sterba
On Tue, Apr 20, 2021 at 07:40:37AM +, Johannes Thumshirn wrote: > On 19/04/2021 19:13, David Sterba wrote: > > On Mon, Apr 19, 2021 at 04:41:00PM +0900, Johannes Thumshirn wrote: > >> When relocating a block group the freed up space is not discarded in one > >> bi

Re: [PATCH v2] btrfs: do more graceful error/warning for 32bit kernel

2021-04-20 Thread David Sterba
On Fri, Apr 09, 2021 at 01:24:20PM +0800, Qu Wenruo wrote: > Due to the pagecache limit of 32bit systems, btrfs can't access metadata > at or beyond (ULONG_MAX + 1) << PAGE_SHIFT. > This is 16T for 4K page size while 256T for 64K page size. > > And unlike other fses, btrfs uses internally mapped u

Re: [PATCH v2] btrfs: zoned: fix unpaired block group unfreeze during device replace

2021-04-20 Thread David Sterba
On Wed, Apr 14, 2021 at 02:05:26PM +0100, fdman...@kernel.org wrote: > From: Filipe Manana > > When doing a device replace on a zoned filesystem, if we find a block > group with ->to_copy == 0, we jump to the label 'done', which will result > in later calling btrfs_unfreeze_block_group(), even th

Re: [PATCH] btrfs: fix race when picking most recent mod log operation for an old root

2021-04-20 Thread David Sterba
On Tue, Apr 20, 2021 at 10:55:44AM +0100, fdman...@kernel.org wrote: > From: Filipe Manana > > Commit dbcc7d57bffc0c ("btrfs: fix race when cloning extent buffer during > rewind of an old root"), fixed a race when we need to rewind the extent > buffer of an old root. It was caused by picking a ne

Re: [PATCH] btrfs: fix metadata extent leak after failure to create subvolume

2021-04-20 Thread David Sterba
On Tue, Apr 20, 2021 at 10:55:12AM +0100, fdman...@kernel.org wrote: > From: Filipe Manana > > When creating a subvolume we allocate an extent buffer for its root node > after starting a transaction. We setup a root item for the subvolume that > points to that extent buffer and then attempt to in

Re: [PATCH v2 0/2] btrfs: remove the inode_need_compress() call in

2021-04-19 Thread David Sterba
On Tue, Aug 04, 2020 at 03:25:46PM +0800, Qu Wenruo wrote: > This is an attempt to remove the inode_need_compress() call in > compress_file_extent(). > > As that compress_file_extent() can race with inode ioctl or bad > compression ratio, to cause NULL pointer dereferecen for @pages, it's > nature

Re: [PATCH v2] fs/btrfs: Fix uninitialized variable

2021-04-19 Thread David Sterba
ROMDHANI > --- > v2: add a default case as proposed by David Sterba > --- > fs/btrfs/zoned.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/fs/btrfs/zoned.c b/fs/btrfs/zoned.c > index eeb3ebe11d7a..82527308d165 100644 > --- a/fs/btrfs/zoned.c > +++

Re: [PATCH v2] btrfs-progs: fi resize: fix false 0.00B sized output

2021-04-19 Thread David Sterba
On Mon, Apr 19, 2021 at 10:08:50AM -0700, Boris Burkov wrote: > On Mon, Apr 19, 2021 at 09:05:49PM +0800, Su Yue wrote: > > @@ -1158,6 +1158,16 @@ static int check_resize_args(const char *amount, > > const char *path) { > > } > > old_size = di_args[dev_idx].total_bytes; > >

Re: [PATCH v5 3/3] btrfs: zoned: automatically reclaim zones

2021-04-19 Thread David Sterba
On Mon, Apr 19, 2021 at 04:41:02PM +0900, Johannes Thumshirn wrote: > --- a/fs/btrfs/zoned.h > +++ b/fs/btrfs/zoned.h > @@ -9,6 +9,8 @@ > #include "disk-io.h" > #include "block-group.h" > > +#define DEFAULT_RECLAIM_THRESH 75 This is not a .c local define so it needs a prefix and a comment what

Re: [PATCH v5 3/3] btrfs: zoned: automatically reclaim zones

2021-04-19 Thread David Sterba
On Mon, Apr 19, 2021 at 04:41:02PM +0900, Johannes Thumshirn wrote: > +void btrfs_reclaim_bgs_work(struct work_struct *work) > +{ > + struct btrfs_fs_info *fs_info = > + container_of(work, struct btrfs_fs_info, reclaim_bgs_work); > + struct btrfs_block_group *bg; > + struct

Re: [PATCH v5 1/3] btrfs: zoned: reset zones of relocated block groups

2021-04-19 Thread David Sterba
On Mon, Apr 19, 2021 at 04:41:00PM +0900, Johannes Thumshirn wrote: > When relocating a block group the freed up space is not discarded in one > big block, but each extent is discarded on it's own with -odisard=sync. > > For a zoned filesystem we need to discard the whole block group at once, > so

Re: [PATCH v2] btrfs-progs: fi resize: fix false 0.00B sized output

2021-04-19 Thread David Sterba
On Mon, Apr 19, 2021 at 09:05:49PM +0800, Su Yue wrote: > Resize to nums without sign prefix makes false output: > btrfs fi resize 1:150g /srv/extra > Resize device id 1 (/dev/sdb1) from 298.09GiB to 0.00B > > The resize operation would take effect though. > > Fix it by handling the case if mod

Re: [PATCH 3/4] btrfs: zoned: fail mount if the device does not support zone append

2021-04-19 Thread David Sterba
On Mon, Apr 19, 2021 at 09:46:36AM +, Damien Le Moal wrote: > On 2021/04/19 18:41, h...@infradead.org wrote: > > On Mon, Apr 19, 2021 at 09:35:37AM +, Damien Le Moal wrote: > >> This is only to avoid someone from running zoned-btrfs on top of dm-crypt. > >> Without this patch, mount will be

Re: [PATCH] btrfs-progs: mkfs: only output the warning if the sectorsize is not supported

2021-04-16 Thread David Sterba
On Fri, Apr 16, 2021 at 11:14:08AM -0700, Boris Burkov wrote: > On Thu, Apr 15, 2021 at 01:30:11PM +0800, Qu Wenruo wrote: > > +/* > > + * The buffer size if strlen("4096 8192 16384 32768 65536"), > > + * which is 28, then round up to 32. > > I think there is a typo in this comment, because it doe

Re: [PATCH 0/1] btrfs-progs: libbtrfsutil: Relicense to LGPLv2.1+

2021-04-16 Thread David Sterba
On Tue, Mar 30, 2021 at 09:21:40AM -0400, Neal Gompa wrote: > On Tue, Mar 23, 2021 at 11:53 AM David Sterba wrote: > > > > On Wed, Mar 17, 2021 at 04:01:43PM -0400, Neal Gompa wrote: > > > This is a patch requesting all substantial copyright owners to sign off > > &g

Re: [PATCH] btrfs-progs: Fix null pointer deref in balance_level

2021-04-16 Thread David Sterba
On Tue, Apr 06, 2021 at 04:55:03PM +0300, Nikolay Borisov wrote: > In case the right buffer is emptied it's first set to null and > subsequently it's dereferenced to get its size to pass to root_sub_used. > This naturally leads to a null pointer dereference. The correct thing > to do is to pass the

Re: [PATCH] btrfs-progs: mkfs: only output the warning if the sectorsize is not supported

2021-04-16 Thread David Sterba
On Thu, Apr 15, 2021 at 01:30:11PM +0800, Qu Wenruo wrote: > Currently mkfs.btrfs will output a warning message if the sectorsize is > not the same as page size: > WARNING: the filesystem may not be mountable, sectorsize 4096 doesn't match > page size 65536 > > But since btrfs subpage support f

Re: [PATCH 3/3] btrfs-progs: misc-tests: add test to ensure the restored image can be mounted

2021-04-16 Thread David Sterba
On Fri, Mar 26, 2021 at 08:50:47PM +0800, Qu Wenruo wrote: > This new test case is to make sure the restored image file has been > properly enlarged so that newer kernel won't complain. > > Signed-off-by: Qu Wenruo > --- > .../047-image-restore-mount/test.sh | 19 +++ >

Re: [PATCH 2/3] btrfs-progs: image: enlarge the output file if no tree modification is needed for restore

2021-04-16 Thread David Sterba
On Fri, Mar 26, 2021 at 08:50:46PM +0800, Qu Wenruo wrote: > [BUG] > If restoring dumpped image into a new file, under most cases kernel will > reject it: > > # mkfs.btrfs -f /dev/test/test > # btrfs-image /dev/test/test /tmp/dump > # btrfs-image -r /tmp/dump ~/test.img > # mount ~/test.img /m

Re: [PATCH] btrfs-progs: mark BUG() as unreachable

2021-04-16 Thread David Sterba
On Thu, Apr 01, 2021 at 05:41:00PM +0900, Naohiro Aota wrote: > Marking BUG() unreachable helps us silence unnecessary warnings e.g. > "warning: control reaches end of non-void function [-Wreturn-type]" like > the code below. > >int foo() >{ >... > if (XXX) > return

Re: [PATCH-next] fs/btrfs: Fix uninitialized variable

2021-04-16 Thread David Sterba
On Tue, Apr 13, 2021 at 02:06:04PM +0100, Khaled ROMDHANI wrote: > The variable zone is not initialized. It > may causes a failed assertion. Failed assertion means the 2nd one checking that the result still fits to 32bit type. That would mean that none of the cases were hit, but all callers pass v

Re: [PATCH v4 3/3] btrfs: zoned: automatically reclaim zones

2021-04-16 Thread David Sterba
On Thu, Apr 15, 2021 at 10:58:35PM +0900, Johannes Thumshirn wrote: > @@ -2974,6 +2982,9 @@ void btrfs_init_fs_info(struct btrfs_fs_info *fs_info) > fs_info->swapfile_pins = RB_ROOT; > > fs_info->send_in_progress = 0; > + > + fs_info->bg_reclaim_threshold = 75; The value should b

Re: [PATCH v4 3/3] btrfs: zoned: automatically reclaim zones

2021-04-16 Thread David Sterba
On Thu, Apr 15, 2021 at 10:58:35PM +0900, Johannes Thumshirn wrote: > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -954,10 +954,14 @@ struct btrfs_fs_info { > struct work_struct async_data_reclaim_work; > struct work_struct preempt_reclaim_work; > > + /* Used to reclaim da

Re: [PATCH v4 2/3] btrfs: rename delete_unused_bgs_mutex

2021-04-16 Thread David Sterba
On Thu, Apr 15, 2021 at 10:58:34PM +0900, Johannes Thumshirn wrote: > --- a/fs/btrfs/ctree.h > +++ b/fs/btrfs/ctree.h > @@ -957,7 +957,7 @@ struct btrfs_fs_info { > spinlock_t unused_bgs_lock; > struct list_head unused_bgs; > struct mutex unused_bg_unpin_mutex; > - struct mute

Re: [PATCH 3/4] btrfs: zoned: fail mount if the device does not support zone append

2021-04-16 Thread David Sterba
On Fri, Apr 16, 2021 at 12:05:27PM +0900, Damien Le Moal wrote: > From: Johannes Thumshirn > > For zoned btrfs, zone append is mandatory to write to a sequential write > only zone, otherwise parallel writes to the same zone could result in > unaligned write errors. > > If a zoned block device do

Re: [PATCH v2 3/3] blkid: support zone reset for wipefs

2021-04-16 Thread David Sterba
On Wed, Apr 14, 2021 at 03:57:42PM +0200, Karel Zak wrote: > On Wed, Apr 14, 2021 at 10:33:39AM +0900, Naohiro Aota wrote: > > /** > > * blkid_do_wipe: > > * @pr: prober > > @@ -1267,6 +1310,7 @@ int blkid_do_wipe(blkid_probe pr, int dryrun) > > const char *off = NULL; > > size_t len =

Re: [PATCH v2 2/3] blkid: add magic and probing for zoned btrfs

2021-04-16 Thread David Sterba
On Wed, Apr 14, 2021 at 10:33:38AM +0900, Naohiro Aota wrote: > It also supports temporary magic ("!BHRfS_M") in zone #0. The mkfs.btrfs > first writes the temporary superblock to the zone during the mkfs process. > It will survive there until the zones are filled up and reset. So, we also > need t

Re: Dead fs on 2 Fedora systems: block=57084067840 write time tree block corruption detected

2021-04-16 Thread David Sterba
On Thu, Apr 15, 2021 at 11:06:32AM -0600, Chris Murphy wrote: > First computer/file system: > > (from the photo): > > [ 136.259984] BTRFS critical (device nvme0n1p8): corrupt leaf: root=257 > block=31259951104 slot=9 ino=3244515, name hash mismatch with key, have > 0xF22F547D expect 0x0

Re: [PATCH] btrfs: fix race between transaction aborts and fsyncs leading to use-after-free

2021-04-14 Thread David Sterba
On Mon, Apr 05, 2021 at 12:32:16PM +0100, fdman...@kernel.org wrote: > From: Filipe Manana > > There is a race between a task aborting a transaction during a commit, > a task doing an fsync and the transaction kthread, which leads to an > use-after-free of the log root tree. When this happens, it

[GIT PULL] Btrfs fix for 5.12-rc7

2021-04-11 Thread David Sterba
From: David Sterba Hi, here's one more patch that we'd like to get to 5.12 before release, it's changing where and how the superblock is stored in the zoned mode. It is an on-disk format change but so far there are no implications for users as the proper mkfs support hasn'

[PATCH v3] btrfs: zoned: move superblock logging zone location

2021-04-10 Thread David Sterba
containing the fixed location offsets used to store superblocks on a non-zoned volume are also reserved to avoid confusion. Signed-off-by: Naohiro Aota Signed-off-by: David Sterba --- For context see replies under https://lore.kernel.org/linux-btrfs

Re: [PATCH v2] btrfs: zoned: move superblock logging zone location

2021-04-10 Thread David Sterba
On Fri, Apr 09, 2021 at 01:07:19PM +0200, David Sterba wrote: > On Thu, Apr 08, 2021 at 05:25:28PM +0900, Naohiro Aota wrote: > > This commit moves the location of the superblock logging zones. The new > > locations of the logging zones are now determined based on fixed block > &

Re: [PATCH v7 03/38] btrfs: handle errors from select_reloc_root()

2021-04-09 Thread David Sterba
On Thu, Mar 11, 2021 at 01:10:03PM -0500, Josef Bacik wrote: > On 2/26/21 1:30 PM, David Sterba wrote: > > On Wed, Dec 16, 2020 at 11:26:19AM -0500, Josef Bacik wrote: > >> Currently select_reloc_root() doesn't return an error, but followup > >> patches will make

Re: [PATCH v8 00/39] Cleanup error handling in relocation

2021-04-09 Thread David Sterba
On Fri, Mar 12, 2021 at 03:24:55PM -0500, Josef Bacik wrote: > v7->v8: > - Reordered some of the patches, so that the callers of functions that added > new > error cases were fixed first, and then added the new error handler. > - Moved a few of the ASSERT(0) to where they made sense. Left the o

Re: [PATCH v2] btrfs: zoned: move superblock logging zone location

2021-04-09 Thread David Sterba
On Thu, Apr 08, 2021 at 05:25:28PM +0900, Naohiro Aota wrote: > This commit moves the location of the superblock logging zones. The new > locations of the logging zones are now determined based on fixed block > addresses instead of on fixed zone numbers. > > The old placement method based on fixed

Re: [PATCH v2] btrfs: zoned: move superblock logging zone location

2021-04-09 Thread David Sterba
On Thu, Apr 08, 2021 at 10:57:32AM -0400, Josef Bacik wrote: > On 4/8/21 4:25 AM, Naohiro Aota wrote: > > confusion. > > > > Signed-off-by: Naohiro Aota > > Thanks Naohiro, this makes it much easier to understand, > > Reviewed-by: Josef Bacik > > Dave, I know you're on vacation, this needs to

Re: [PATCH] btrfs: Use readahead_batch_length

2021-04-06 Thread David Sterba
On Sun, Mar 21, 2021 at 09:03:11PM +, Matthew Wilcox (Oracle) wrote: > Implement readahead_batch_length() to determine the number of bytes in > the current batch of readahead pages and use it in btrfs. > > Signed-off-by: Matthew Wilcox (Oracle) Thanks, I'll take it through my tree as btrfs i

Re: [PATCH] fs: btrfs: Remove repeated struct declaration

2021-04-06 Thread David Sterba
On Thu, Apr 01, 2021 at 04:03:39PM +0800, Wan Jiabing wrote: > struct btrfs_inode is declared twice. One is declared at 67th line. > The blew declaration is not needed. Remove the duplicate. > struct btrfs_fs_info should be declared in the forward declarations. > Move it to the forward declarations

Re: [PATCH v3 00/13] btrfs: support read-write for subpage metadata

2021-04-06 Thread David Sterba
On Tue, Apr 06, 2021 at 10:31:58AM +0800, Anand Jain wrote: > On 05/04/2021 14:14, Qu Wenruo wrote: > > > > > > On 2021/4/3 下午7:08, David Sterba wrote: > >> On Thu, Mar 25, 2021 at 03:14:32PM +0800, Qu Wenruo wrote: > >>> This patchset can be fetched

Re: [PATCH v3 00/13] btrfs: support read-write for subpage metadata

2021-04-06 Thread David Sterba
On Mon, Apr 05, 2021 at 02:14:34PM +0800, Qu Wenruo wrote: > > > On 2021/4/3 下午7:08, David Sterba wrote: > > On Thu, Mar 25, 2021 at 03:14:32PM +0800, Qu Wenruo wrote: > >> This patchset can be fetched from the following github repo, along with > >> the fu

Re: [PATCH v8 28/39] btrfs: handle btrfs_search_slot failure in replace_path

2021-04-06 Thread David Sterba
On Fri, Mar 12, 2021 at 03:25:23PM -0500, Josef Bacik wrote: > This can fail for any number of reasons, why bring the whole box down > with it? I've written something more relevant for the code change. > Reviewed-by: Qu Wenruo > Signed-off-by: Josef Bacik > --- > fs/btrfs/relocation.c | 3 ++-

Re: [PATCH v2] btrfs: fix lockdep warning while mounting sprout fs

2021-04-06 Thread David Sterba
On Mon, Apr 05, 2021 at 05:18:32PM +0800, Su Yue wrote: > > On Mon 05 Apr 2021 at 16:38, Anand Jain > wrote: > > > Ping again. > > > It's already queued in misc-next. > commit 441737bb30f83914bb8517f52088c0130138d74b (misc-next) > Author: Anand Jain > Date: Fri Jul 17 18:05:25 2020 +0800 N

Re: [PATCH -next] btrfs: integrity-checker: use DEFINE_MUTEX() for mutex lock

2021-04-06 Thread David Sterba
On Mon, Apr 05, 2021 at 06:14:46PM +0800, Zheng Yongjun wrote: > mutex lock can be initialized automatically with DEFINE_MUTEX() > rather than explicitly calling mutex_init(). > > Reported-by: Hulk Robot > Signed-off-by: Zheng Yongjun You've sent this patch already and haven't provided the answ

Re: [PATCH v3 00/13] btrfs: support read-write for subpage metadata

2021-04-03 Thread David Sterba
On Thu, Mar 25, 2021 at 03:14:32PM +0800, Qu Wenruo wrote: > This patchset can be fetched from the following github repo, along with > the full subpage RW support: > https://github.com/adam900710/linux/tree/subpage > > This patchset is for metadata read write support. > Qu Wenruo (13): > btrfs:

Re: [PATCH v3 05/13] btrfs: introduce helpers for subpage dirty status

2021-04-01 Thread David Sterba
On Thu, Mar 25, 2021 at 03:14:37PM +0800, Qu Wenruo wrote: > --- a/fs/btrfs/subpage.h > +++ b/fs/btrfs/subpage.h > @@ -20,6 +20,7 @@ struct btrfs_subpage { > spinlock_t lock; > u16 uptodate_bitmap; > u16 error_bitmap; > + u16 dirty_bitmap; > union { > /* >

Re: [PATCH] btrfs: make reflinks respect O_SYNC O_DSYNC and S_SYNC flags

2021-04-01 Thread David Sterba
On Wed, Mar 31, 2021 at 11:07:26AM +, Filipe Manana wrote: > On Mon, Mar 29, 2021 at 7:49 PM David Sterba wrote: > > > > On Tue, Mar 23, 2021 at 06:39:49PM +, fdman...@kernel.org wrote: > > > From: Filipe Manana > > > > > > If we reflink to or fr

Re: [PATCH v3 00/13] btrfs: support read-write for subpage metadata

2021-04-01 Thread David Sterba
On Thu, Apr 01, 2021 at 01:36:56PM +0800, Qu Wenruo wrote: > > > On 2021/3/30 上午2:53, David Sterba wrote: > > On Thu, Mar 25, 2021 at 03:14:32PM +0800, Qu Wenruo wrote: > >> v3: > >> - Rename the sysfs to supported_sectorsizes > >> > >> - Rebase

Re: [PATCH v3 01/13] btrfs: add sysfs interface for supported sectorsize

2021-04-01 Thread David Sterba
On Thu, Mar 25, 2021 at 03:14:33PM +0800, Qu Wenruo wrote: > Add extra sysfs interface features/supported_ro_sectorsize and > features/supported_rw_sectorsize to indicate subpage support. > > Currently for supported_rw_sectorsize all architectures only have their > PAGE_SIZE listed. > > While for

Re: [PATCH] btrfs: Remove useless call "zlib_inflateEnd"

2021-04-01 Thread David Sterba
On Tue, Mar 30, 2021 at 06:17:01PM +0800, Jiapeng Chong wrote: > Fix the following whitescan warning: > > Calling "zlib_inflateEnd(&workspace->strm)" is only useful for its > return value, which is ignored. According to the zlib API documentation in include/linux/zlib.h 301 extern int zlib_defla

Re: [PATCH] btrfs: fix exhaustion of the system chunk array due to concurrent allocations

2021-04-01 Thread David Sterba
On Wed, Mar 31, 2021 at 11:55:50AM +0100, fdman...@kernel.org wrote: > From: Filipe Manana > > When we are running out of space for updating the chunk tree, that is, > when we are low on available space in the system space info, if we have > many task concurrently allocating block groups, via fal

Re: [PATCH] btrfs: improve btree readahead for full send operations

2021-04-01 Thread David Sterba
On Wed, Mar 31, 2021 at 11:56:21AM +0100, fdman...@kernel.org wrote: > From: Filipe Manana > > Currently a full send operation uses the standard btree readahead when > iterating over the subvolume/snapshot btree, which despite bringing good > performance benefits, it could be improved in a few as

Re: [PATCH v3 00/13] btrfs: support read-write for subpage metadata

2021-03-29 Thread David Sterba
On Thu, Mar 25, 2021 at 03:14:32PM +0800, Qu Wenruo wrote: > v3: > - Rename the sysfs to supported_sectorsizes > > - Rebased to latest misc-next branch > This removes 2 cleanup patches. > > - Add new overview comment for subpage metadata V3 is now in for-next, targeting merge for 5.13. Please

Re: [PATCH] btrfs: make reflinks respect O_SYNC O_DSYNC and S_SYNC flags

2021-03-29 Thread David Sterba
On Tue, Mar 23, 2021 at 06:39:49PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > If we reflink to or from a file opened with O_SYNC/O_DSYNC or to/from a > file that has the S_SYNC attribute set, we totally ignore that and do not > durably persist the reflink changes. Since a reflink

Re: [PATCH] [v2] btrfs: zoned: bail out in btrfs_alloc_chunk for bad input

2021-03-29 Thread David Sterba
gt; data corruption, and the compile-time warning. > > Fixes: 1cd6121f2a38 ("btrfs: zoned: implement zoned chunk allocator") > Link: https://lore.kernel.org/lkml/20210323132343.gf7...@twin.jikos.cz/ > Suggested-by: David Sterba > Signed-off-by: Arnd Bergmann Added to misc-next, thanks.

Re: [PATCH v2] btrfs: fix a potential hole-punching failure

2021-03-29 Thread David Sterba
On Thu, Mar 25, 2021 at 09:56:22AM +0800, bingjingc wrote: > From: BingJing Chang > > In commit d77815461f04 ("btrfs: Avoid trucating page or punching hole > in a already existed hole."), existed holes can be skipped by calling > find_first_non_hole() to adjust *start and *len. However, if the gi

Re: [PATCH] btrfs: zoned: move log tree node allocation out of log_root_tree->log_mutex

2021-03-29 Thread David Sterba
On Wed, Mar 24, 2021 at 11:23:11PM +0900, Naohiro Aota wrote: > Commit 6e37d2459941 ("btrfs: zoned: fix deadlock on log sync") pointed out > a deadlock warning and removed > mutex_{lock,unlock}(&fs_info->tree_root->log_mutex). While it looks like it > always cause a deadlock, we didn't see actual d

Re: [PATCH] btrfs: use percpu_read_positive instead of sum_positive for need_preempt

2021-03-29 Thread David Sterba
On Wed, Mar 24, 2021 at 09:44:21AM -0400, Josef Bacik wrote: > Looking at perf data for a fio workload I noticed that we were spending > a pretty large chunk of time (around 5%) doing percpu_counter_sum() in > need_preemptive_reclaim. This is silly, as we only want to know if we > have more ordere

Re: [PATCH v3 01/13] btrfs: add sysfs interface for supported sectorsize

2021-03-29 Thread David Sterba
On Thu, Mar 25, 2021 at 10:41:43PM +0800, Anand Jain wrote: > On 25/03/2021 15:14, Qu Wenruo wrote: > > +static ssize_t supported_sectorsizes_show(struct kobject *kobj, > > + struct kobj_attribute *a, > > + char *buf) > > +{ >

Re: [PATCH] btrfs: update outdated comment at btrfs_replace_file_extents()

2021-03-29 Thread David Sterba
On Fri, Mar 26, 2021 at 01:14:41PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > There is a comment at btrfs_replace_file_extents() that mentions that we > set the full sync flag on an inode when cloning into a file with a size > greater than or equals to 16MiB, through try_release_

Re: [PATCH] btrfs: Fix a typo

2021-03-26 Thread David Sterba
On Fri, Mar 26, 2021 at 06:29:32AM +0530, Bhaskar Chowdhury wrote: > > s/reponsible/responsible/ So this is exactly what I don't want to see happen - one patch per typo. I tried to explain it in the previous patch, please either fix all typos under fs/btrfs or don't bother.

Re: [PATCH] btrfs: fixed rudimentary typos

2021-03-25 Thread David Sterba
On Thu, Mar 25, 2021 at 11:40:04PM +0530, Bhaskar Chowdhury wrote: > On 13:49 Thu 25 Mar 2021, David Sterba wrote: > >On Thu, Mar 25, 2021 at 09:51:13AM +0530, Bhaskar Chowdhury wrote: > >> > >> s/contaning/containing > >> s/clearning/clearing/ > > >

[GIT PULL] Btrfs fixes for 5.12-rc5

2021-03-25 Thread David Sterba
From: David Sterba Hi, there are few fixes for issues that have some user visibility and are simple enough for this time of development cycle. Please pull thanks. - a few fixes for rescue= mount option, adding more checks for missing trees - fix sleeping in atomic context on qgroup

Re: [PATCH] btrfs: fixed rudimentary typos

2021-03-25 Thread David Sterba
On Thu, Mar 25, 2021 at 09:51:13AM +0530, Bhaskar Chowdhury wrote: > > s/contaning/containing > s/clearning/clearing/ Have hou scanned the whole subdirectory for typos? We do typo fixing about once a year in one big patch and won't fix them one by one.

Re: [PATCH AUTOSEL 5.11 26/44] btrfs: track qgroup released data in own variable in insert_prealloc_file_extent

2021-03-25 Thread David Sterba
() call, it's super easy to > overwrite the @ret and cause tons of qgroup related bugs. > > Fix such abuse by introducing new variable @qgroup_released, so that we > won't reuse the existing variable @ret. > > Signed-off-by: Qu Wenruo > Reviewed-by: David Sterba > Sig

Btrfs progs release 5.11.1

2021-03-24 Thread David Sterba
lls: https://www.kernel.org/pub/linux/kernel/people/kdave/btrfs-progs/ Git: git://git.kernel.org/pub/scm/linux/kernel/git/kdave/btrfs-progs.git Shortlog: David Sterba (10): btrfs-progs: ci: fix symlink paths of helper scripts btrfs-progs: tests: extend mkfs/001 to look for warnings after mkfs

Re: [PATCH 0/1] btrfs-progs: build system - do not use AC_DEFINE twice

2021-03-23 Thread David Sterba
On Sat, Mar 20, 2021 at 10:27:27AM +0100, pierre.labas...@neuf.fr wrote: > Note that I doubt this check is needed in configure: > HAVE_OWN_FIEMAP_EXTENT_DEFINE is used only once in cmds/filesystem-du.c > in: > #if !defined(FIEMAP_EXTENT_SHARED) && (HAVE_OWN_FIEMAP_EXTENT_SHARED_DEFINE > == 1) > bu

Re: [PATCH 1/1] btrfs-progs: build system - do not use AC_DEFINE twice

2021-03-23 Thread David Sterba
On Sat, Mar 20, 2021 at 10:27:28AM +0100, pierre.labas...@neuf.fr wrote: > From: Pierre Labastie > > Autoheader uses the AC_DEFINE macros (and a few others) to populate > the config.h.in file. The autotools documentation does not tell > what happens if AC_DEFINE is used twice for the same identif

Re: [PATCH 0/1] btrfs-progs: libbtrfsutil: Relicense to LGPLv2.1+

2021-03-23 Thread David Sterba
On Wed, Mar 17, 2021 at 04:01:43PM -0400, Neal Gompa wrote: > This is a patch requesting all substantial copyright owners to sign off > on changing the license of the libbtrfsutil code to LGPLv2.1+ in order > to resolve various concerns around the mixture of code in btrfs-progs > with libbtrfsutil.

Re: [PATCH] btrfs-progs: qgroup: remove outdated comment

2021-03-23 Thread David Sterba
On Mon, Mar 22, 2021 at 02:03:16PM +, Sidong Yang wrote: > This comment is outdated and this patch remove > it to avoid confusion. Even if it's just a comment removal, changelog should say why it's outated, I have no idea and would have to do the research myself.

Re: [PATCH] btrfs: zoned: fix uninitialized max_chunk_size

2021-03-23 Thread David Sterba
On Tue, Mar 23, 2021 at 01:46:19PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > The ctl->max_chunk_size member might be used uninitialized > when none of the three conditions for initializing it in > init_alloc_chunk_ctl_policy_zoned() are true: > > In function ‘init_alloc_chunk_ctl_pol

Re: APFS and BTRFS

2021-03-22 Thread David Sterba
On Sat, Mar 20, 2021 at 11:22:18AM -0400, Forrest Aldrich wrote: > I have a really large (3+ TB) volume I am copying to a BTRFS volume > (both over USB) which is painfully slow.  In fact, it will probably take > days to complete.   My goal is to use BTRFS on that larger USB volume > (it's an 18T

Re: [PATCH v2] btrfs-progs: common: make sure that qgroup id is in range

2021-03-18 Thread David Sterba
On Thu, Mar 18, 2021 at 02:22:20AM +, Sidong Yang wrote: > On Wed, Mar 17, 2021 at 07:36:47PM +0100, David Sterba wrote: > > On Tue, Mar 16, 2021 at 01:27:46PM +, Sidong Yang wrote: > > > When user assign qgroup with qgroup id that is too big to exceeds > > > r

Re: [PATCH v8 04/10] btrfs: fix check_data_csum() error message for direct I/O

2021-03-18 Thread David Sterba
On Thu, Mar 18, 2021 at 07:47:29AM +0800, Qu Wenruo wrote: > > > On 2021/3/18 上午2:33, Omar Sandoval wrote: > > On Wed, Mar 17, 2021 at 07:21:46PM +0800, Qu Wenruo wrote: > >> > >> > >> On 2021/3/17 上午3:43, Omar Sandoval wrote: > >>> From: Omar Sandoval > >>> > >>> Commit 1dae796aabf6 ("btrfs: in

[GIT PULL] Btrfs fixes for 5.12-rc4

2021-03-18 Thread David Sterba
From: David Sterba Hi, there are still regressions being found and fixed in the zoned mode and subpage code, the rest are fixes for bugs reported by users. Please pull, thanks. Regressions: - subpage block support: - readahead works on the proper block size - fix last page zeroing

Re: [PATCH] btrfs: fix sleep while in non-sleep context during qgroup removal

2021-03-18 Thread David Sterba
On Thu, Mar 18, 2021 at 11:22:05AM +, fdman...@kernel.org wrote: > From: Filipe Manana > > While removing a qgroup's sysfs entry we end up taking the kernfs_mutex, > through kobject_del(), while holding the fs_info->qgroup_lock spinlock, > producing the following trace: > > [ 821.843637] BU

Re: [PATCH 0/1] btrfs-progs: libbtrfsutil: Relicense to LGPLv2.1+

2021-03-18 Thread David Sterba
On Thu, Mar 18, 2021 at 08:32:30AM +0800, Qu Wenruo wrote: > > > On 2021/3/18 上午4:01, Neal Gompa wrote: > > This is a patch requesting all substantial copyright owners to sign off > > on changing the license of the libbtrfsutil code to LGPLv2.1+ in order > > to resolve various concerns around the

Re: [PATCH 0/3] Handle bad dev_root properly with rescue=all

2021-03-18 Thread David Sterba
On Thu, Mar 11, 2021 at 11:23:13AM -0500, Josef Bacik wrote: [...] > rescue=all working without panicing the machine, > and I verified everything by > using btrfs-corrupt-block to corrupt a dev root of a file system. Thanks, We need to have such testing part of some suite but it depends on the u

Re: [PATCH v2] btrfs-progs: common: make sure that qgroup id is in range

2021-03-17 Thread David Sterba
On Tue, Mar 16, 2021 at 01:27:46PM +, Sidong Yang wrote: > When user assign qgroup with qgroup id that is too big to exceeds > range and invade level value, and it works without any error. but > this action would be make undefined error. this code make sure that > qgroup id doesn't exceed range

Re: [PATCH] btrfs: fix subvolume/snapshot deletion not triggered on mount

2021-03-17 Thread David Sterba
On Tue, Mar 16, 2021 at 04:53:46PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > During the mount procedure we are calling btrfs_orphan_cleanup() against > the root tree, which will find all orphans items in this tree. When an > orphan item corresponds to a deleted subvolume/snapsho

Re: [PATCH v2] btrfs: Use immediate assignment when referencing cc-option

2021-03-17 Thread David Sterba
On Wed, Mar 17, 2021 at 09:08:48AM -0700, Victor Erminpour wrote: > Calling cc-option will use KBUILD_CFLAGS, which when lazy setting > subdir-ccflags-y produces the following build error: > > scripts/Makefile.lib:10: *** Recursive variable `KBUILD_CFLAGS' \ > references itself (eventually).

Re: [PATCH] btrfs: zoned: automatically reclaim zones

2021-03-17 Thread David Sterba
On Wed, Mar 17, 2021 at 07:38:11PM +0900, Johannes Thumshirn wrote: > When a file gets deleted on a zoned file system, the space freed is no > returned back into the block group's free space, but is migrated to > zone_unusable. > > As this zone_unusable space is behind the current write pointer it

Re: [PATCH] btrfs: zoned: remove outdated WARN_ON in direct IO

2021-03-17 Thread David Sterba
On Wed, Mar 17, 2021 at 01:22:11PM +, Johannes Thumshirn wrote: > On 17/03/2021 14:20, Johannes Thumshirn wrote: > > On 17/03/2021 11:54, David Sterba wrote: > >> On Wed, Mar 17, 2021 at 05:57:31PM +0900, Johannes Thumshirn wrote: > >>> In btrfs_submit_direct(

Re: Fwd: btrfs-progs: libbtrfsutil is under LGPL-3.0 and statically liked into btrfs

2021-03-17 Thread David Sterba
On Wed, Mar 17, 2021 at 12:53:00PM +0100, Adam Borowski wrote: > This is https://bugs.debian.org/985400 > > - Forwarded message from Claudius Heine - > > Dear Maintainer, > > I looked into the licenses of the btrfs-progs project and found that the > libbtrfsutils library is licensed und

Re: [PATCH 0/3] Handle bad dev_root properly with rescue=all

2021-03-17 Thread David Sterba
On Thu, Mar 11, 2021 at 11:23:13AM -0500, Josef Bacik wrote: > Hello, > > My recent debugging session with Neal's broken filesystem uncovered a glaring > hole in my rescue=all patches, they don't deal with a NULL dev_root properly. > In testing I only ever tested corrupting the extent tree or the

Re: [PATCH 1/3] btrfs: init devices always

2021-03-17 Thread David Sterba
On Fri, Mar 12, 2021 at 01:57:32PM +0800, Anand Jain wrote: > > > On 12/3/21 1:52 pm, Anand Jain wrote: > > On 12/3/21 12:23 am, Josef Bacik wrote: > >> Neal reported a panic trying to use -o rescue=all > >> > >> BUG: kernel NULL pointer dereference, address: 0030 > >> PGD 0 P4D 0 > >

Re: [PATCH] btrfs: zoned: remove outdated WARN_ON in direct IO

2021-03-17 Thread David Sterba
On Wed, Mar 17, 2021 at 05:57:31PM +0900, Johannes Thumshirn wrote: > In btrfs_submit_direct() there's a WAN_ON_ONCE() that will trigger if > we're submitting a DIO write on a zoned filesystem but are not using > REQ_OP_ZONE_APPEND to submit the IO to the block device. > > This is a left over from

[PATCH] btrfs: fix build when using M=fs/btrfs

2021-03-17 Thread David Sterba
in a temporary variable to avoid the recursion. Signed-off-by: David Sterba --- fs/btrfs/Makefile | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/Makefile b/fs/btrfs/Makefile index b634c42115ea..b4fb997eda16 100644 --- a/fs/btrfs/Makefile +++ b/fs/bt

[PATCH 5.4] btrfs: scrub: Don't check free space before marking a block group RO

2021-03-17 Thread David Sterba
trfs_inc_block_group_ro(), add more comment for it. Reviewed-by: Filipe Manana Signed-off-by: Qu Wenruo Signed-off-by: David Sterba --- There's a report for 5.4 and the patch applies with a minor fixup without dependencies. https://bugzilla.kernel.org/show_bug.cgi?id=2

Re: [PATCH] btrfs: Use immediate assignment when referencing cc-option

2021-03-17 Thread David Sterba
On Tue, Mar 16, 2021 at 03:46:10PM -0700, Victor Erminpour wrote: > Calling cc-option will use KBUILD_CFLAGS, which when lazy setting > subdir-ccflags-y produces the following build error: > > scripts/Makefile.lib:10: *** Recursive variable `KBUILD_CFLAGS' \ > references itself (eventually).

Re: [PATCH] btrfs: update outdated comment at btrfs_orphan_cleanup()

2021-03-16 Thread David Sterba
On Tue, Mar 16, 2021 at 04:54:13PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > btrfs_orphan_cleanup() has a comment referring to find_dead_roots, but > function does not exists since commit cb517eabba4f10 ("Btrfs: cleanup the > similar code of the fs root read"). What we use now t

Re: [PATCH 0/9] btrfs: bug fixes for the tree mod log and small refactorings

2021-03-16 Thread David Sterba
On Thu, Mar 11, 2021 at 02:31:04PM +, fdman...@kernel.org wrote: > From: Filipe Manana > > This patchset fixes a couple bugs, in the two first patches, with the tree > mod log code. The remaining patches just move all that code into a separate > file, since it's quite large and ctree.c is hug

  1   2   3   4   5   6   7   8   9   10   >