All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: <linux-fsdevel@vger.kernel.org>
Cc: Wang Shilong <wangshilong1991@gmail.com>,
	Andreas Dilger <adilger@dilger.ca>, Jan Kara <jack@suse.cz>
Subject: [PATCH 15/27] quota: Fix error codes in v2_read_file_info()
Date: Mon, 21 Aug 2017 13:55:05 +0200	[thread overview]
Message-ID: <20170821115517.26542-16-jack@suse.cz> (raw)
In-Reply-To: <20170821115517.26542-1-jack@suse.cz>

v2_read_file_info() returned -1 instead of proper error codes on error.
Luckily this is not easily visible from userspace as we have called
->check_quota_file shortly before and thus already verified the quota
file is sane. Still set the error codes to proper values.

Reviewed-by: Andreas Dilger <adilger@dilger.ca>
Signed-off-by: Jan Kara <jack@suse.cz>
---
 fs/quota/quota_v2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/quota/quota_v2.c b/fs/quota/quota_v2.c
index 373d7cfea5b0..21a8bdf7cfec 100644
--- a/fs/quota/quota_v2.c
+++ b/fs/quota/quota_v2.c
@@ -99,13 +99,13 @@ static int v2_read_file_info(struct super_block *sb, int type)
 
 	down_read(&dqopt->dqio_sem);
 	if (!v2_read_header(sb, type, &dqhead)) {
-		ret = -1;
+		ret = -EIO;
 		goto out;
 	}
 	version = le32_to_cpu(dqhead.dqh_version);
 	if ((info->dqi_fmt_id == QFMT_VFS_V0 && version != 0) ||
 	    (info->dqi_fmt_id == QFMT_VFS_V1 && version != 1)) {
-		ret = -1;
+		ret = -EINVAL;
 		goto out;
 	}
 
@@ -113,7 +113,7 @@ static int v2_read_file_info(struct super_block *sb, int type)
 	       sizeof(struct v2_disk_dqinfo), V2_DQINFOOFF);
 	if (size != sizeof(struct v2_disk_dqinfo)) {
 		quota_error(sb, "Can't read info structure");
-		ret = -1;
+		ret = -EIO;
 		goto out;
 	}
 	info->dqi_priv = kmalloc(sizeof(struct qtree_mem_dqinfo), GFP_NOFS);
-- 
2.12.3

  parent reply	other threads:[~2017-08-21 11:55 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-21 11:54 [PATCH 0/27 v2] Quota scalability patches Jan Kara
2017-08-21 11:54 ` [PATCH 01/27] quota: Convert dqio_mutex to rwsem Jan Kara
2017-08-21 11:54 ` [PATCH 02/27] quota: Do more fine-grained locking in dquot_acquire() Jan Kara
2017-08-21 11:54 ` [PATCH 03/27] quota: Acquire dqio_sem for reading in dquot_get_next_id() Jan Kara
2017-08-21 11:54 ` [PATCH 04/27] quota: Acquire dqio_sem for reading in vfs_load_quota_inode() Jan Kara
2017-08-21 11:54 ` [PATCH 05/27] quota: Protect dquot writeout with dq_lock Jan Kara
2017-08-21 11:54 ` [PATCH 06/27] quota: Push dqio_sem down to ->read_dqblk() Jan Kara
2017-08-21 11:54 ` [PATCH 07/27] quota: Remove locking for reading from the old quota format Jan Kara
2017-08-21 11:54 ` [PATCH 08/27] quota: Push dqio_sem down to ->write_dqblk() Jan Kara
2017-08-21 11:54 ` [PATCH 09/27] quota: Do not acquire dqio_sem for dquot overwrites in v2 format Jan Kara
2017-08-21 11:55 ` [PATCH 10/27] quota: Remove locking for writing to the old quota format Jan Kara
2017-08-21 11:55 ` [PATCH 11/27] quota: Push dqio_sem down to ->release_dqblk() Jan Kara
2017-08-21 11:55 ` [PATCH 12/27] quota: Push dqio_sem down to ->get_next_id() Jan Kara
2017-08-21 11:55 ` [PATCH 13/27] quota: Push dqio_sem down to ->write_file_info() Jan Kara
2017-08-21 11:55 ` [PATCH 14/27] quota: Push dqio_sem down to ->read_file_info() Jan Kara
2017-08-21 11:55 ` Jan Kara [this message]
2017-08-21 11:55 ` [PATCH 16/27] quota: Propagate ->quota_read errors from v2_read_file_info() Jan Kara
2017-08-21 11:55 ` [PATCH 17/27] quota: Fix possible corruption of dqi_flags Jan Kara
2017-08-21 11:55 ` [PATCH 18/27] quota: Do not dirty bad dquots Jan Kara
2017-08-21 11:55 ` [PATCH 19/27] quota: Move locking into clear_dquot_dirty() Jan Kara
2017-08-21 11:55 ` [PATCH 20/27] quota: Remove dq_wait_unused from dquot Jan Kara
2017-08-21 11:55 ` [PATCH 21/27] quota: Allow disabling tracking of dirty dquots in a list Jan Kara
2017-08-21 11:55 ` [PATCH 22/27] ext4: Disable dirty list tracking of dquots when journalling quotas Jan Kara
2017-08-21 11:55 ` [PATCH 23/27] quota: Inline functions into their callsites Jan Kara
2017-08-21 11:55 ` [PATCH 24/27] quota: Inline inode_{incr,decr}_space() into callsites Jan Kara
2017-08-21 11:55 ` [PATCH 25/27] quota: Inline dquot_[re]claim_reserved_space() into callsite Jan Kara
2017-08-21 11:55 ` [PATCH 26/27] fs: Provide __inode_get_bytes() Jan Kara
2017-08-21 11:55 ` [PATCH 27/27] quota: Reduce contention on dq_data_lock Jan Kara
     [not found] ` <CAP9B-Qnnh3V9kq1qHemWD5s7DmA3Ef3LAVvgzLrbb7pgLEqb8w@mail.gmail.com>
2017-08-31  8:28   ` [PATCH 0/27 v2] Quota scalability patches Jan Kara
     [not found]     ` <CAP9B-QntdC06C8fAinqU6-4V6SzC_k4SyEpgHAqZ5zEF7ERq-w@mail.gmail.com>
2017-08-31  9:48       ` Jan Kara
     [not found]         ` <CAP9B-Qn1VvfnDZNH4eM1rWxenO6M=KJ+mSurEuc2FC70YwWoyQ@mail.gmail.com>
2017-08-31 12:22           ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2017-08-16 15:41 [PATCH 0/27 v1] " Jan Kara
2017-08-16 15:41 ` [PATCH 15/27] quota: Fix error codes in v2_read_file_info() Jan Kara
2017-08-16 18:00   ` Andreas Dilger

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=20170821115517.26542-16-jack@suse.cz \
    --to=jack@suse.cz \
    --cc=adilger@dilger.ca \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=wangshilong1991@gmail.com \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.