From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id B22E2C77B7F for ; Wed, 3 May 2023 15:54:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 468FD6B0072; Wed, 3 May 2023 11:54:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 41A146B0075; Wed, 3 May 2023 11:54:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 30859900002; Wed, 3 May 2023 11:54:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by kanga.kvack.org (Postfix) with ESMTP id 0C4656B0072 for ; Wed, 3 May 2023 11:54:15 -0400 (EDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 69A7B229DB; Wed, 3 May 2023 15:54:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1683129253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=od0EVsy8UznIoL+Zwfmk1n1t6ccq/cOyBAiielREKuY=; b=PX+tLsQ+1dHUfe9WNnK8rncqooCs7oO6cm5pird2sHU44dthjo8fyvE2MSyrd2mYfiqd6l Uv8lVslOOXyFkHd8/s5Am1k5xjujJYXkB/p0yzaM4upT80kgyk/ZxmqkpKHQGY+rUX4haa W6Y7aFyfHqzJoe71qLj2AM/F0/kPrXQ= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1683129253; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=od0EVsy8UznIoL+Zwfmk1n1t6ccq/cOyBAiielREKuY=; b=EZcTwdC+TP9XMCRvupNyRrLZO9Nj3FOtPS45UVrLCf8KVixur2yKqJPlIb/wngmC6vmFr8 nW9Mu606j+NaXFCA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 5C10313584; Wed, 3 May 2023 15:54:13 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id M9toFqWDUmQddAAAMHmgww (envelope-from ); Wed, 03 May 2023 15:54:13 +0000 Received: by quack3.suse.cz (Postfix, from userid 1000) id E129DA0744; Wed, 3 May 2023 17:54:12 +0200 (CEST) Date: Wed, 3 May 2023 17:54:12 +0200 From: Jan Kara To: Christoph Hellwig Cc: akpm@linux-foundation.org, 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: Re: [PATCH 2/2] afs: fix the afs_dir_get_folio return value Message-ID: <20230503155412.a7t4fhtlnvxojdoq@quack3> References: <20230503154526.1223095-1-hch@lst.de> <20230503154526.1223095-2-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230503154526.1223095-2-hch@lst.de> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Wed 03-05-23 17:45:26, Christoph Hellwig wrote: > 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 > Signed-off-by: Christoph Hellwig Looks good to me. Feel free to add: Reviewed-by: Jan Kara Honza > --- > 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 > -- Jan Kara SUSE Labs, CR