With ceph, if we don't have appropriate caps, then it's best to give up on doing any readahead. Add a mechanism to allow its init_rreq op to indicate that. Signed-off-by: Jeff Layton <jlayton@xxxxxxxxxx> --- fs/netfs/read_helper.c | 5 +++++ include/linux/netfs.h | 1 + 2 files changed, 6 insertions(+) diff --git a/fs/netfs/read_helper.c b/fs/netfs/read_helper.c index d7129d2229e2..3f1a503d81b4 100644 --- a/fs/netfs/read_helper.c +++ b/fs/netfs/read_helper.c @@ -925,6 +925,8 @@ void netfs_readahead(struct readahead_control *ractl) readahead_length(ractl), true); if (!rreq) return; + if (test_bit(NETFS_RREQ_DENY_READAHEAD, &rreq->flags)) + goto cleanup_free; ret = netfs_begin_cache_operation(rreq, ctx); if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS) @@ -989,6 +991,7 @@ int netfs_readpage(struct file *file, struct page *subpage) folio_size(folio), false); if (!rreq) goto nomem; + WARN_ON_ONCE(test_bit(NETFS_RREQ_DENY_READAHEAD, &rreq->flags)); ret = netfs_begin_cache_operation(rreq, ctx); if (ret == -ENOMEM || ret == -EINTR || ret == -ERESTARTSYS) { @@ -1179,6 +1182,7 @@ int netfs_write_begin(struct file *file, struct address_space *mapping, folio_size(folio), false); if (!rreq) goto error; + WARN_ON_ONCE(test_bit(NETFS_RREQ_DENY_READAHEAD, &rreq->flags)); rreq->start = folio_file_pos(folio); rreq->len = folio_size(folio); rreq->no_unlock_folio = folio_index(folio); @@ -1288,6 +1292,7 @@ int netfs_prefetch_for_write(struct file *file, struct folio *folio, if (!rreq) goto error; + WARN_ON_ONCE(test_bit(NETFS_RREQ_DENY_READAHEAD, &rreq->flags)); rreq->no_unlock_folio = folio_index(folio); __set_bit(NETFS_RREQ_NO_UNLOCK_FOLIO, &rreq->flags); ret = netfs_begin_cache_operation(rreq, ctx); diff --git a/include/linux/netfs.h b/include/linux/netfs.h index 8361db18d572..3bf1854e511d 100644 --- a/include/linux/netfs.h +++ b/include/linux/netfs.h @@ -209,6 +209,7 @@ struct netfs_read_request { #define NETFS_RREQ_IN_PROGRESS 5 /* Unlocked when the request completes */ #define NETFS_RREQ_DECRYPT 6 /* Decrypted when the request completes */ #define NETFS_RREQ_READAHEAD 7 /* This is a readahead op */ +#define NETFS_RREQ_DENY_READAHEAD 8 /* Abort the readahead */ const struct netfs_request_ops *netfs_ops; }; -- 2.31.1 -- Linux-cachefs mailing list Linux-cachefs@xxxxxxxxxx https://listman.redhat.com/mailman/listinfo/linux-cachefs