mbox series

[0/4,for,5.15,stable] btrfs: some directory fixes for stable 5.15

Message ID cover.1706183427.git.fdmanana@suse.com (mailing list archive)
Headers show
Series btrfs: some directory fixes for stable 5.15 | expand

Message

Filipe Manana Jan. 25, 2024, 11:59 a.m. UTC
From: Filipe Manana <fdmanana@suse.com>

Here follows the backport of some directory related fixes for the stable
5.15 tree. I tested these on top of 5.15.147.

These were recently requested at:

   https://lore.kernel.org/linux-btrfs/20240124225522.GA2614102@lxhi-087/

Filipe Manana (4):
  btrfs: fix infinite directory reads
  btrfs: set last dir index to the current last index when opening dir
  btrfs: refresh dir last index during a rewinddir(3) call
  btrfs: fix race between reading a directory and adding entries to it

 fs/btrfs/ctree.h         |   1 +
 fs/btrfs/delayed-inode.c |   5 +-
 fs/btrfs/delayed-inode.h |   1 +
 fs/btrfs/inode.c         | 150 +++++++++++++++++++++++++--------------
 4 files changed, 102 insertions(+), 55 deletions(-)

Comments

Eugeniu Rosca Jan. 26, 2024, 6:55 p.m. UTC | #1
Hello Filipe,

Thanks for your participation/support.

On Thu, Jan 25, 2024 at 11:59:34AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Here follows the backport of some directory related fixes for the stable
> 5.15 tree. I tested these on top of 5.15.147.
> 
> These were recently requested at:
> 
>    https:// lore.kernel.org/linux-btrfs/20240124225522.GA2614102@lxhi-087/
> 
> Filipe Manana (4):
>   btrfs: fix infinite directory reads
>   btrfs: set last dir index to the current last index when opening dir
>   btrfs: refresh dir last index during a rewinddir(3) call
>   btrfs: fix race between reading a directory and adding entries to it
> 
>  fs/btrfs/ctree.h         |   1 +
>  fs/btrfs/delayed-inode.c |   5 +-
>  fs/btrfs/delayed-inode.h |   1 +
>  fs/btrfs/inode.c         | 150 +++++++++++++++++++++++++--------------
>  4 files changed, 102 insertions(+), 55 deletions(-)

The conflict resolution looks accurate to a non-expert eye.

I can also confirm there are no new findings reported by:
 - make W=1
 - make C=2
 - cppcheck --enable=all --force --inconclusive
 - PVS-Studio

PS: Could you help me out how (and if at all possible) to preserve the
Author date of the original patch when downloading and applying the
'raw' file provided by lore.kernel.org ?

Thanks,
Eugeniu
Greg KH Jan. 27, 2024, 1:15 a.m. UTC | #2
On Thu, Jan 25, 2024 at 11:59:34AM +0000, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
> 
> Here follows the backport of some directory related fixes for the stable
> 5.15 tree. I tested these on top of 5.15.147.

As these are not also in 6.1.y, we can't take these as you do not want
to upgrade and have regressions, right?

If you can provide a working set of 6.1.y changes for these, we will be
glad to queue them all up, thanks.

greg k-h
Filipe Manana Jan. 27, 2024, 5:58 p.m. UTC | #3
On Sat, Jan 27, 2024 at 1:15 AM Greg KH <gregkh@linuxfoundation.org> wrote:
>
> On Thu, Jan 25, 2024 at 11:59:34AM +0000, fdmanana@kernel.org wrote:
> > From: Filipe Manana <fdmanana@suse.com>
> >
> > Here follows the backport of some directory related fixes for the stable
> > 5.15 tree. I tested these on top of 5.15.147.
>
> As these are not also in 6.1.y, we can't take these as you do not want
> to upgrade and have regressions, right?
>
> If you can provide a working set of 6.1.y changes for these, we will be
> glad to queue them all up, thanks.

Ok, here the version for 6.1, tested against 6.1.75:

https://lore.kernel.org/linux-btrfs/cover.1706377319.git.fdmanana@suse.com/

Thanks.

>
> greg k-h
Filipe Manana Jan. 27, 2024, 6:02 p.m. UTC | #4
On Fri, Jan 26, 2024 at 6:55 PM Eugeniu Rosca <erosca@de.adit-jv.com> wrote:
>
> Hello Filipe,
>
> Thanks for your participation/support.
>
> On Thu, Jan 25, 2024 at 11:59:34AM +0000, fdmanana@kernel.org wrote:
> > From: Filipe Manana <fdmanana@suse.com>
> >
> > Here follows the backport of some directory related fixes for the stable
> > 5.15 tree. I tested these on top of 5.15.147.
> >
> > These were recently requested at:
> >
> >    https:// lore.kernel.org/linux-btrfs/20240124225522.GA2614102@lxhi-087/
> >
> > Filipe Manana (4):
> >   btrfs: fix infinite directory reads
> >   btrfs: set last dir index to the current last index when opening dir
> >   btrfs: refresh dir last index during a rewinddir(3) call
> >   btrfs: fix race between reading a directory and adding entries to it
> >
> >  fs/btrfs/ctree.h         |   1 +
> >  fs/btrfs/delayed-inode.c |   5 +-
> >  fs/btrfs/delayed-inode.h |   1 +
> >  fs/btrfs/inode.c         | 150 +++++++++++++++++++++++++--------------
> >  4 files changed, 102 insertions(+), 55 deletions(-)
>
> The conflict resolution looks accurate to a non-expert eye.
>
> I can also confirm there are no new findings reported by:
>  - make W=1
>  - make C=2
>  - cppcheck --enable=all --force --inconclusive
>  - PVS-Studio
>
> PS: Could you help me out how (and if at all possible) to preserve the
> Author date of the original patch when downloading and applying the
> 'raw' file provided by lore.kernel.org ?

