From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9340019F406 for ; Mon, 30 Dec 2024 08:41:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735548113; cv=none; b=p7hPY+cCHMedHzEszAoTy9AIimvCftI7GxH3DISfxBGqxLMmNXMeerlcB4iZtW0hCUObijuVzvUxrp8jeTqf7HjJsuFBFdhUiNKInvaQjr7KBBVF6q6YwbZ6JGRO9+aLo/qdPv5Ris611shJ3BtI46HWtXeVbCrFkgVbelhkRUU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1735548113; c=relaxed/simple; bh=sjvrvDHPzRgpC1n4fzbAjztWWpjTmV8xBMt2kUNZnYM=; h=Subject:To:Cc:From:Date:Message-ID:MIME-Version:Content-Type; b=D+oi+qJkmG03VJ01fjjbAaYVJuGEvCo8EgS7q4wv4tz3UFBXiNvaTPMWi8PJ0gLT54IxhV61l3eTZZw4qegapUcZjX+HKpAgrclhUM4a9CbzllL/+xR1zraXOPCmBaoxOzLyhD0K9JrYd0yTaUGuJWDcTgrmULcWWCThu2OtAf4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=sqsfNKkr; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="sqsfNKkr" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 04775C4CED0; Mon, 30 Dec 2024 08:41:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1735548113; bh=sjvrvDHPzRgpC1n4fzbAjztWWpjTmV8xBMt2kUNZnYM=; h=Subject:To:Cc:From:Date:From; b=sqsfNKkrniiXR8PPc9tFZ2ATTShylfcno30wiXFoEcOTrnuMEQTPbkfW6sZPGyVNk pYHv3w5/cqhzmUh9kFkbnNoKymjDYR8kLFQPC6l4KQluh9BW0Z1bkJ25XBvA98Lcl/ fRoFKs8nWWqG382DvmX9mg/rSAJIG0fi/neVT/0k= Subject: FAILED: patch "[PATCH] btrfs: allow swap activation to be interruptible" failed to apply to 5.4-stable tree To: fdmanana@suse.com,dsterba@suse.com,wqu@suse.com Cc: From: Date: Mon, 30 Dec 2024 09:41:40 +0100 Message-ID: <2024123040-crablike-vision-ad10@gregkh> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit The patch below does not apply to the 5.4-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . To reproduce the conflict and resubmit, you may use the following commands: git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.4.y git checkout FETCH_HEAD git cherry-pick -x 9a45022a0efadd99bcc58f7f1cc2b6fb3b808c40 # git commit -s git send-email --to '' --in-reply-to '2024123040-crablike-vision-ad10@gregkh' --subject-prefix 'PATCH 5.4.y' HEAD^.. Possible dependencies: thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 9a45022a0efadd99bcc58f7f1cc2b6fb3b808c40 Mon Sep 17 00:00:00 2001 From: Filipe Manana Date: Mon, 9 Dec 2024 16:31:41 +0000 Subject: [PATCH] btrfs: allow swap activation to be interruptible During swap activation we iterate over the extents of a file, then do several checks for each extent, some of which may take some significant time such as checking if an extent is shared. Since a file can have many thousands of extents, this can be a very slow operation and it's currently not interruptible. I had a bug during development of a previous patch that resulted in an infinite loop when iterating the extents, so a core was busy looping and I couldn't cancel the operation, which is very annoying and requires a reboot. So make the loop interruptible by checking for fatal signals at the end of each iteration and stopping immediately if there is one. CC: stable@vger.kernel.org # 5.4+ Reviewed-by: Qu Wenruo Signed-off-by: Filipe Manana Signed-off-by: David Sterba diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index b87f19630b00..c4675f4345fd 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -10073,6 +10073,11 @@ static int btrfs_swap_activate(struct swap_info_struct *sis, struct file *file, bsi.block_start = physical_block_start; bsi.block_len = len; } + + if (fatal_signal_pending(current)) { + ret = -EINTR; + goto out; + } } if (bsi.block_len)