9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Amol Dixit <amold@vmware.com>
To: "9fans@9fans.net" <9fans@9fans.net>
Subject: [9fans] Duplicate fids on 9p server
Date: Sun, 19 Jan 2014 22:49:16 -0800	[thread overview]
Message-ID: <A5FB0A5F-01F4-4A75-AA56-E505E908B3A8@vmware.com> (raw)

Hi,
I am pretty new to 9P and I was attempting to write a basic file server for 9P clients. 
I am using 9pfuse on the client end to connect to my server. I have a question about *fid* alloction on the server.

In the sample server implementation of plan9port lib9p/{ramfs.c, srv.c} … the server code returns Edupfid if a particular fid is already used (due to attach, walk, open etc). 
So for a single client, the server works just fine — fids are allocated in order 0, 1, 2… etc.
If the second client using 9pfuse tries to attach to this server it will request the same sequence of fids 0, 1, 2… and so on. The server code will immediately reject these requests with Edupfid if those fids are currently in use. 

I first assumed the client will correct itself and retry the same request with a new fid. On more thought I realized that the server should be the one differentiating between the clients even if they request the same fids for attach/open/walk etc. Am I right in this assumption? Basically the server should create new internal fids with ClientID+FID to point to the *same* file and maintain that mapping….so that all clients (9pfuse based in this case) still see its sequence (0, 1, 2…), but the server internally maps them to a different IDs pointing to the same file.

Hope above question makes sense.

Thanks in advance,
Amol


             reply	other threads:[~2014-01-20  6:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-20  6:49 Amol Dixit [this message]
2014-01-20 11:37 ` Charles Forsyth
2014-01-21 23:00 ` Amol Dixit
2014-01-21 23:14   ` Charles Forsyth

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=A5FB0A5F-01F4-4A75-AA56-E505E908B3A8@vmware.com \
    --to=amold@vmware.com \
    --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).