Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp50785pxf; Wed, 24 Mar 2021 20:40:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy+miYgAhaoo0TuVDak91bSK88E48qtdhfV2ZiXrmoTxxcSJOlRrYWKGgV/B15mmEPGBDbb X-Received: by 2002:a17:906:9501:: with SMTP id u1mr7231048ejx.324.1616643659306; Wed, 24 Mar 2021 20:40:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616643659; cv=none; d=google.com; s=arc-20160816; b=PBOebZPKW+1Snbwg1TA99r/c/Sb+QBFKM55NETVo1wI8nxnfN8cl85Y0n5XF5Be7J5 NMnLdi6A2LUeESKrRp0dXNEH8mherpCNREr9O5ubgENy1YX3bjlvjaE0ZdIlk7kCFhmz udWmncATxk5m84ecLIOfM3vjItK5T0Y88IPRFcRFC+a5KX5+Hq856sIDG0pqzsQMc0xB 7wlnxnQ6Iy3JzqX2wFf4vlRBstaj4Cz4ZFjEESxHHjyH+96oK1dKNRrCIhObt9njrxKf WTF6QnA5pdfMuuTCyWThL3vH5YbcdSjn1JC4ZQJnYQpHzkcWKv6X6QnacIK/7CTpcEjw i3IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=m+/Q96DtGZE6hWrtWdO8RjDxUqSr6STDrIbcIrWsIZ4=; b=mg8bn1TbxPCTv2xhGq3Zuf8wWm9TjAB+E4zYW1kzABj2t4voogBoR8p7MyhSlCt0lK RQS2F0PPUdFxlIQi28c7j2QjlL275ANFFu0rJvuVovSYSDKO3M45JqNoVphDHTy6VK1L Geo677G1WNsXMoxOnCuxDjcD2cSgq9A/BqbmWA69jLTdgRI9jzVZ4eKPxDOmzKTh3FUl 4Pv1AFisPfXuWuA1B2jH+TErK4gMsFxApxwrkl4xt2SPFkKP6JtLjaoFQTP+VyRK0REW szLhmh1pi6xFnnEHNlwTe1tZWH1n5Qdzi8tF/F91MI+T9CLPrRUALK+woMc9vPSL8YLT u6dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DWx43lNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i15si3030083ejv.550.2021.03.24.20.40.36; Wed, 24 Mar 2021 20:40:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=DWx43lNN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235724AbhCYBqm (ORCPT + 99 others); Wed, 24 Mar 2021 21:46:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:60380 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235750AbhCYBqb (ORCPT ); Wed, 24 Mar 2021 21:46:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1616636790; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=m+/Q96DtGZE6hWrtWdO8RjDxUqSr6STDrIbcIrWsIZ4=; b=DWx43lNNx/m3k+vk7pUpGBb9/boDDHAxSKMnZOen+lcIN9ODNrsbn9SK470VJpNnvtevEh xOFhHqoTClEkoV+YgX8IxzCBFzyHOyJ5Y9aip/ThjPGFtKoCBBPxewsFQUyGPZqEXjhBCN RQY5jE1KZJ2tLFfzfZqJPTtk3K7ZGqs= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-498-FA4rvCSUMeGhF7OIL5Vf4Q-1; Wed, 24 Mar 2021 21:46:26 -0400 X-MC-Unique: FA4rvCSUMeGhF7OIL5Vf4Q-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 199841084C9B; Thu, 25 Mar 2021 01:46:25 +0000 (UTC) Received: from T590 (ovpn-12-137.pek2.redhat.com [10.72.12.137]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5912B5D9D0; Thu, 25 Mar 2021 01:46:18 +0000 (UTC) Date: Thu, 25 Mar 2021 09:46:13 +0800 From: Ming Lei To: Gulam Mohamed Cc: "hch@infradead.org" , "linux-kernel@vger.kernel.org" , "linux-block@vger.kernel.org" , Junxiao Bi , Martin Petersen , "axboe@kernel.dk" Subject: Re: Race condition in Kernel Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 24, 2021 at 12:37:03PM +0000, Gulam Mohamed wrote: > Hi All, > > We are facing a stale link (of the device) issue during the iscsi-logout process if we use parted command just before the iscsi logout. Here are the details: > > As part of iscsi logout, the partitions and the disk will be removed. The parted command, used to list the partitions, will open the disk in RW mode which results in systemd-udevd re-reading the partitions. This will trigger the rescan partitions which will also delete and re-add the partitions. So, both iscsi logout processing and the parted (through systemd-udevd) will be involved in add/delete of partitions. In our case, the following sequence of operations happened (the iscsi device is /dev/sdb with partition sdb1): > > 1. sdb1 was removed by PARTED > 2. kworker, as part of iscsi logout, couldn't remove sdb1 as it was already removed by PARTED > 3. sdb1 was added by parted After kworker is started for logout, I guess all IOs are supposed to be failed at that time, so just wondering why 'sdb1' is still added by parted(systemd-udev)? ioctl(BLKRRPART) needs to read partition table for adding back partitions, if IOs are failed by iscsi logout, I guess the issue can be avoided too? -- Ming