Linux-ext4 Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2] ext4: fix error code in ext4_commit_super
@ 2021-04-02 10:16 Fengnan Chang
  2021-04-03 18:34 ` Andreas Dilger
  0 siblings, 1 reply; 3+ messages in thread
From: Fengnan Chang @ 2021-04-02 10:16 UTC (permalink / raw)
  To: tytso, adilger.kernel, linux-ext4; +Cc: Fengnan Chang

We should set the error code when ext4_commit_super check argument failed.
Found in code review.
Fixes: c4be0c1dc4cdc ("filesystem freeze: add error handling of write_super_lockfs/unlockfs").

Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
---
 fs/ext4/super.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/ext4/super.c b/fs/ext4/super.c
index 03373471131c..1130599c87dc 100644
--- a/fs/ext4/super.c
+++ b/fs/ext4/super.c
@@ -5500,8 +5500,10 @@ static int ext4_commit_super(struct super_block *sb, int sync)
 	struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
 	int error = 0;

-	if (!sbh || block_device_ejected(sb))
-		return error;
+	if (!sbh)
+		return -EINVAL;
+	if (block_device_ejected(sb))
+		return -ENODEV;

 	/*
 	 * If the file system is mounted read-only, don't update the
--
2.29.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ext4: fix error code in ext4_commit_super
  2021-04-02 10:16 [PATCH v2] ext4: fix error code in ext4_commit_super Fengnan Chang
@ 2021-04-03 18:34 ` Andreas Dilger
  2021-04-09 22:45   ` Theodore Ts'o
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Dilger @ 2021-04-03 18:34 UTC (permalink / raw)
  To: Fengnan Chang; +Cc: Theodore Y. Ts'o, Ext4 Developers List


[-- Attachment #1: Type: text/plain, Size: 1073 bytes --]

On Apr 2, 2021, at 4:16 AM, Fengnan Chang <changfengnan@vivo.com> wrote:
> 
> We should set the error code when ext4_commit_super check argument failed.
> Found in code review.
> Fixes: c4be0c1dc4cdc ("filesystem freeze: add error handling of write_super_lockfs/unlockfs").
> 
> Signed-off-by: Fengnan Chang <changfengnan@vivo.com>

Reviewed-by: Andreas Dilger <adilger@dilger.ca>

> ---
> fs/ext4/super.c | 6 ++++--
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/ext4/super.c b/fs/ext4/super.c
> index 03373471131c..1130599c87dc 100644
> --- a/fs/ext4/super.c
> +++ b/fs/ext4/super.c
> @@ -5500,8 +5500,10 @@ static int ext4_commit_super(struct super_block *sb, int sync)
> 	struct buffer_head *sbh = EXT4_SB(sb)->s_sbh;
> 	int error = 0;
> 
> -	if (!sbh || block_device_ejected(sb))
> -		return error;
> +	if (!sbh)
> +		return -EINVAL;
> +	if (block_device_ejected(sb))
> +		return -ENODEV;
> 
> 	/*
> 	 * If the file system is mounted read-only, don't update the
> --
> 2.29.0
> 


Cheers, Andreas






[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 873 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] ext4: fix error code in ext4_commit_super
  2021-04-03 18:34 ` Andreas Dilger
@ 2021-04-09 22:45   ` Theodore Ts'o
  0 siblings, 0 replies; 3+ messages in thread
From: Theodore Ts'o @ 2021-04-09 22:45 UTC (permalink / raw)
  To: Andreas Dilger; +Cc: Fengnan Chang, Ext4 Developers List

On Sat, Apr 03, 2021 at 12:34:50PM -0600, Andreas Dilger wrote:
> On Apr 2, 2021, at 4:16 AM, Fengnan Chang <changfengnan@vivo.com> wrote:
> > 
> > We should set the error code when ext4_commit_super check argument failed.
> > Found in code review.
> > Fixes: c4be0c1dc4cdc ("filesystem freeze: add error handling of write_super_lockfs/unlockfs").
> > 
> > Signed-off-by: Fengnan Chang <changfengnan@vivo.com>
> 
> Reviewed-by: Andreas Dilger <adilger@dilger.ca>

Thanks, applied.

						- Ted

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, back to index

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-02 10:16 [PATCH v2] ext4: fix error code in ext4_commit_super Fengnan Chang
2021-04-03 18:34 ` Andreas Dilger
2021-04-09 22:45   ` Theodore Ts'o

Linux-ext4 Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-ext4/0 linux-ext4/git/0.git

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

Example config snippet for mirrors

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


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