From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37382) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOTdT-00034l-0W for qemu-devel@nongnu.org; Mon, 23 May 2011 07:49:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QOTdR-00021D-S2 for qemu-devel@nongnu.org; Mon, 23 May 2011 07:49:22 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:50679) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QOTdR-00020Z-8E for qemu-devel@nongnu.org; Mon, 23 May 2011 07:49:21 -0400 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp05.in.ibm.com (8.14.4/8.13.1) with ESMTP id p4NBnFQW031538 for ; Mon, 23 May 2011 17:19:15 +0530 Received: from d28av01.in.ibm.com (d28av01.in.ibm.com [9.184.220.63]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id p4NBnEM93121260 for ; Mon, 23 May 2011 17:19:14 +0530 Received: from d28av01.in.ibm.com (loopback [127.0.0.1]) by d28av01.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id p4NBnCtI006165 for ; Mon, 23 May 2011 17:19:13 +0530 Date: Mon, 23 May 2011 17:19:12 +0530 From: "M. Mohan Kumar" Message-ID: <20110523114912.GA26653@in.ibm.com> References: <1306137482-1133-1-git-send-email-mohan@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [RFC/PATCH] virtio-9p: Add Read only support for 9p export. Reply-To: mohan@in.ibm.com List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: rlandley@parallels.com, qemu-devel@nongnu.org On Mon, May 23, 2011 at 11:08:34AM +0100, Stefan Hajnoczi wrote: > On Mon, May 23, 2011 at 8:58 AM, M. Mohan Kumar wrot= e: > > A new fsdev parameter "access" is introduced to control accessing 9p = export. > > access=3Dro|rw can be used to specify the access type. By default rw = access > > is given to 9p export. >=20 > It would be consistent with -drive to use readonly=3Don|off (default: > off). Do you have any future access modes in mind that require more > than readonly on|off? You mean to use 'readonly=3Don|off' instead of 'access=3Dro|rw' ? >=20 > It seems the client does not know ahead of time that the mount is > read-only. I wonder if this exposes any weirdness compared to > actually mounting ro on the client side (i.e. operations that appear > to start okay but then fail with -EROFS at a different point than if > you had mounted ro)? It could cause apps to error in new ways. >=20 When a NFS share is exported as read-only, client will come to know about that when it does some write operation. IMHO its not an issue. > > +static inline int is_ro_export(FsContext *fs_ctx) > > +{ > > + =A0 =A0 =A0 =A0if (fs_ctx->flags & FS_RDONLY) { > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0return 1; > > + =A0 =A0 =A0 =A0} > > + =A0 =A0 =A0 =A0return 0; > > +} >=20 > Please use bool and fix indentation: Ok >=20 > static inline bool is_ro_export(FsContext *fs_ctx) > { > return fs_ctx->flags & FS_RDONLY; > } >=20 > > + > > =A0static void v9fs_version(V9fsState *s, V9fsPDU *pdu) > > =A0{ > > =A0 =A0 V9fsString version; > > @@ -1734,6 +1742,13 @@ static void v9fs_open_post_lstat(V9fsState *s,= V9fsOpenState *vs, int err) > > =A0 =A0 =A0 =A0 vs->fidp->fs.dir =3D v9fs_do_opendir(s, &vs->fidp->pa= th); > > =A0 =A0 =A0 =A0 v9fs_open_post_opendir(s, vs, err); > > =A0 =A0 } else { > > + =A0 =A0 =A0 =A0if (is_ro_export(&s->ctx)) { > > + =A0 =A0 =A0 =A0 =A0 =A0if (vs->mode & O_WRONLY || vs->mode & O_RDWR= || > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0vs->mode & O= _APPEND) { > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0err =3D -EROFS; > > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto out; > > + =A0 =A0 =A0 =A0 =A0 =A0} > > + =A0 =A0 =A0 =A0} > > =A0 =A0 =A0 =A0 if (s->proto_version =3D=3D V9FS_PROTO_2000L) { > > =A0 =A0 =A0 =A0 =A0 =A0 flags =3D vs->mode; > > =A0 =A0 =A0 =A0 =A0 =A0 flags &=3D ~(O_NOCTTY | O_ASYNC | O_CREAT); > > @@ -3606,6 +3621,33 @@ static pdu_handler_t *pdu_handlers[] =3D { > > =A0 =A0 [P9_TREMOVE] =3D v9fs_remove, > > =A0}; > > > > +static inline int is_read_only_op(int id) >=20 > bool Ok