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 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CC9BCC77B75 for ; Tue, 23 May 2023 16:59:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684861155; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=SmRA/2grfAtBTQittIbAZ6tPKDU5/hQ4zhQGtHvQJto=; b=bQ/Gtx1Kk69nRtCfkxm4uqBofO59qvsJfcMrwsjaj4cMPD3em+0puqYFG/GrzOaiyPV+3P 9jCXxxEjV0qruWOflluuKNvD4mxwcnTwcL1efXnJHvLP5P0qTCkzUkPom7ZA38eFWiPKIJ LmSBQKLeFkVCl6EYMljcX/Ndq5CsrM8= Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-433-G8MmK1izOTawjWD-t637Kg-1; Tue, 23 May 2023 12:59:14 -0400 X-MC-Unique: G8MmK1izOTawjWD-t637Kg-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 98D9C3847087; Tue, 23 May 2023 16:59:12 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8723B40CFD00; Tue, 23 May 2023 16:59:12 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4703A19465A8; Tue, 23 May 2023 16:59:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id E504619465A0 for ; Tue, 23 May 2023 16:59:10 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A53FC40D1B60; Tue, 23 May 2023 16:59:05 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast07.extmail.prod.ext.rdu2.redhat.com [10.11.55.23]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9D63840C6CCF for ; Tue, 23 May 2023 16:59:05 +0000 (UTC) Received: from us-smtp-inbound-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 821573C0C887 for ; Tue, 23 May 2023 16:59:05 +0000 (UTC) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-516-DONjQWxaOtu_G775H27s-A-1; Tue, 23 May 2023 12:59:03 -0400 X-MC-Unique: DONjQWxaOtu_G775H27s-A-1 Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-62382e86f81so32050926d6.2 for ; Tue, 23 May 2023 09:59:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684861143; x=1687453143; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=iwRGjqJkSXRPJHHzQwuRJHCwrUdQwcyQ9byVzjawyEc=; b=PHC/rKWwsXrCCdalBJtQfqBzBakQsNXtWHQul09J3R3CIHlv6INOFXIVRlj5gIJd/U ZIjQvyweBSONKMzdHGj2VfnGSsS9A8RhnDEDXhw+FfiHB89zRbOo55AgzFuw0XAN7h9W rGoSftz4OpFfHwRwvKyBmc+12z78KKHVyY866Kph5pwA7jXnr03mLRQbhmLqXf9o4S8g YEaZHUROnvJKFXzz9sWd9M2ByxpNIJWGaCUGbedklnUw3J8nk2CRF9KuDCs8fyus75bC 12QOISPcurirFVrO0vhYsv4O/bdTNWgX/eAsHCgP8ZED6dDY4HY2v3hH0+PMAXRSBr4r zU6A== X-Gm-Message-State: AC+VfDweNs62noDdfCN1RjZFYwwCI0LjBe7m7O4u81Hl6g64aug3FZCC uVWEpj/MzDFVH7Ux9D/eWdSzcdE= X-Google-Smtp-Source: ACHHUZ7KDQ2Jp5KWH/08+Nowc+ZerVbKYaqFsCmja4tNY6veUp3xnJBwfILDlwQLmRkuu4hWo14WpA== X-Received: by 2002:ad4:5742:0:b0:621:64c7:235f with SMTP id q2-20020ad45742000000b0062164c7235fmr24446598qvx.27.1684861143301; Tue, 23 May 2023 09:59:03 -0700 (PDT) Received: from localhost (pool-68-160-166-30.bstnma.fios.verizon.net. [68.160.166.30]) by smtp.gmail.com with ESMTPSA id x19-20020ae9f813000000b00759333a57adsm2666246qkh.11.2023.05.23.09.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 09:59:02 -0700 (PDT) Date: Tue, 23 May 2023 12:59:01 -0400 From: Mike Snitzer To: Christoph Hellwig Message-ID: References: <20230523074535.249802-1-hch@lst.de> <20230523074535.249802-21-hch@lst.de> MIME-Version: 1.0 In-Reply-To: <20230523074535.249802-21-hch@lst.de> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 Subject: Re: [dm-devel] [PATCH 20/24] dm: only call early_lookup_bdev from early boot context X-BeenThere: dm-devel@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: device-mapper development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jens Axboe , Vignesh Raghavendra , "Rafael J. Wysocki" , Greg Kroah-Hartman , linux-pm@vger.kernel.org, Joern Engel , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, Richard Weinberger , dm-devel@redhat.com, linux-mtd@lists.infradead.org, Pavel Machek , Miquel Raynal Errors-To: dm-devel-bounces@redhat.com Sender: "dm-devel" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: kernel.org Content-Disposition: inline Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit On Tue, May 23 2023 at 3:45P -0400, Christoph Hellwig wrote: > early_lookup_bdev is supposed to only be called from the early boot > code, but dm_get_device calls it as a general fallback when lookup_bdev > fails, which is problematic because early_lookup_bdev bypasses all normal > path based permission checking, and might cause problems with certain > container environments renaming devices. > > Switch to only call early_lookup_bdev when dm is built-in and the system > state in not running yet. This means it is still available when tables > are constructed by dm-init.c from the kernel command line, but not > otherwise. > > Note that this strictly speaking changes the kernel ABI as the PARTUUID= > and PARTLABEL= style syntax is now not available during a running > systems. They never were intended for that, but this breaks things > we'll have to figure out a way to make them available again. But if > avoidable in any way I'd rather avoid that. > > Signed-off-by: Christoph Hellwig > --- > drivers/md/dm-table.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index e997f4322a9967..c230241a76b374 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -326,8 +326,11 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, > /* > * Add a device to the list, or just increment the usage count if > * it's already present. > + * > + * Note: the __ref annotation is because this function can call the __init > + * marked early_lookup_bdev when called during early boot code from dm-init.c. > */ > -int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > +int __ref dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > struct dm_dev **result) > { > int r; > @@ -346,8 +349,10 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > return -EOVERFLOW; > } else { > r = lookup_bdev(path, &dev); > - if (r) > +#ifndef MODULE > + if (r && system_state < SYSTEM_RUNNING) > r = early_lookup_bdev(path, &dev); > +#endif > if (r) > return -ENODEV; > } > -- > 2.39.2 > I think/hope this will be fine: Reviewed-by: Mike Snitzer -- dm-devel mailing list dm-devel@redhat.com https://listman.redhat.com/mailman/listinfo/dm-devel 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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58DE6C77B75 for ; Tue, 23 May 2023 17:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237900AbjEWRAF (ORCPT ); Tue, 23 May 2023 13:00:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36922 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235952AbjEWRAE (ORCPT ); Tue, 23 May 2023 13:00:04 -0400 Received: from mail-qv1-f54.google.com (mail-qv1-f54.google.com [209.85.219.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 335CB18F for ; Tue, 23 May 2023 09:59:04 -0700 (PDT) Received: by mail-qv1-f54.google.com with SMTP id 6a1803df08f44-62383441211so32208656d6.0 for ; Tue, 23 May 2023 09:59:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684861143; x=1687453143; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=iwRGjqJkSXRPJHHzQwuRJHCwrUdQwcyQ9byVzjawyEc=; b=FSR5jEdOsl0j8RIEJVhzC0EvFeEP4gbVddyK8Yf/3+HUFp8Sc6L4Q6BGnXsG0Aqycj rCxcSxdufiFmqVe0jZ9wiYu6Ed7/R3JcdO/dMyXfOm1kHnDJcIzeSHpJ0HzXMEbOGwUu dU+InKpRZ57WE+U50XtINSkbi3DLIa5PrsUV8yqvWD+zMp+LIJIJp7t/WuJHotKl+mSg DvRiRe3aORaKU9fdAKDd+LtdPvOdn3ZoLY+J4XoQ9zxhr8jr/X658k+yuBvvVuaI7x5p tzbapJMz7wrx+TkSfyvWrVOQSlL/7bCB098I3ntjvpcoWz5QIJ2ptX6EA5lIiteMxVh+ 3PAw== X-Gm-Message-State: AC+VfDzAQ5dk3BOW5q3tu23rrYJ4Yw3/WZxAfhSk/Yo3/qdSjGgN86w1 5sxZqjBNZXMxX7ra5WxE4WBt X-Google-Smtp-Source: ACHHUZ7KDQ2Jp5KWH/08+Nowc+ZerVbKYaqFsCmja4tNY6veUp3xnJBwfILDlwQLmRkuu4hWo14WpA== X-Received: by 2002:ad4:5742:0:b0:621:64c7:235f with SMTP id q2-20020ad45742000000b0062164c7235fmr24446598qvx.27.1684861143301; Tue, 23 May 2023 09:59:03 -0700 (PDT) Received: from localhost (pool-68-160-166-30.bstnma.fios.verizon.net. [68.160.166.30]) by smtp.gmail.com with ESMTPSA id x19-20020ae9f813000000b00759333a57adsm2666246qkh.11.2023.05.23.09.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 09:59:02 -0700 (PDT) Date: Tue, 23 May 2023 12:59:01 -0400 From: Mike Snitzer To: Christoph Hellwig Cc: Jens Axboe , Greg Kroah-Hartman , "Rafael J. Wysocki" , Joern Engel , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pavel Machek , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 20/24] dm: only call early_lookup_bdev from early boot context Message-ID: References: <20230523074535.249802-1-hch@lst.de> <20230523074535.249802-21-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230523074535.249802-21-hch@lst.de> Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org On Tue, May 23 2023 at 3:45P -0400, Christoph Hellwig wrote: > early_lookup_bdev is supposed to only be called from the early boot > code, but dm_get_device calls it as a general fallback when lookup_bdev > fails, which is problematic because early_lookup_bdev bypasses all normal > path based permission checking, and might cause problems with certain > container environments renaming devices. > > Switch to only call early_lookup_bdev when dm is built-in and the system > state in not running yet. This means it is still available when tables > are constructed by dm-init.c from the kernel command line, but not > otherwise. > > Note that this strictly speaking changes the kernel ABI as the PARTUUID= > and PARTLABEL= style syntax is now not available during a running > systems. They never were intended for that, but this breaks things > we'll have to figure out a way to make them available again. But if > avoidable in any way I'd rather avoid that. > > Signed-off-by: Christoph Hellwig > --- > drivers/md/dm-table.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index e997f4322a9967..c230241a76b374 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -326,8 +326,11 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, > /* > * Add a device to the list, or just increment the usage count if > * it's already present. > + * > + * Note: the __ref annotation is because this function can call the __init > + * marked early_lookup_bdev when called during early boot code from dm-init.c. > */ > -int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > +int __ref dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > struct dm_dev **result) > { > int r; > @@ -346,8 +349,10 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > return -EOVERFLOW; > } else { > r = lookup_bdev(path, &dev); > - if (r) > +#ifndef MODULE > + if (r && system_state < SYSTEM_RUNNING) > r = early_lookup_bdev(path, &dev); > +#endif > if (r) > return -ENODEV; > } > -- > 2.39.2 > I think/hope this will be fine: Reviewed-by: Mike Snitzer 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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 752BAC7EE23 for ; Tue, 23 May 2023 16:59:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=oigCWrVkMQlFQyWJ0j1V9oCfYmNZSDroEJtDxvjWy/4=; b=E97pM+lT9Sx8/E jar+jw+TFnWJCUJ0I52kbeBbgN8X0DHn8X8RXji8PviflPWuYzLZujYzIQ9Hn17eDxY+JbvW5IY+0 RU0kCosMUjBHFh2Y5b8Efjg27UeBUGzREreyRLBTgo7ItpQRNItkvS8tBGL9rgrOIYtlXCJ8AOW5d rHBlQp/ePXD6RVH38YPmxVnIJAk/UWHoHq2DJyOSrk9ZBn2aqseYQRaZlvEGzHUxdP8VtsIr16GbJ e75l4PBto8vslaKMBJIhvQNmGsk9OzZSTU8q3COAQrY3eaZ/lUGxitVCNhf7DxBq6iQ3MM1syMJoj RtaGN/YhFHkEWRzTbBEg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1q1VLo-00AspR-01; Tue, 23 May 2023 16:59:08 +0000 Received: from mail-qv1-f48.google.com ([209.85.219.48]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1q1VLl-00Asop-0W for linux-mtd@lists.infradead.org; Tue, 23 May 2023 16:59:06 +0000 Received: by mail-qv1-f48.google.com with SMTP id 6a1803df08f44-61cd6191a62so32019366d6.3 for ; Tue, 23 May 2023 09:59:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684861143; x=1687453143; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=iwRGjqJkSXRPJHHzQwuRJHCwrUdQwcyQ9byVzjawyEc=; b=dHLGe6WbRmjtLBc2ZsRVEyQ7PQL5EMdaFcjs7fprEFVxqC1ULW9auWU+s/vxUV5pGJ EtWVSpbJrzRv9HvB/TRi1uhJfbtYem7mBLKzQ7kEbdFh1ESX3/foGvo4wqjnGZpOKrhC xylbdc+L1PB/4FS1mqWcBN6EzFK2uoEYbClUUlCg4RUQxGzAbyLIqI870HkbK42QDuOb aBayhrbBwLZKigC/m1wlC+xOFDitOqY5mhug8oMcvXVumdKiBVEneabGWrpgW7lyzz/1 msmWfnzWXcUsUslkrhfZdBwVEHQ+eARQ9gQannjiI+HjuJRQf5i4FqxXXei46CIPGYwm jx4Q== X-Gm-Message-State: AC+VfDzal+QSg5QhiREQhxe/2mePr+seFFo8mP1ewqUUOvBV8t3DDBpF EgEcElErtyQfOVZ2TlQls1w2 X-Google-Smtp-Source: ACHHUZ7KDQ2Jp5KWH/08+Nowc+ZerVbKYaqFsCmja4tNY6veUp3xnJBwfILDlwQLmRkuu4hWo14WpA== X-Received: by 2002:ad4:5742:0:b0:621:64c7:235f with SMTP id q2-20020ad45742000000b0062164c7235fmr24446598qvx.27.1684861143301; Tue, 23 May 2023 09:59:03 -0700 (PDT) Received: from localhost (pool-68-160-166-30.bstnma.fios.verizon.net. [68.160.166.30]) by smtp.gmail.com with ESMTPSA id x19-20020ae9f813000000b00759333a57adsm2666246qkh.11.2023.05.23.09.59.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 23 May 2023 09:59:02 -0700 (PDT) Date: Tue, 23 May 2023 12:59:01 -0400 From: Mike Snitzer To: Christoph Hellwig Cc: Jens Axboe , Greg Kroah-Hartman , "Rafael J. Wysocki" , Joern Engel , Miquel Raynal , Richard Weinberger , Vignesh Raghavendra , Pavel Machek , dm-devel@redhat.com, linux-kernel@vger.kernel.org, linux-block@vger.kernel.org, linux-mtd@lists.infradead.org, linux-pm@vger.kernel.org Subject: Re: [PATCH 20/24] dm: only call early_lookup_bdev from early boot context Message-ID: References: <20230523074535.249802-1-hch@lst.de> <20230523074535.249802-21-hch@lst.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230523074535.249802-21-hch@lst.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230523_095905_203237_37A51152 X-CRM114-Status: GOOD ( 29.18 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Tue, May 23 2023 at 3:45P -0400, Christoph Hellwig wrote: > early_lookup_bdev is supposed to only be called from the early boot > code, but dm_get_device calls it as a general fallback when lookup_bdev > fails, which is problematic because early_lookup_bdev bypasses all normal > path based permission checking, and might cause problems with certain > container environments renaming devices. > > Switch to only call early_lookup_bdev when dm is built-in and the system > state in not running yet. This means it is still available when tables > are constructed by dm-init.c from the kernel command line, but not > otherwise. > > Note that this strictly speaking changes the kernel ABI as the PARTUUID= > and PARTLABEL= style syntax is now not available during a running > systems. They never were intended for that, but this breaks things > we'll have to figure out a way to make them available again. But if > avoidable in any way I'd rather avoid that. > > Signed-off-by: Christoph Hellwig > --- > drivers/md/dm-table.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c > index e997f4322a9967..c230241a76b374 100644 > --- a/drivers/md/dm-table.c > +++ b/drivers/md/dm-table.c > @@ -326,8 +326,11 @@ static int upgrade_mode(struct dm_dev_internal *dd, fmode_t new_mode, > /* > * Add a device to the list, or just increment the usage count if > * it's already present. > + * > + * Note: the __ref annotation is because this function can call the __init > + * marked early_lookup_bdev when called during early boot code from dm-init.c. > */ > -int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > +int __ref dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > struct dm_dev **result) > { > int r; > @@ -346,8 +349,10 @@ int dm_get_device(struct dm_target *ti, const char *path, fmode_t mode, > return -EOVERFLOW; > } else { > r = lookup_bdev(path, &dev); > - if (r) > +#ifndef MODULE > + if (r && system_state < SYSTEM_RUNNING) > r = early_lookup_bdev(path, &dev); > +#endif > if (r) > return -ENODEV; > } > -- > 2.39.2 > I think/hope this will be fine: Reviewed-by: Mike Snitzer ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/