9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* Re: [9fans] 9vx and create (...DMEXCL)
       [not found] <<bcba51a0912211848n63cca76es7a2a42993f3635bd@mail.gmail.com>
@ 2009-12-22  3:27 ` erik quanstrom
  2009-12-22  9:51   ` Charles Forsyth
  2009-12-22 15:44   ` Dmitry Golubovsky
  0 siblings, 2 replies; 6+ messages in thread
From: erik quanstrom @ 2009-12-22  3:27 UTC (permalink / raw)
  To: 9fans

> Is create (2) with DMEXCL mode supported under 9vx?

it seems you've already got the answer ...

> If 9vx maps Plan9 permissions directly to Linux permissions this is
> understandable. But is there any workaround?

it's up to the fileserver to implement DMEXCL, and #Z doesn't.
using a different fileserver (e.g. fossil or cwfs, ken's fs) would solve
the problem.  you could also modify ldevfs-posix.c to accept DMEXCL
and map that to O_EXCL|O_CREAT which may actually do the
right thing.

- erik



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

* Re: [9fans] 9vx and create (...DMEXCL)
  2009-12-22  3:27 ` [9fans] 9vx and create (...DMEXCL) erik quanstrom
@ 2009-12-22  9:51   ` Charles Forsyth
  2009-12-22 16:31     ` Russ Cox
  2009-12-22 15:44   ` Dmitry Golubovsky
  1 sibling, 1 reply; 6+ messages in thread
From: Charles Forsyth @ 2009-12-22  9:51 UTC (permalink / raw)
  To: 9fans

>you could also modify ldevfs-posix.c to accept DMEXCL
>and map that to O_EXCL|O_CREAT which may actually do the
>right thing.

no, it won't: OEXCL, perhaps, but not DMEXCL.
i'd have thought it should be used in fscreate, though,
to help chan.c implement OEXCL correctly. fscreate should
fail if the file exists, but perhaps that happens another way.



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

* Re: [9fans] 9vx and create (...DMEXCL)
  2009-12-22  3:27 ` [9fans] 9vx and create (...DMEXCL) erik quanstrom
  2009-12-22  9:51   ` Charles Forsyth
@ 2009-12-22 15:44   ` Dmitry Golubovsky
  1 sibling, 0 replies; 6+ messages in thread
From: Dmitry Golubovsky @ 2009-12-22 15:44 UTC (permalink / raw)
  To: 9fans

Hi,

OK, thanks for the clue.

Unfortunately, this (devfs-posix.c in 9vx):

	if(perm & ~(DMDIR|0777))
		error(Ebadarg);

generates the error, and the values of DMEXCL and DMAPPEND do not seem
to fit into Unix permissions. So these won't work in 9vx as long as
the host filesystem is used*.

------------------------------------------------
* Unless the host FS is ext?fs and the kernel supports extended
attributes which may require specific patches

On Dec 22, 4:50 am, fors...@terzarima.net (Charles Forsyth) wrote:

> no, it won't: OEXCL, perhaps, but not DMEXCL.
> i'd have thought it should be used in fscreate, though,
> to help chan.c implement OEXCL correctly. fscreate should
> fail if the file exists, but perhaps that happens another way.

Dmitry.



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

* Re: [9fans] 9vx and create (...DMEXCL)
  2009-12-22  9:51   ` Charles Forsyth
@ 2009-12-22 16:31     ` Russ Cox
  0 siblings, 0 replies; 6+ messages in thread
From: Russ Cox @ 2009-12-22 16:31 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

> no, it won't: OEXCL, perhaps, but not DMEXCL.
> i'd have thought it should be used in fscreate, though,
> to help chan.c implement OEXCL correctly. fscreate should
> fail if the file exists, but perhaps that happens another way.

yes, there's a bug.
fscreate should or in O_EXCL unconditionally here
to implement the correct 9p create semantics:

		if((fd = open(path, mm|O_CREAT, 0666)) < 0)
			oserror();

the or'ing in is unconditional because create(5)
always fails when the target already exists.
the OEXCL in create(2) is a kernel-only flag
(not part of 9p), like OCEXEC.

russ


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

* Re: [9fans] 9vx and create (...DMEXCL)
       [not found] <<1c5f6c9c85185a32b8833d01de47e34d@terzarima.net>
@ 2009-12-22 14:19 ` erik quanstrom
  0 siblings, 0 replies; 6+ messages in thread
From: erik quanstrom @ 2009-12-22 14:19 UTC (permalink / raw)
  To: 9fans

> i'd have thought it should be used in fscreate, though,
> to help chan.c implement OEXCL correctly. fscreate should
> fail if the file exists, but perhaps that happens another way.

it already fail on unexpected bits.  DMEXCL is unexpected.

- erik



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

* [9fans] 9vx and create (...DMEXCL)
@ 2009-12-22  2:48 Dimitry Golubovsky
  0 siblings, 0 replies; 6+ messages in thread
From: Dimitry Golubovsky @ 2009-12-22  2:48 UTC (permalink / raw)
  To: 9fans

Hi,

Is create (2) with DMEXCL mode supported under 9vx?

I am trying to run webcookie, and am getting the following:


term% webcookies
webcookies: readjar: cannot acquire jar lock:
'/usr/dima/lib/L.webcookies' bad arg in system call
term%

coming likely from this code in webcookies.c:

=============================================

	for(i=0; i<50; i++){
		if((fd = create(jar->lockfile, OWRITE, DMEXCL|0666)) < 0){
			sleep(100);
			continue;
		}
		break;
	}
	if(fd < 0){
		if(debug)
			fprint(2, "open %s: %r", jar->lockfile);
		werrstr("cannot acquire jar lock: %r");
		return -1;
	}

=============================================

If 9vx maps Plan9 permissions directly to Linux permissions this is
understandable. But is there any workaround?

Thanks.


--
Dimitry Golubovsky

Anywhere on the Web



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

end of thread, other threads:[~2009-12-22 16:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <<bcba51a0912211848n63cca76es7a2a42993f3635bd@mail.gmail.com>
2009-12-22  3:27 ` [9fans] 9vx and create (...DMEXCL) erik quanstrom
2009-12-22  9:51   ` Charles Forsyth
2009-12-22 16:31     ` Russ Cox
2009-12-22 15:44   ` Dmitry Golubovsky
     [not found] <<1c5f6c9c85185a32b8833d01de47e34d@terzarima.net>
2009-12-22 14:19 ` erik quanstrom
2009-12-22  2:48 Dimitry Golubovsky

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