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=-5.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no 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 49223C433E0 for ; Mon, 8 Feb 2021 01:41:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 00F1164DCC for ; Mon, 8 Feb 2021 01:41:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229565AbhBHBlG (ORCPT ); Sun, 7 Feb 2021 20:41:06 -0500 Received: from out30-43.freemail.mail.aliyun.com ([115.124.30.43]:46998 "EHLO out30-43.freemail.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229537AbhBHBlE (ORCPT ); Sun, 7 Feb 2021 20:41:04 -0500 X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0UO6S8yU_1612748421; Received: from admindeMacBook-Pro-2.local(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0UO6S8yU_1612748421) by smtp.aliyun-inc.com(127.0.0.1); Mon, 08 Feb 2021 09:40:21 +0800 Subject: Re: [PATCH 1/3] virtio-blk: close udev startup race condition as default groups To: Greg KH Cc: sashal@kernel.org, stable@vger.kernel.org, joseph.qi@linux.alibaba.com, caspar@linux.alibaba.com, Hannes Reinecke References: <20210207114656.32141-1-jefflexu@linux.alibaba.com> <20210207114656.32141-2-jefflexu@linux.alibaba.com> From: JeffleXu Message-ID: Date: Mon, 8 Feb 2021 09:40:21 +0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On 2/7/21 7:56 PM, Greg KH wrote: > On Sun, Feb 07, 2021 at 07:46:54PM +0800, Jeffle Xu wrote: >> commit fef912bf860e8e7e48a2bfb978a356bba743a8b7 upstream. >> commit e982c4d0a29b1d61fbe7716a8dcf8984936d6730 upstream. >> >> Similar to commit 9e07f4e24379 ("zram: close udev startup race condition >> as default groups"), this is a merge of [1, 2], since [1] may be too >> large size to be merged into -stable tree. > > Why is it too big? > >> This issue has been introduced since v2.6.36 by [3]. >> >> [1] fef912bf860e, block: genhd: add 'groups' argument to device_add_disk >> [2] e982c4d0a29b, virtio-blk: modernize sysfs attribute creation >> [3] a5eb9e4ff18a, virtio_blk: Add 'serial' attribute to virtio-blk devices (v2) > > What userspace tools are now hitting this issue? If it's a real > problem, let's take the real commits, right? > > Same for the other patches in this series. > udevd hits this issue. systemd-udevd is responsible for creating symlinks, such as '/dev/disk/by-id/XXXX' when receiving KOBJ_ADD uevent from kernel space. For virtio-blk devices, udevd will read '/sys/devices/pciXXXX/block/serial' to acquire the corresponding serial id of the virtio-blk device. Without this fixing patch, '/sys/devices/pciXXXX/block/serial' is created after the KOBJ_ADD uevent. Thus when udevd received KOBJ_ADD uevent, it may find that '/sys/devices/pciXXXX/block/serial' doesn't exist at that time, and finally failed to create '/dev/disk/by-id/XXXX' symlink. I found several similar posts on internet, complaining '/dev/disk/by-id/XXXX' is not created for virtio-blk devices. This issue indeed is caused by some sort of race condition. I also found that systemd-239 doesn't have this issue, while systemd-219 has. But we didn't find the exact fixing commit for this issue for systemd-239 though. -- Thanks, Jeffle