All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Trond Myklebust <trondmy@hammerspace.com>,
	Anna Schumaker <anna.schumaker@netapp.com>,
	Steve French <sfrench@samba.org>,
	Dominique Martinet <asmadeus@codewreck.org>
Cc: dhowells@redhat.com, Jeff Layton <jlayton@redhat.com>,
	Matthew Wilcox <willy@infradead.org>,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	linux-cachefs@redhat.com, linux-afs@lists.infradead.org,
	linux-nfs@vger.kernel.org, linux-cifs@vger.kernel.org,
	ceph-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 02/10] fscache: Fix fscache_cookie_enabled() to handle NULL cookie
Date: Thu, 07 Oct 2021 21:43:22 +0100	[thread overview]
Message-ID: <163363940251.1980952.8682998052010411386.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <163363935000.1980952.15279841414072653108.stgit@warthog.procyon.org.uk>

Fix fscache_cookie_enabled() to handle being given a NULL cookie pointer
(ie. a cookie was not allocated and caching should be ignored).

Signed-off-by: David Howells <dhowells@redhat.com>
---

 include/linux/fscache.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/linux/fscache.h b/include/linux/fscache.h
index 32f65c16328a..5e3ddb11715a 100644
--- a/include/linux/fscache.h
+++ b/include/linux/fscache.h
@@ -167,7 +167,8 @@ struct fscache_cookie {
 
 static inline bool fscache_cookie_enabled(struct fscache_cookie *cookie)
 {
-	return test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags);
+	return (fscache_cookie_valid(cookie) &&
+		test_bit(FSCACHE_COOKIE_ENABLED, &cookie->flags));
 }
 
 /*



  parent reply	other threads:[~2021-10-07 20:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-07 20:42 [PATCH v3 00/10] fscache: Replace and remove old I/O API David Howells
2021-10-07 20:43 ` [PATCH v3 01/10] fscache: Generalise the ->begin_read_operation method David Howells
2021-10-07 20:43 ` David Howells [this message]
2021-10-07 20:43 ` [PATCH v3 03/10] cachefiles: Always indicate we should fill a post-EOF page with zeros David Howells
2021-10-07 20:43 ` [PATCH v3 04/10] fscache: Implement a fallback I/O interface to replace the old API David Howells
2021-10-07 20:43 ` [PATCH v3 05/10] nfs: Move to using the alternate fallback fscache I/O API David Howells
2021-10-07 20:43 ` [PATCH v3 06/10] 9p: Convert to using the netfs helper lib to do reads and caching David Howells
2021-10-07 20:44 ` [PATCH v3 07/10] cifs: (untested) Move to using the alternate fallback fscache I/O API David Howells
2021-10-07 20:44 ` [PATCH v3 08/10] fscache: Remove the old " David Howells
2021-10-07 20:44 ` [PATCH v3 09/10] fscache: Remove stats that are no longer used David Howells
2021-10-07 20:44 ` [PATCH v3 10/10] fscache: Update the documentation to reflect I/O API changes David Howells
2021-10-29 14:02 ` [PATCH v3 07/10] cifs: (untested) Move to using the alternate fallback fscache I/O API 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=163363940251.1980952.8682998052010411386.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=anna.schumaker@netapp.com \
    --cc=asmadeus@codewreck.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jlayton@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-cachefs@redhat.com \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=sfrench@samba.org \
    --cc=trondmy@hammerspace.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.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 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.