If I understand you correctly, you applied the diff of patches
directly with the "patch" command.

To get kernel patches and apply them easily, use the b4 tool available at:

git://git.kernel.org/pub/scm/utils/b4/b4.git

Then in the kernel source directory do this:

b4 am '<cover.1706183427.git.fdmanana@suse.com>'

It will create 2 files:

20240125_fdmanana_btrfs_some_directory_fixes_for_stable_5_15.cover
20240125_fdmanana_btrfs_some_directory_fixes_for_stable_5_15.mbox

The first is just the cover letter, the second contains the patches.
To apply them, just do:

git am 20240125_fdmanana_btrfs_some_directory_fixes_for_stable_5_15.mbox

Hope that answers your question.


>
> Thanks,
> Eugeniu
Filipe Manana Jan. 27, 2024, 6:18 p.m. UTC | #5
On Sat, Jan 27, 2024 at 5:58 PM Filipe Manana <fdmanana@kernel.org> wrote:
>
> On Sat, Jan 27, 2024 at 1:15 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Thu, Jan 25, 2024 at 11:59:34AM +0000, fdmanana@kernel.org wrote:
> > > From: Filipe Manana <fdmanana@suse.com>
> > >
> > > Here follows the backport of some directory related fixes for the stable
> > > 5.15 tree. I tested these on top of 5.15.147.
> >
> > As these are not also in 6.1.y, we can't take these as you do not want
> > to upgrade and have regressions, right?
> >
> > If you can provide a working set of 6.1.y changes for these, we will be
> > glad to queue them all up, thanks.
>
> Ok, here the version for 6.1, tested against 6.1.75:
>
> https://lore.kernel.org/linux-btrfs/cover.1706377319.git.fdmanana@suse.com/

Sorry, there's a change I forgot to git add and amend to patch 1/4, so
fixed in a v2 at:

https://lore.kernel.org/linux-btrfs/cover.1706379057.git.fdmanana@suse.com/

Thanks.
>
> Thanks.
>
> >
> > greg k-h
Greg KH Jan. 27, 2024, 9:19 p.m. UTC | #6
On Sat, Jan 27, 2024 at 06:18:49PM +0000, Filipe Manana wrote:
> On Sat, Jan 27, 2024 at 5:58 PM Filipe Manana <fdmanana@kernel.org> wrote:
> >
> > On Sat, Jan 27, 2024 at 1:15 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Thu, Jan 25, 2024 at 11:59:34AM +0000, fdmanana@kernel.org wrote:
> > > > From: Filipe Manana <fdmanana@suse.com>
> > > >
> > > > Here follows the backport of some directory related fixes for the stable
> > > > 5.15 tree. I tested these on top of 5.15.147.
> > >
> > > As these are not also in 6.1.y, we can't take these as you do not want
> > > to upgrade and have regressions, right?
> > >
> > > If you can provide a working set of 6.1.y changes for these, we will be
> > > glad to queue them all up, thanks.
> >
> > Ok, here the version for 6.1, tested against 6.1.75:
> >
> > https://lore.kernel.org/linux-btrfs/cover.1706377319.git.fdmanana@suse.com/
> 
> Sorry, there's a change I forgot to git add and amend to patch 1/4, so
> fixed in a v2 at:
> 
> https://lore.kernel.org/linux-btrfs/cover.1706379057.git.fdmanana@suse.com/

All now queued up, thanks!

greg k-h
Eugeniu Rosca Jan. 29, 2024, 1:39 p.m. UTC | #7
Hello Filipe,

On Sat, Jan 27, 2024 at 06:02:55PM +0000, Filipe Manana wrote:
> On Fri, Jan 26, 2024 at 6:55 PM Eugeniu Rosca <erosca@de.adit-jv.com> wrote:

[..]

> > PS: Could you help me out how (and if at all possible) to preserve the
> > Author date of the original patch when downloading and applying the
> > 'raw' file provided by https:// lore.kernel.org/
> 
> If I understand you correctly, you applied the diff of patches
> directly with the "patch" command.

Nope. I download the 'raw' patch [0] (assumed to be in mbox format?),
then apply it via 'git am'. This workflow should preserve such patch
metadata like commit description, Author's name/date, etc.

> To get kernel patches and apply them easily, use the b4 tool available at:
> 
> git://git.kernel.org/pub/scm/utils/b4/b4.git

Thanks for sharing. This reminds me of patchwork/pwclient.

I've reapplied the patches using 'b4' and Author's Date of the stable
commits is still altered compared to the vanilla/mainline commits.

For example:
 - Author's date of vanilla [2]: 2023-08-13 12:34:08 +0100 
 - Author's date of stable [1]:  2024-01-25 11:59:35 +0000 

This likely means that the Author's date is amended during
porting/cherry-picking. Of course, this is not a major issue,
but some of us may assume that most of patch metadata (including
Author's date) is preserved on backporting (as best practice).

PS: We can likely skip it, since a number of other patches seem to
alter the Author's date on 5.15 stable tree (~600 out of 21k+ commits).

[1] https:// lore.kernel.org/stable/f1e33797054fcea8b61d88878e67b8c007b5d5f5.1706183427.git.fdmanana@suse.com/raw
[2] https:// git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=9b378f6ad48cfa

Thanks,
Eugeniu