[PATCH 06/13] fs: nfs: drop the write and truncate stubs
Sascha Hauer
s.hauer at pengutronix.de
Wed Nov 18 06:51:56 PST 2026
The NFS client can't write, but has write and truncate operations that
only return -ENOSYS. That makes it the only read-only file system that
fails to truncate a file with -ENOSYS rather than with -EROFS, which the
VFS returns when there is no truncate operation, e.g. when opening a file
with O_TRUNC:
open("/mnt/nfs/file", O_WRONLY | O_TRUNC) -> -ENOSYS
Drop both stubs. The VFS then fails writes with -EBADF and truncating
with -EROFS, like for other file systems that can't write.
Fixes: 9ede56ad24 ("fs: Add NFS support")
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
fs/nfs.c | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/fs/nfs.c b/fs/nfs.c
index 7a859a718b..496dd742ae 100644
--- a/fs/nfs.c
+++ b/fs/nfs.c
@@ -1245,11 +1245,6 @@ static void nfs_handler(void *ctx, char *p, unsigned len)
list_add_tail(&packet->list, &npriv->packets);
}
-static int nfs_truncate(struct file *f, loff_t size)
-{
- return -ENOSYS;
-}
-
static void nfs_do_close(struct file_priv *priv)
{
if (priv->fifo)
@@ -1386,11 +1381,6 @@ static int nfs_close(struct inode *inode, struct file *file)
return 0;
}
-static int nfs_write(struct file *file, const void *inbuf, size_t insize)
-{
- return -ENOSYS;
-}
-
static int nfs_read(struct file *file, void *buf, size_t insize)
{
struct file_priv *priv = file->private_data;
@@ -1543,8 +1533,6 @@ static const struct file_operations nfs_file_operations = {
.release = nfs_close,
.read = nfs_read,
.lseek = nfs_lseek,
- .write = nfs_write,
- .truncate = nfs_truncate,
};
static const struct inode_operations nfs_symlink_inode_operations = {
.get_link = nfs_get_link,
--
2.47.3
More information about the barebox
mailing list