From: Christoph Hellwig <hch@lst.de>
To: akpm@linux-foundation.org
Cc: jack@suse.cz, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org,
dhowells@redhat.com, marc.dionne@auristor.com,
linux-afs@lists.infradead.org
Subject: [PATCH 2/2] afs: fix the afs_dir_get_folio return value
Date: Wed, 3 May 2023 17:45:26 +0200 [thread overview]
Message-ID: <20230503154526.1223095-2-hch@lst.de> (raw)
In-Reply-To: <20230503154526.1223095-1-hch@lst.de>
Keep returning NULL on failure instead of letting an ERR_PTR escape to
callers that don't expect it.
Fixes: 66dabbb65d67 ("mm: return an ERR_PTR from __filemap_get_folio")
Reported-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
fs/afs/dir_edit.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/fs/afs/dir_edit.c b/fs/afs/dir_edit.c
index f0eddccbdd9541..e2fa577b66fe0a 100644
--- a/fs/afs/dir_edit.c
+++ b/fs/afs/dir_edit.c
@@ -115,11 +115,12 @@ static struct folio *afs_dir_get_folio(struct afs_vnode *vnode, pgoff_t index)
folio = __filemap_get_folio(mapping, index,
FGP_LOCK | FGP_ACCESSED | FGP_CREAT,
mapping->gfp_mask);
- if (IS_ERR(folio))
+ if (IS_ERR(folio)) {
clear_bit(AFS_VNODE_DIR_VALID, &vnode->flags);
- else if (folio && !folio_test_private(folio))
+ return NULL;
+ }
+ if (!folio_test_private(folio))
folio_attach_private(folio, (void *)1);
-
return folio;
}
--
2.39.2
next prev parent reply other threads:[~2023-05-03 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-03 15:45 [PATCH 1/2] filemap: fix the conditional folio_put in filemap_fault Christoph Hellwig
2023-05-03 15:45 ` Christoph Hellwig [this message]
2023-05-03 15:54 ` [PATCH 2/2] afs: fix the afs_dir_get_folio return value Jan Kara
2023-05-03 15:48 ` [PATCH 1/2] filemap: fix the conditional folio_put in filemap_fault Matthew Wilcox
2023-05-03 15:49 ` Christoph Hellwig
2023-05-04 3:34 ` Matthew Wilcox
2023-05-03 15:57 ` Jan Kara
2023-05-03 18:55 ` [PATCH 2/2] afs: fix the afs_dir_get_folio return value David Howells
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=20230503154526.1223095-2-hch@lst.de \
--to=hch@lst.de \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=jack@suse.cz \
--cc=linux-afs@lists.infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=marc.dionne@auristor.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox