Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/puffs/mount_9p mount_9p: fix writing to a file open...
details: https://anonhg.NetBSD.org/src/rev/89f70d3df0b8
branches: trunk
changeset: 362480:89f70d3df0b8
user: ozaki-r <ozaki-r%NetBSD.org@localhost>
date: Wed Mar 02 04:11:41 2022 +0000
description:
mount_9p: fix writing to a file opened with write-only mode
With the page cache, writing data to a file may demand to read contents
from a storage to fill a page in the page cache first.
Opening a file with write-only mode by a user lets a mount_9p process
open a file with write-only mode too at a 9p server. Thus, a read
request to the file from the page cache fails.
So we need to open a file always with read mode (internally) even if it
is opened with write-only mode by a user.
Note that the change doesn't mean that mount_9p allows users to read
contents from a file that is opened with write-only mode.
diffstat:
usr.sbin/puffs/mount_9p/node.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (27 lines):
diff -r 9f0328bed080 -r 89f70d3df0b8 usr.sbin/puffs/mount_9p/node.c
--- a/usr.sbin/puffs/mount_9p/node.c Wed Mar 02 01:55:18 2022 +0000
+++ b/usr.sbin/puffs/mount_9p/node.c Wed Mar 02 04:11:41 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: node.c,v 1.29 2020/06/01 13:30:52 uwe Exp $ */
+/* $NetBSD: node.c,v 1.30 2022/03/02 04:11:41 ozaki-r Exp $ */
/*
* Copyright (c) 2007 Antti Kantee. All Rights Reserved.
@@ -27,7 +27,7 @@
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: node.c,v 1.29 2020/06/01 13:30:52 uwe Exp $");
+__RCSID("$NetBSD: node.c,v 1.30 2022/03/02 04:11:41 ozaki-r Exp $");
#endif /* !lint */
#include <assert.h>
@@ -274,6 +274,8 @@
puffs_setback(pcc, PUFFS_SETBACK_INACT_N1);
if (pn->pn_va.va_type != VDIR) {
+ /* Always require read access for page cache */
+ mode |= FREAD;
if (mode & FREAD && p9n->fid_read == P9P_INVALFID) {
nfid = NEXTFID(p9p);
error = proto_cc_open(pu, p9n->fid_base, nfid,
Home |
Main Index |
Thread Index |
Old Index