From: David Sterba <firstname.lastname@example.org> To: Nikolay Borisov <email@example.com> Cc: firstname.lastname@example.org, email@example.com Subject: Re: [PATCH v2] btrfs: Ensure replaced device doesn't have pending chunk allocation Date: Fri, 17 May 2019 16:28:45 +0200 Message-ID: <20190517142845.GC3138@twin.jikos.cz> (raw) In-Reply-To: <firstname.lastname@example.org> On Fri, May 17, 2019 at 10:44:25AM +0300, Nikolay Borisov wrote: > Recent FITRIM work, namely bbbf7243d62d ("btrfs: combine device update > operations during transaction commit") combined the way certain > operations are recoded in a transaction. As a result an ASSERT was > added in dev_replace_finish to ensure the new code works correctly. > Unfortunately I got reports that it's possible to trigger the assert, > meaning that during a device replace it's possible to have an unfinished > chunk allocation on the source device. > > This is supposed to be prevented by the fact that a transaction is > committed before finishing the replace oepration and alter acquiring > the chunk mutex. This is not sufficient since by the time the > transaction is committed and the chunk mutex acquired it's possible to > allocate a chunk depending on the workload being executed on the > replaced device. This bug has been present ever since device replace was > introduced but there was never code which checks for it. > > The correct way to fix is to ensure that there is no pending device > modification operation when the chunk mutex is acquire and if there is > repeat transaction commit. Unfortunately it's not possible to just > exclude the source device from btrfs_fs_devices::dev_alloc_list since > this causes ENOSPC to be hit in transaction commit. > > Fixes: 391cd9df81ac ("Btrfs: fix unprotected alloc list insertion during the finishing procedure of replace") > Signed-off-by: Nikolay Borisov <email@example.com> Added to misc-next, thanks.
next prev parent reply index Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-14 10:54 [PATCH 0/8] Misc improvements to dev-replace code Nikolay Borisov 2019-05-14 10:54 ` [PATCH 1/8] btrfs: Don't opencode sync_blockdev in btrfs_init_dev_replace_tgtdev Nikolay Borisov 2019-05-14 10:59 ` Johannes Thumshirn 2019-05-14 10:54 ` [PATCH 2/8] btrfs: Reduce critical section " Nikolay Borisov 2019-05-14 11:05 ` Johannes Thumshirn 2019-05-14 10:54 ` [PATCH 3/8] btrfs: Remove impossible WARN_ON Nikolay Borisov 2019-05-14 11:09 ` Johannes Thumshirn 2019-05-14 10:54 ` [PATCH 4/8] btrfs: Ensure btrfs_init_dev_replace_tgtdev sees up to date values Nikolay Borisov 2019-05-14 10:54 ` [PATCH 5/8] btrfs: Streamline replace sem unlock in btrfs_dev_replace_start Nikolay Borisov 2019-05-14 12:50 ` Johannes Thumshirn 2019-05-14 10:54 ` [PATCH 6/8] btrfs: Explicitly reserve space for devreplace item Nikolay Borisov 2019-05-14 12:56 ` Johannes Thumshirn 2019-05-14 10:54 ` [PATCH 7/8] btrfs: Ensure replaced device doesn't have pending chunk allocation Nikolay Borisov 2019-05-15 16:52 ` David Sterba 2019-05-17 7:44 ` [PATCH v2] " Nikolay Borisov 2019-05-17 14:28 ` David Sterba [this message] 2019-05-14 10:54 ` [PATCH 8/8] btrfs: Remove redundant assignment of tgt_device->commit_total_bytes Nikolay Borisov 2019-05-14 12:59 ` Johannes Thumshirn
Reply instructions: You may reply publically 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=20190517142845.GC3138@twin.jikos.cz \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ /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
Linux-BTRFS Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-btrfs/0 linux-btrfs/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-btrfs linux-btrfs/ https://lore.kernel.org/linux-btrfs \ email@example.com firstname.lastname@example.org public-inbox-index linux-btrfs Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-btrfs AGPL code for this site: git clone https://public-inbox.org/ public-inbox