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>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	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 v4 02/10] fscache: Fix fscache_cookie_enabled() to handle NULL cookie
Date: Fri, 29 Oct 2021 15:09:28 +0100	[thread overview]
Message-ID: <163551656895.1877519.8303891885033763947.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <163551653404.1877519.12363794970541005441.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-29 14:10 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-29 14:08 [PATCH v4 00/10] fscache: Replace and remove old I/O API David Howells
2021-10-29 14:09 ` [PATCH v4 01/10] fscache: Generalise the ->begin_read_operation method David Howells
2021-10-29 14:09 ` David Howells [this message]
2021-10-29 14:09 ` [PATCH v4 03/10] cachefiles: Always indicate we should fill a post-EOF page with zeros David Howells
2021-10-29 14:10 ` [PATCH v4 04/10] fscache: Implement a fallback I/O interface to replace the old API David Howells
2021-10-29 14:10 ` [PATCH v4 05/10] nfs: Move to using the alternate fallback fscache I/O API David Howells
2021-10-29 14:10 ` [PATCH v4 06/10] 9p: Convert to using the netfs helper lib to do reads and caching David Howells
2021-10-29 14:10 ` [PATCH v4 07/10] cifs: Move to using the alternate fallback fscache I/O API David Howells
2021-10-29 14:11 ` [PATCH v4 08/10] fscache: Remove the old " David Howells
2021-10-29 14:11 ` [PATCH v4 09/10] fscache: Remove stats that are no longer used David Howells
2021-10-29 14:11 ` [PATCH v4 10/10] fscache: Update the documentation to reflect I/O API changes David Howells
2021-10-29 16:49 ` [PATCH v4 00/10] fscache: Replace and remove old I/O API Linus Torvalds
2021-10-29 17:55 ` David Howells
2021-10-29 18:17   ` Linus Torvalds
2021-10-29 18:51   ` 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=163551656895.1877519.8303891885033763947.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=torvalds@linux-foundation.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.