9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: smiley@icebubble.org
To: Fans of the OS Plan 9 from Bell Labs <9fans@9fans.net>
Subject: [9fans] p9p vac/vacfs compatibility: uid/gid, ctime, 9P2000.L, 9pserve
Date: Wed, 28 Dec 2011 21:48:46 +0000	[thread overview]
Message-ID: <86zkecbc5d.fsf@cmarib.ramside> (raw)

Hello,

I'm trying to use vac/vacfs on p9p, using the Linux v9fs driver (-t 9p)
with unix domain sockets as transport (-o trans=unix).  And I'm
confused.  :(

When I mount the file system, all the files are owned by uid = gid = (-2
mod 2^32), unless I tell the Linux kernel to mount the fs as a specific
user/group.  In the latter case, all files present with the specified
user/group (as expected).  I can't find any way to get at the actual
uid/gids owning the files/directories vac'd.  I have tried explicitly
specifying -o version=9p2000.u, but it exhibits the same symptoms: all
files and directories appear to be owned by uid = gid = (-2 mod 2^32).
All uids/gids in the vac'd tree existed in /etc/{passwd,group} at the
time of vac'ing, as well as at mount time.

So, I took a little looksie in /usr/lib/plan9/src/cmd/vac/...

----------------------------------------------------------------
/usr/lib/plan9/src/cmd/vac/vac.c:48
#ifdef PLAN9PORT
/*
 * We're between a rock and a hard place here.
 * The pw library (getpwnam, etc.) reads the
 * password and group files into an on-stack buffer,
 * so if you have some huge groups, you overflow
 * the stack.  Because of this, the thread library turns
 * it off by default, so that dirstat returns "14571" instead of "rsc".
 * But for vac we want names.  So cautiously turn the pwlibrary
 * back on (see threadmain) and make the main thread stack huge.
 */
extern int _p9usepwlibrary;
int mainstacksize = 4*1024*1024;

#endif

----------------------------------------------------------------
/usr/lib/plan9/src/cmd/vac/vac.c:399
	vd->uid = dir->uid;
	vd->gid = dir->gid;
	vd->mid = dir->muid;

----------------------------------------------------------------
So, the source *appears* to stow uid/gid to venti as character strings.

BTW,

----------------------------------------------------------------
/usr/lib/plan9/src/cmd/vac/vac.c:406
	vd->ctime = dir->mtime;		/* ctime: not available on plan 9 */


----------------------------------------------------------------
Does this mean that vac doesn't store ctimes on p9p?  Shouldn't this be
wrapped in something like:

----------------------------------------------------------------
#ifdef PLAN9PORT
	vd->ctime = dir->ctime;		/* ctime: available on p9p */
#else
	vd->ctime = dir->mtime;		/* ctime: not available on plan 9 */
#endif


----------------------------------------------------------------
Then, we have:
----------------------------------------------------------------
/usr/lib/plan9/src/cmd/vac/vacfs.c:696
	dir.atime = vd->atime;
	dir.mtime = vd->mtime;
	dir.length = vd->size;

	dir.name = vd->elem;
	dir.uid = vd->uid;
	dir.gid = vd->gid;
	dir.muid = vd->mid;
#ifdef PLAN9PORT
	dir.ext = ext;
	dir.uidnum = atoi(vd->uid);
	dir.gidnum = atoi(vd->gid);
#endif

----------------------------------------------------------------

Those dir.uidnum and dir.gidnum don't appear to be referenced anywhere
else in the code.  But it makes me wonder... are the character string
uid/gids vac'd the textual names from /etc/{passwd,group}, or just ASCII
versions of the numeric ids, a la format "%d"?

And just what is "9P2000.L", anyway?  I can't seem to find any
documentation on it.

Last, but not least, can anyone tell me why 9pserve is taking up so much
CPU time?  From the docs, it looks like 9pserve should just be muxing 9p
connections and passes messages around.  I had expected that disk
bandwith would be the bottleneck in my setup.  But, as it turns out, the
bottleneck is actually this little fellow, 9pserve.  I have no idea why
it's taking so much CPU to multiplex 9p, especially since there's only
one connection being "multiplexed"!  Is there any way to bypass 9pserve
(since I only need one connection for now), i.e., doing 9p on sockets or
shared file descriptors?

Thanks!
--
+---------------------------------------------------------------+
|Smiley       <smiley@icebubble.org>    PGP key ID:    BC549F8B |
|Fingerprint: 9329 DB4A 30F5 6EDA D2BA  3489 DAB7 555A BC54 9F8B|
+---------------------------------------------------------------+



             reply	other threads:[~2011-12-28 21:48 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-28 21:48 smiley [this message]
2011-12-28 23:48 ` David du Colombier
2011-12-29 16:20   ` smiley
2011-12-29 17:34     ` David du Colombier
2011-12-30 16:59   ` Latchesar Ionkov
2011-12-30 17:15     ` David du Colombier
2012-01-02  6:50       ` smiley
2012-01-02 12:31         ` David du Colombier
2012-01-02 13:50         ` David du Colombier
2012-01-02 18:04           ` smiley
2012-01-02 19:14             ` David du Colombier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86zkecbc5d.fsf@cmarib.ramside \
    --to=smiley@icebubble.org \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).