9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] 9pserve question
@ 2005-12-03  3:13 erik quanstrom
  2005-12-03 14:26 ` Russ Cox
  0 siblings, 1 reply; 7+ messages in thread
From: erik quanstrom @ 2005-12-03  3:13 UTC (permalink / raw)
  To: 9fans

why does 9pserve.c:451 

		case Topenfd:
			if(m->tx.mode&~(OTRUNC|3)){
				err(m, "bad openfd mode");
				continue;
			}

dissallow OTRUNC?  this means that

; mount $home/9/upasfs
; echo delete mbox 24 > $home/9/upasfs/ctl

and

; mount $home/9/factotum
; echo delkey > $home/9/factotum/ctl

don't work. you need to replace '>' with '>>'. 

- erik


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

* Re: [9fans] 9pserve question
  2005-12-03  3:13 [9fans] 9pserve question erik quanstrom
@ 2005-12-03 14:26 ` Russ Cox
  2005-12-03 14:35   ` erik quanstrom
  2005-12-03 14:54   ` erik quanstrom
  0 siblings, 2 replies; 7+ messages in thread
From: Russ Cox @ 2005-12-03 14:26 UTC (permalink / raw)
  To: quanstro, Fans of the OS Plan 9 from Bell Labs

> why does 9pserve.c:451
>
>                 case Topenfd:
>                         if(m->tx.mode&~(OTRUNC|3)){
>                                 err(m, "bad openfd mode");
>                                 continue;
>                         }
>
> dissallow OTRUNC?

Because it doesn't make sense.  Trust me on this.
That's case Topenfd not case Topen.  See the
description of openfd in the 9pclient(3) man page.

Topenfd is a special message only recognized by
9pserve and only emitted by the 9pclient library.
It's not used by anything else.

> this means that
>
> ; mount $home/9/upasfs
> ; echo delete mbox 24 > $home/9/upasfs/ctl
>
> and
>
> ; mount $home/9/factotum
> ; echo delkey > $home/9/factotum/ctl
>
> don't work. you need to replace '>' with '>>'.

I can't imagine why mounting (presumably this is Linux)
would cause the kernel to issue Topenfds.  Your
problem is probably elsewhere.  Perhaps the v9fs
module is sending a Tcreate and then when that fails
not trying a Topen OTRUNC as a fallback.

If you set verbose9pserve=1 in your environment
before starting one of these programs, then you can
see the messages going in and out.

Russ


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

* Re: [9fans] 9pserve question
  2005-12-03 14:26 ` Russ Cox
@ 2005-12-03 14:35   ` erik quanstrom
  2005-12-03 14:54   ` erik quanstrom
  1 sibling, 0 replies; 7+ messages in thread
From: erik quanstrom @ 2005-12-03 14:35 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, Russ Cox

for echo delete mbox 1 > ctl 
i get this:


upas/fs:<-Twstat tag 1 fid 18 stat '' '' '' '' q (ffffffffffffffff 4294967295 dalA) m 037777777777 at -1 mt -1 l 0 t 65535 d -1
upas/fs:->Rerror tag 1 ename permission denied

Russ Cox <rsc@swtch.com> writes

| I can't imagine why mounting (presumably this is Linux)
| would cause the kernel to issue Topenfds.  Your
| problem is probably elsewhere.  Perhaps the v9fs
| module is sending a Tcreate and then when that fails
| not trying a Topen OTRUNC as a fallback.
| 
| If you set verbose9pserve=1 in your environment
| before starting one of these programs, then you can
| see the messages going in and out.
| 
| Russ


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

* Re: [9fans] 9pserve question
  2005-12-03 14:26 ` Russ Cox
  2005-12-03 14:35   ` erik quanstrom
@ 2005-12-03 14:54   ` erik quanstrom
  2005-12-03 15:53     ` erik quanstrom
       [not found]     ` <6114CFD8-C785-425A-AEDB-5397D83E069C@cibernet.com>
  1 sibling, 2 replies; 7+ messages in thread
From: erik quanstrom @ 2005-12-03 14:54 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs, Russ Cox

here's a better trace.

echo delete mbox 17 >> ctl

upas/fs:<-Twalk tag 1 fid 0 newfid 18 nwname 1 0:ctl 
upas/fs:->Rwalk tag 1 nwqid 1 0:(000000000000001d 0 ) 
upas/fs:<-Tstat tag 1 fid 18
upas/fs:->Rstat tag 1  stat 'ctl' 'quanstro' 'quanstro' 'quanstro' q (000000000000001d 0 ) m 0666 at 1133621086 mt 1133621086 l 0 t 0 d 0
upas/fs:<-Twalk tag 1 fid 18 newfid 63 nwname 0 
upas/fs:->Rwalk tag 1 nwqid 0 
upas/fs:<-Topen tag 1 fid 63 mode 1
upas/fs:->Ropen tag 1 qid (000000000000001d 0 ) iounit 0
upas/fs:<-Twrite tag 1 fid 63 offset 0 count 15 '64656c65 7465206d 626f7820 31370a'
upas/fs:->Rwrite tag 1 count 15
upas/fs:<-Tclunk tag 1 fid 63
upas/fs:->Rclunk tag 1
upas/fs:<-Tclunk tag 1 fid 18
upas/fs:->Rclunk tag 1

echo delete mbox 17 > ctl

upas/fs:<-Twalk tag 1 fid 0 newfid 18 nwname 1 0:ctl 
upas/fs:->Rwalk tag 1 nwqid 1 0:(000000000000001d 0 ) 
upas/fs:<-Tstat tag 1 fid 18
upas/fs:->Rstat tag 1  stat 'ctl' 'quanstro' 'quanstro' 'quanstro' q (000000000000001d 0 ) m 0666 at 1133621176 mt 1133621176 l 0 t 0 d 0
upas/fs:<-Twstat tag 1 fid 18 stat '' '' '' '' q (ffffffffffffffff 4294967295 dalA) m 037777777777 at -1 mt -1 l 0 t 65535 d -1
upas/fs:->Rerror tag 1 ename permission denied


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

* Re: [9fans] 9pserve question
  2005-12-03 14:54   ` erik quanstrom
@ 2005-12-03 15:53     ` erik quanstrom
       [not found]     ` <6114CFD8-C785-425A-AEDB-5397D83E069C@cibernet.com>
  1 sibling, 0 replies; 7+ messages in thread
From: erik quanstrom @ 2005-12-03 15:53 UTC (permalink / raw)
  To: 9fans, erik quanstrom, Russ Cox

and a quick fix. it's choking on the Wstat message.

; rcsdiff fs.c
===================================================================
RCS file: RCS/fs.c,v
retrieving revision 1.1
diff -r1.1 fs.c
1122c1122,1123
< 	return Eperm;
---
> 	// ya, yokay.
> 	return nil;
1171,1182d1171

erik quanstrom <quanstro@quanstro.net> writes

| 
| here's a better trace.
| 
| echo delete mbox 17 >> ctl
| [etc]


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

* Re: [9fans] 9pserve question
       [not found]     ` <6114CFD8-C785-425A-AEDB-5397D83E069C@cibernet.com>
@ 2005-12-03 17:00       ` erik quanstrom
  2005-12-03 17:03       ` erik quanstrom
  1 sibling, 0 replies; 7+ messages in thread
From: erik quanstrom @ 2005-12-03 17:00 UTC (permalink / raw)
  To: Michael Baldwin

good question.

i believe that this is the problem -- and it's not specific to the linux
9p "filesystem. fs/namei.c has this function which is called when trying
to open a file:

i didn't follow up on what put_write_access() does but i'm betting that
that generates the wstat.

  1324	int may_open(struct nameidata *nd, int acc_mode, int flag)
  1325	{
[...]
  1379		if (flag & O_TRUNC) {
  1380			error = get_write_access(inode);
  1381			if (error)
  1382				return error;
  1383	
  1384			/*
  1385			 * Refuse to truncate files with mandatory locks held on them.
  1386			 */
  1387			error = locks_verify_locked(inode);
  1388			if (!error) {
  1389				DQUOT_INIT(inode);
  1390				
  1391				error = do_truncate(dentry, 0);
  1392			}
  1393			put_write_access(inode);
  1394			if (error)
  1395				return error;
[...]

- erik

Michael Baldwin <michael@cibernet.com> writes

| 
| why is it doing Tstat and Twstat at all?   i would have thought it  
| would be Twalk, Topen, Twrite.
| 


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

* Re: [9fans] 9pserve question
       [not found]     ` <6114CFD8-C785-425A-AEDB-5397D83E069C@cibernet.com>
  2005-12-03 17:00       ` erik quanstrom
@ 2005-12-03 17:03       ` erik quanstrom
  1 sibling, 0 replies; 7+ messages in thread
From: erik quanstrom @ 2005-12-03 17:03 UTC (permalink / raw)
  To: Michael Baldwin, 9fans

good question.

i believe that this is the problem -- and it's not specific to the linux
9p "filesystem. fs/namei.c has this function which is called when trying
to open a file:

i didn't follow up on what put_write_access() does but i'm betting that
that generates the wstat.

  1324	int may_open(struct nameidata *nd, int acc_mode, int flag)
  1325	{
[...]
  1379		if (flag & O_TRUNC) {
  1380			error = get_write_access(inode);
  1381			if (error)
  1382				return error;
  1383	
  1384			/*
  1385			 * Refuse to truncate files with mandatory locks held on them.
  1386			 */
  1387			error = locks_verify_locked(inode);
  1388			if (!error) {
  1389				DQUOT_INIT(inode);
  1390				
  1391				error = do_truncate(dentry, 0);
  1392			}
  1393			put_write_access(inode);
  1394			if (error)
  1395				return error;
[...]

- erik

Michael Baldwin <michael@cibernet.com> writes

| 
| why is it doing Tstat and Twstat at all?   i would have thought it  
| would be Twalk, Topen, Twrite.


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

end of thread, other threads:[~2005-12-03 17:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-12-03  3:13 [9fans] 9pserve question erik quanstrom
2005-12-03 14:26 ` Russ Cox
2005-12-03 14:35   ` erik quanstrom
2005-12-03 14:54   ` erik quanstrom
2005-12-03 15:53     ` erik quanstrom
     [not found]     ` <6114CFD8-C785-425A-AEDB-5397D83E069C@cibernet.com>
2005-12-03 17:00       ` erik quanstrom
2005-12-03 17:03       ` erik quanstrom

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).