9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] v9fs/fossil oddity
@ 2008-05-08 17:56 Brian L. Stuart
  2008-05-08 18:05 ` Eric Van Hensbergen
  0 siblings, 1 reply; 4+ messages in thread
From: Brian L. Stuart @ 2008-05-08 17:56 UTC (permalink / raw)
  To: 9fans

I've found something that looks odd in the way v9fs
under Linux interacts with a fossil running on Plan 9.
If I create a file by redirecting output, the shell
seems able to happily create the file.  If I try to
cp a file, then it fails.  The logs show the error
"unknown mode."  As near as I can tell, here's what's
happening:

- cp creates the file with the O_EXCL flag.
- v9fs_uflags2mode() sets the P9_OEXCL flag.
- v9fs defines P9_OEXCL to be 4, where
  /sys/include/libc.h defines OEXCL to be 0x1000
- fossil masks the mode it gets with 7,
  keeping the P9_OEXCL flag.
- When fossil checks for the allowed modes, it
  does so with strict equalities that don't
  include bit 2 (the P9_OEXCL flag).  So none
  of them match, and we get an unknown mode.

At first glance, it would appear that there are two
bugs.  v9fs shouldn't define P9_OEXCL to be 4,
but to be 0x1000.  Second the OMODE mask in
/sys/src/cmd/fossil/9p.c should be 3 and not 7
so that we are only looking at the read and
write flags when doing the comparisons.

Am I missing something here?  Is there a reason
these are what they are?  If they've been identified
and fixed already, I apologize for the noise.

BLS



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] v9fs/fossil oddity
  2008-05-08 17:56 [9fans] v9fs/fossil oddity Brian L. Stuart
@ 2008-05-08 18:05 ` Eric Van Hensbergen
  2008-05-08 18:13   ` Brian L. Stuart
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Van Hensbergen @ 2008-05-08 18:05 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

On Thu, May 8, 2008 at 12:56 PM, Brian L. Stuart <blstuart@bellsouth.net> wrote:
> I've found something that looks odd in the way v9fs
>  under Linux interacts with a fossil running on Plan 9.
>  If I create a file by redirecting output, the shell
>  seems able to happily create the file.  If I try to
>  cp a file, then it fails.  The logs show the error
>  "unknown mode."  As near as I can tell, here's what's
>  happening:
>
>  - cp creates the file with the O_EXCL flag.
>  - v9fs_uflags2mode() sets the P9_OEXCL flag.
>  - v9fs defines P9_OEXCL to be 4, where
>   /sys/include/libc.h defines OEXCL to be 0x1000

Which version of v9fs are you using: (this is the current version on my tree:)
ericvh@ericvh-desktop:~/src/linux/9p/include/net/9p$ grep P9_OEXCL *
9p.h: * @P9_OEXCL: only create a file, do not open it
9p.h:	P9_OEXCL = 0x1000,

         -eric



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] v9fs/fossil oddity
  2008-05-08 18:05 ` Eric Van Hensbergen
@ 2008-05-08 18:13   ` Brian L. Stuart
  2008-05-08 18:27     ` Brian L. Stuart
  0 siblings, 1 reply; 4+ messages in thread
From: Brian L. Stuart @ 2008-05-08 18:13 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs


-------------- Original message ----------------------
From: "Eric Van Hensbergen" <ericvh@gmail.com>
>
> On Thu, May 8, 2008 at 12:56 PM, Brian L. Stuart <blstuart@bellsouth.net> wrote:
> >  - v9fs defines P9_OEXCL to be 4, where
> >   /sys/include/libc.h defines OEXCL to be 0x1000
>
> Which version of v9fs are you using: (this is the current version on my tree:)
> ericvh@ericvh-desktop:~/src/linux/9p/include/net/9p$ grep P9_OEXCL *
> 9p.h: * @P9_OEXCL: only create a file, do not open it
> 9p.h:	P9_OEXCL = 0x1000,

I must be using an older version then.  I'm using the one
in the 2.6.24 kernel source tree.  I'll change my copy
to match, and I expect that'll make it work at least.

BLS





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [9fans] v9fs/fossil oddity
  2008-05-08 18:13   ` Brian L. Stuart
@ 2008-05-08 18:27     ` Brian L. Stuart
  0 siblings, 0 replies; 4+ messages in thread
From: Brian L. Stuart @ 2008-05-08 18:27 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

From: "Brian L. Stuart" <blstuart@bellsouth.net>
> From: "Eric Van Hensbergen" <ericvh@gmail.com>
> > On Thu, May 8, 2008 at 12:56 PM, Brian L. Stuart <blstuart@bellsouth.net>
> wrote:
> > >  - v9fs defines P9_OEXCL to be 4, where
> > >   /sys/include/libc.h defines OEXCL to be 0x1000
> >
> > Which version of v9fs are you using: (this is the current version on my tree:)
> > ericvh@ericvh-desktop:~/src/linux/9p/include/net/9p$ grep P9_OEXCL *
> > 9p.h: * @P9_OEXCL: only create a file, do not open it
> > 9p.h:	P9_OEXCL = 0x1000,
>
> I must be using an older version then.  I'm using the one
> in the 2.6.24 kernel source tree.  I'll change my copy
> to match, and I expect that'll make it work at least.

Yep, that made it happy.  I'm still wondering if OMODE
in fossil/9p.c should be 3 instead of 7, though.

BLS




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-08 18:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-05-08 17:56 [9fans] v9fs/fossil oddity Brian L. Stuart
2008-05-08 18:05 ` Eric Van Hensbergen
2008-05-08 18:13   ` Brian L. Stuart
2008-05-08 18:27     ` Brian L. Stuart

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).