From: Dan Carpenter <dan.carpenter@oracle.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>,
Brian Foster <bfoster@redhat.com>
Cc: linux-xfs@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [PATCH] xfs: fix error code in xfs_iflush_cluster()
Date: Wed, 13 May 2020 12:48:03 +0300 [thread overview]
Message-ID: <20200513094803.GF347693@mwanda> (raw)
Originally this function used to always return -EFSCORRUPTED on error
but now we're trying to return more informative error codes.
Unfortunately, there was one error path missed. If this kmem_alloc()
allocation fails then we need to return -ENOMEM instead of success.
Fixes: f20192991d79 ("xfs: simplify inode flush error handling")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
fs/xfs/xfs_inode.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_inode.c b/fs/xfs/xfs_inode.c
index ab31a5dec7aab..63aeda7cbafb0 100644
--- a/fs/xfs/xfs_inode.c
+++ b/fs/xfs/xfs_inode.c
@@ -3505,8 +3505,10 @@ xfs_iflush_cluster(
cilist_size = igeo->inodes_per_cluster * sizeof(struct xfs_inode *);
cilist = kmem_alloc(cilist_size, KM_MAYFAIL|KM_NOFS);
- if (!cilist)
+ if (!cilist) {
+ error = -ENOMEM;
goto out_put;
+ }
mask = ~(igeo->inodes_per_cluster - 1);
first_index = XFS_INO_TO_AGINO(mp, ip->i_ino) & mask;
--
2.26.2
next reply other threads:[~2020-05-13 10:03 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-13 9:48 Dan Carpenter [this message]
2020-05-13 13:29 ` [PATCH] xfs: fix error code in xfs_iflush_cluster() Brian Foster
2020-05-13 13:39 ` Dan Carpenter
2020-05-13 15:17 ` Darrick J. Wong
2020-05-13 21:09 ` Dave Chinner
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=20200513094803.GF347693@mwanda \
--to=dan.carpenter@oracle.com \
--cc=bfoster@redhat.com \
--cc=darrick.wong@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-xfs@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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox