Question Regarding Optional ->prepare_read Callback in NETFS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Dear NETFS Developers,

I am writing to clarify whether the ->prepare_read callback can be
NULL for a backing filesystem that does not supply it. In particular,
should we assume that the pointer may be NULL and thus require an
explicit check before invoking it?

For context, commit 904abff4b1b9 ("netfs: Fix read-retry for fs with
no ->prepare_read()") introduced a similar check in the read-retry
path. I am proposing that we apply the same consideration to the code
in netfs_single_cache_prepare_read. Here is the relevant patch snippet
for reference:

 fs/netfs/read_single.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/netfs/read_single.c b/fs/netfs/read_single.c
index fea0ecdecc53..68a5ff1c3d06 100644
--- a/fs/netfs/read_single.c
+++ b/fs/netfs/read_single.c
@@ -63,7 +63,7 @@ static void netfs_single_cache_prepare_read(struct
netfs_io_request *rreq,
 {
  struct netfs_cache_resources *cres = &rreq->cache_resources;

- if (!cres->ops) {
+ if (!cres->ops || !cres->ops->prepare_read) {
  subreq->source = NETFS_DOWNLOAD_FROM_SERVER;
  return;
  }

Could you please confirm if this is the intended design, or if any
adjustments are needed?

Thank you for your time and assistance.

Best regards,
Chenyuan




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux