From: Greg KH <greg@kroah.com>
To: Nikolay Borisov <nborisov@suse.com>
Cc: stable@vger.kernel.org, wqu@suse.com, David Sterba <dsterba@suse.com>
Subject: Re: [PATCH 3/3] btrfs: Ensure btrfs_trim_fs can trim the whole filesystem
Date: Thu, 29 Nov 2018 13:20:02 +0100 [thread overview]
Message-ID: <20181129122002.GB3149@kroah.com> (raw)
In-Reply-To: <20181120072556.362-1-nborisov@suse.com>
On Tue, Nov 20, 2018 at 09:25:56AM +0200, Nikolay Borisov wrote:
> From: Qu Wenruo <wqu@suse.com>
>
> [BUG]
> fstrim on some btrfs only trims the unallocated space, not trimming any
> space in existing block groups.
>
> [CAUSE]
> Before fstrim_range passed to btrfs_trim_fs(), it gets truncated to
> range [0, super->total_bytes). So later btrfs_trim_fs() will only be
> able to trim block groups in range [0, super->total_bytes).
>
> While for btrfs, any bytenr aligned to sectorsize is valid, since btrfs
> uses its logical address space, there is nothing limiting the location
> where we put block groups.
>
> For filesystem with frequent balance, it's quite easy to relocate all
> block groups and bytenr of block groups will start beyond
> super->total_bytes.
>
> In that case, btrfs will not trim existing block groups.
>
> [FIX]
> Just remove the truncation in btrfs_ioctl_fitrim(), so btrfs_trim_fs()
> can get the unmodified range, which is normally set to [0, U64_MAX].
>
> Reported-by: Chris Murphy <lists@colorremedies.com>
> Fixes: f4c697e6406d ("btrfs: return EINVAL if start > total_bytes in fitrim ioctl")
> CC: <stable@vger.kernel.org> # v4.4+
> Signed-off-by: Qu Wenruo <wqu@suse.com>
> Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> Reviewed-by: David Sterba <dsterba@suse.com>
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
>
> Hello Greg,
>
> Please apply upstream commit 6ba9fc8e628becf0e3ec94083450d089b0dec5f5 to
> 4.4.y and 4.9.y. This backport should apply cleanly to both trees.
This is already in 4.9.141, so I only applied it to 4.4.y
thanks,
greg k-h
prev parent reply other threads:[~2018-11-29 23:25 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-11 20:12 FAILED: patch "[PATCH] btrfs: Ensure btrfs_trim_fs can trim the whole filesystem" failed to apply to 4.9-stable tree gregkh
2018-11-20 7:25 ` [PATCH 3/3] btrfs: Ensure btrfs_trim_fs can trim the whole filesystem Nikolay Borisov
2018-11-29 12:20 ` Greg KH [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181129122002.GB3149@kroah.com \
--to=greg@kroah.com \
--cc=dsterba@suse.com \
--cc=nborisov@suse.com \
--cc=stable@vger.kernel.org \
--cc=wqu@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.