LKML Archive on lore.kernel.org
 help / color / Atom feed
From: Kees Cook <keescook@chromium.org>
To: Christoph Hellwig <hch@lst.de>
Cc: WeiXiong Liao <gmpy.liaowx@gmail.com>, linux-kernel@vger.kernel.org
Subject: Re: use case for register_pstore_blk?
Date: Wed, 7 Oct 2020 00:13:27 -0700
Message-ID: <202010070007.8FF59EC42@keescook> (raw)
In-Reply-To: <20201006155220.GA11668@lst.de>

On Tue, Oct 06, 2020 at 05:52:20PM +0200, Christoph Hellwig wrote:
> Hi WeiXiong, hi Kees,
> 
> what is the use case for the code added in commit 17639f67c1d6 
> ("pstore/blk: Introduce backend for block devices").
> 
> This still doesn't have a user, and the API looks really odd to me.

pstore is a beast. :) The API is there so that a blk device can declare
its direct support of pstore (specifically, to provide a panic_write
handler).

The MTD device does this, but yes, that's a good point, there isn't a
blk device user of that entry point yet.

> By our normal kernel rules we should not add new exports without
> users and this should probably be reverted for the 5.9 release.

I don't want to revert the entire patch (I'm still using
__register_pstore_blk by way of pstore/blk's "best_effort" option), but
I wouldn't object to something like this:


diff --git a/fs/pstore/blk.c b/fs/pstore/blk.c
index fcd5563dde06..e0fe21e2cf34 100644
--- a/fs/pstore/blk.c
+++ b/fs/pstore/blk.c
@@ -419,27 +419,6 @@ static int __register_pstore_blk(struct pstore_blk_info *info)
 	return ret;
 }
 
-/**
- * register_pstore_blk() - register block device to pstore/blk
- *
- * @info: details on the desired block device interface
- *
- * Return:
- * * 0		- OK
- * * Others	- something error.
- */
-int register_pstore_blk(struct pstore_blk_info *info)
-{
-	int ret;
-
-	mutex_lock(&pstore_blk_lock);
-	ret = __register_pstore_blk(info);
-	mutex_unlock(&pstore_blk_lock);
-
-	return ret;
-}
-EXPORT_SYMBOL_GPL(register_pstore_blk);
-
 static void __unregister_pstore_blk(unsigned int major)
 {
 	struct pstore_device_info dev = { .read = psblk_generic_blk_read };
@@ -454,19 +433,6 @@ static void __unregister_pstore_blk(unsigned int major)
 	}
 }
 
-/**
- * unregister_pstore_blk() - unregister block device from pstore/blk
- *
- * @major: the major device number of device
- */
-void unregister_pstore_blk(unsigned int major)
-{
-	mutex_lock(&pstore_blk_lock);
-	__unregister_pstore_blk(major);
-	mutex_unlock(&pstore_blk_lock);
-}
-EXPORT_SYMBOL_GPL(unregister_pstore_blk);
-
 /* get information of pstore/blk */
 int pstore_blk_get_config(struct pstore_blk_config *info)
 {
diff --git a/include/linux/pstore_blk.h b/include/linux/pstore_blk.h
index 61e914522b01..2bf07d20ce43 100644
--- a/include/linux/pstore_blk.h
+++ b/include/linux/pstore_blk.h
@@ -46,9 +46,6 @@ struct pstore_blk_info {
 	sector_t start_sect;
 };
 
-int  register_pstore_blk(struct pstore_blk_info *info);
-void unregister_pstore_blk(unsigned int major);
-
 /**
  * struct pstore_device_info - back-end pstore/blk driver structure.
  *

-- 
Kees Cook

  reply index

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-06 15:52 Christoph Hellwig
2020-10-07  7:13 ` Kees Cook [this message]
2020-10-07  7:37   ` Christoph Hellwig
2020-10-07  7:55   ` Christoph Hellwig
2020-10-07  8:37     ` Christoph Hellwig
2020-10-07 18:40       ` Kees Cook
2020-10-07 18:42         ` Christoph Hellwig
2020-10-07 19:17           ` Kees Cook
2020-10-12  7:02             ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202010070007.8FF59EC42@keescook \
    --to=keescook@chromium.org \
    --cc=gmpy.liaowx@gmail.com \
    --cc=hch@lst.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

LKML Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/lkml/0 lkml/git/0.git
	git clone --mirror https://lore.kernel.org/lkml/1 lkml/git/1.git
	git clone --mirror https://lore.kernel.org/lkml/2 lkml/git/2.git
	git clone --mirror https://lore.kernel.org/lkml/3 lkml/git/3.git
	git clone --mirror https://lore.kernel.org/lkml/4 lkml/git/4.git
	git clone --mirror https://lore.kernel.org/lkml/5 lkml/git/5.git
	git clone --mirror https://lore.kernel.org/lkml/6 lkml/git/6.git
	git clone --mirror https://lore.kernel.org/lkml/7 lkml/git/7.git
	git clone --mirror https://lore.kernel.org/lkml/8 lkml/git/8.git
	git clone --mirror https://lore.kernel.org/lkml/9 lkml/git/9.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 lkml lkml/ https://lore.kernel.org/lkml \
		linux-kernel@vger.kernel.org
	public-inbox-index lkml

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-kernel


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git