[Ocfs2-devel] [PATCH] ocfs2: Fix wrong search logic in __ocfs2_resv_find_window

Heming Zhao heming.zhao at suse.com
Fri Apr 21 08:01:29 UTC 2023


On Fri, Apr 21, 2023 at 03:35:01PM +0800, Joseph Qi wrote:
> Hi,
> Could you please share a reproducer?
> 

Anyone could access & download the URL [1] (I wrote it in patch commit log)
without register SUSE account.

Please check attachment file, which I downloaded from [1] and modified under
the BZ comment 1. The trigger method is also in comment 1, I copy here:
./defragfs_test.sh -d /dev/vdf -m /mnt -n ocfstst -s pcmk -o /tmp -b 1024 -c 8192

note: you may modify '-n' (cluster name) & -s' (cluster stack).

[1]: https://bugzilla.suse.com/show_bug.cgi?id=1131931

Thanks,
Heming

> 
> On 4/6/23 11:40 PM, Heming Zhao wrote:
> > ** problem **
> > 
> > Current code triggers a defragfs bug [1]:
> > 
> > ```
> > tw-tst:~ # defragfs.ocfs2 /mnt/test_from_dd1
> > defragfs.ocfs2 1.8.7
> > [ERROR]Move extent failed:"/mnt/test_from_dd1" - No space left on device
> > [ERROR]"/mnt/test_from_dd1":No space left on device
> > ```
> > 
> > I added some debug messages in relevant functions. When above error
> > messages appeared, the la-window still had enough continuous bitmap
> > to use, the -ENOSPC is wrong.
> > 
> > ** analysis **
> > 
> > __ocfs2_resv_find_window should use resv node from rb-tree to do linear
> > search. But current code logic uses un-managered area between two resvs.
> > The searching logic deviates from this func job, which should only focus
> > on reservation areas (when rb_root is non NULL). Another issue of
> > __ocfs2_resv_find_window is more inclined to generate inner fragment.
> > It doesn't search & consume existing reservations but be apt to create
> > new reservation item.
> > 
> > This patch pulls this func (__ocfs2_resv_find_window) to do what it
> > should do: search & consume resev. if this func fails to get suitable
> > bitmap area, caller ocfs2_resv_find_window fallbacks to use oldest
> > resv from LRU to do the final search.
> > 
> > [1]: https://bugzilla.suse.com/show_bug.cgi?id=1131931
> > 
> > Signed-off-by: Heming Zhao <heming.zhao at suse.com>
> > ---
> >  fs/ocfs2/reservations.c | 48 +++++++++++++++++++++++++++++------------
> >  1 file changed, 34 insertions(+), 14 deletions(-)



More information about the Ocfs2-devel mailing list