Thread (23 messages) 23 messages, 5 authors, 2023-02-23
STALE1243d

[PATCH v2 18/18] NFS: Remove unnecessary check in nfs_read_folio()

From: trondmy@kernel.org
Date: 2023-01-19 22:03:22
Subsystem: filesystems (vfs and infrastructure), nfs, sunrpc, and lockd clients, the rest · Maintainers: Alexander Viro, Christian Brauner, Trond Myklebust, Anna Schumaker, Linus Torvalds

From: Trond Myklebust <redacted>

All the callers are expected to supply a valid struct file argument, so
there is no need for the NULL check.

Reported-by: kernel test robot <redacted>
Reported-by: Dan Carpenter <redacted>
Signed-off-by: Trond Myklebust <redacted>
---
 fs/nfs/read.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index bf4154f9b48c..c380cff4108e 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -355,13 +355,7 @@ int nfs_read_folio(struct file *file, struct folio *folio)
 	if (NFS_STALE(inode))
 		goto out_unlock;
 
-	if (file == NULL) {
-		ret = -EBADF;
-		desc.ctx = nfs_find_open_context(inode, NULL, FMODE_READ);
-		if (desc.ctx == NULL)
-			goto out_unlock;
-	} else
-		desc.ctx = get_nfs_open_context(nfs_file_open_context(file));
+	desc.ctx = get_nfs_open_context(nfs_file_open_context(file));
 
 	xchg(&desc.ctx->error, 0);
 	nfs_pageio_init_read(&desc.pgio, inode, false,
-- 
2.39.0
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help