From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEBB5C433E0 for ; Fri, 19 Jun 2020 13:44:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9E801208C7 for ; Fri, 19 Jun 2020 13:44:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592574263; bh=BuAWhNmdSG6svVhFPs+KswwH7bI/yrEKhl4hS+GWFuY=; h=Subject:To:Cc:From:Date:List-ID:From; b=YgcntnYXN+JFp4WHvhiM6DDxOTfD8gn28id9CYwHLoViCZpqlEyx3lMwsmAr9fW02 71iPomZ75FqEzXhANZF/h7zy/VBC8vmQ37F/6bbpAeGDyAz07SVgX2qbamcetZZ9JS 7mCuzpVEe6w5d/DaSkXhJyCEt9+lnqFTF2+vIroQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729509AbgFSNoW (ORCPT ); Fri, 19 Jun 2020 09:44:22 -0400 Received: from forward5-smtp.messagingengine.com ([66.111.4.239]:50245 "EHLO forward5-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731806AbgFSNoV (ORCPT ); Fri, 19 Jun 2020 09:44:21 -0400 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailforward.nyi.internal (Postfix) with ESMTP id 6B78F1945737; Fri, 19 Jun 2020 09:44:20 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Fri, 19 Jun 2020 09:44:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=3v1bpf 2P3KjI713rlN7ji+IkIPKR0hs1pxlBsO5XoQw=; b=oMbIieyR2lZl+/6BeC3va3 yOpcGmwwPzt7qoSeEECxqAqS6oYCWFv8Zz8Me/ulKR89RyaZDUVH6thVUcLRJWS/ /eGGoEerRzmwxguuLdQ9DirQnFXCLquQyXA5seGPgSuEx4dAtst2a7sIR5ibvutZ U0P/QsO3QqjVnSgiAZqoRbs1e1fZefG5sId2TYgcYsLUryAscxc4gezBLU8pxq63 ZD0ayp3Hawnndr0XpfdKOMeDIDkBZVtzRPCZxh+12bw0UdMMTlKGphofWSVFInZO rIxojr2J3e9sEqZq1hIETvDYXoQtV9H6aKYbNB4syJovlRrjDkzEDcCIc6IYj8ow == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudejiedgieelucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuggftrfgrthhtvghrnhepieetveehuedvhfdtgfdvieeiheehfeelveevheejud etveeuveeludejjefgteehnecukfhppeekfedrkeeirdekledruddtjeenucevlhhushht vghrufhiiigvpedvnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhh drtghomh X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id CD72A3060FE7; Fri, 19 Jun 2020 09:44:19 -0400 (EDT) Subject: FAILED: patch "[PATCH] block: nr_sects_write(): Disable preemption on seqcount write" failed to apply to 4.4-stable tree To: a.darwish@linutronix.de, axboe@kernel.dk, bigeasy@linutronix.de, stable@vger.kernel.org Cc: From: Date: Fri, 19 Jun 2020 15:43:41 +0200 Message-ID: <15925742215144@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.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 . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 15b81ce5abdc4b502aa31dff2d415b79d2349d2f Mon Sep 17 00:00:00 2001 From: "Ahmed S. Darwish" Date: Wed, 3 Jun 2020 16:49:48 +0200 Subject: [PATCH] block: nr_sects_write(): Disable preemption on seqcount write For optimized block readers not holding a mutex, the "number of sectors" 64-bit value is protected from tearing on 32-bit architectures by a sequence counter. Disable preemption before entering that sequence counter's write side critical section. Otherwise, the read side can preempt the write side section and spin for the entire scheduler tick. If the reader belongs to a real-time scheduling class, it can spin forever and the kernel will livelock. Fixes: c83f6bf98dc1 ("block: add partition resize function to blkpg ioctl") Cc: Signed-off-by: Ahmed S. Darwish Reviewed-by: Sebastian Andrzej Siewior Signed-off-by: Jens Axboe diff --git a/block/blk.h b/block/blk.h index aa16e524dc35..b5d1f0fc6547 100644 --- a/block/blk.h +++ b/block/blk.h @@ -420,9 +420,11 @@ static inline sector_t part_nr_sects_read(struct hd_struct *part) static inline void part_nr_sects_write(struct hd_struct *part, sector_t size) { #if BITS_PER_LONG==32 && defined(CONFIG_SMP) + preempt_disable(); write_seqcount_begin(&part->nr_sects_seq); part->nr_sects = size; write_seqcount_end(&part->nr_sects_seq); + preempt_enable(); #elif BITS_PER_LONG==32 && defined(CONFIG_PREEMPTION) preempt_disable(); part->nr_sects = size;