aboutsummaryrefslogtreecommitdiffstats
path: root/fs/9p/vfs_inode.c
diff options
context:
space:
mode:
authorLatchesar Ionkov <lucho@ionkov.net>2007-10-17 15:31:07 -0400
committerEric Van Hensbergen <ericvh@ericvh-desktop.austin.ibm.com>2007-10-17 15:31:07 -0400
commitba17674fe02909fef049fd4b620a2805bdb8c693 (patch)
treefaa05f8705324ac0b70031dbfb08b65b1339391a /fs/9p/vfs_inode.c
parentbd32b82df9876af439f1760a599c0e2da9198bda (diff)
9p: attach-per-user
The 9P2000 protocol requires the authentication and permission checks to be done in the file server. For that reason every user that accesses the file server tree has to authenticate and attach to the server separately. Multiple users can share the same connection to the server. Currently v9fs does a single attach and executes all I/O operations as a single user. This makes using v9fs in multiuser environment unsafe as it depends on the client doing the permission checking. This patch improves the 9P2000 support by allowing every user to attach separately. The patch defines three modes of access (new mount option 'access'): - attach-per-user (access=user) (default mode for 9P2000.u) If a user tries to access a file served by v9fs for the first time, v9fs sends an attach command to the server (Tattach) specifying the user. If the attach succeeds, the user can access the v9fs tree. As there is no uname->uid (string->integer) mapping yet, this mode works only with the 9P2000.u dialect. - allow only one user to access the tree (access=<uid>) Only the user with uid can access the v9fs tree. Other users that attempt to access it will get EPERM error. - do all operations as a single user (access=any) (default for 9P2000) V9fs does a single attach and all operations are done as a single user. If this mode is selected, the v9fs behavior is identical with the current one. Signed-off-by: Latchesar Ionkov <lucho@ionkov.net> Signed-off-by: Eric Van Hensbergen <ericvh@gmail.com>
Diffstat (limited to 'fs/9p/vfs_inode.c')
-rw-r--r--fs/9p/vfs_inode.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c
index f08a35d2973a..175b4d9bf3f8 100644
--- a/fs/9p/vfs_inode.c
+++ b/fs/9p/vfs_inode.c
@@ -364,7 +364,7 @@ static int v9fs_remove(struct inode *dir, struct dentry *file, int rmdir)
364 file_inode = file->d_inode; 364 file_inode = file->d_inode;
365 v9ses = v9fs_inode2v9ses(file_inode); 365 v9ses = v9fs_inode2v9ses(file_inode);
366 v9fid = v9fs_fid_clone(file); 366 v9fid = v9fs_fid_clone(file);
367 if(IS_ERR(v9fid)) 367 if (IS_ERR(v9fid))
368 return PTR_ERR(v9fid); 368 return PTR_ERR(v9fid);
369 369
370 return p9_client_remove(v9fid); 370 return p9_client_remove(v9fid);
@@ -398,7 +398,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
398 fid = NULL; 398 fid = NULL;
399 name = (char *) dentry->d_name.name; 399 name = (char *) dentry->d_name.name;
400 dfid = v9fs_fid_clone(dentry->d_parent); 400 dfid = v9fs_fid_clone(dentry->d_parent);
401 if(IS_ERR(dfid)) { 401 if (IS_ERR(dfid)) {
402 err = PTR_ERR(dfid); 402 err = PTR_ERR(dfid);
403 dfid = NULL; 403 dfid = NULL;
404 goto error; 404 goto error;
@@ -432,7 +432,7 @@ v9fs_create(struct v9fs_session_info *v9ses, struct inode *dir,
432 goto error; 432 goto error;
433 } 433 }
434 434
435 if(v9ses->cache) 435 if (v9ses->cache)
436 dentry->d_op = &v9fs_cached_dentry_operations; 436 dentry->d_op = &v9fs_cached_dentry_operations;
437 else 437 else
438 dentry->d_op = &v9fs_dentry_operations; 438 dentry->d_op = &v9fs_dentry_operations;
@@ -593,7 +593,7 @@ static struct dentry *v9fs_vfs_lookup(struct inode *dir, struct dentry *dentry,
593 if (result < 0) 593 if (result < 0)
594 goto error; 594 goto error;
595 595
596 if((fid->qid.version)&&(v9ses->cache)) 596 if ((fid->qid.version) && (v9ses->cache))
597 dentry->d_op = &v9fs_cached_dentry_operations; 597 dentry->d_op = &v9fs_cached_dentry_operations;
598 else 598 else
599 dentry->d_op = &v9fs_dentry_operations; 599 dentry->d_op = &v9fs_dentry_operations;
@@ -658,17 +658,17 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
658 old_inode = old_dentry->d_inode; 658 old_inode = old_dentry->d_inode;
659 v9ses = v9fs_inode2v9ses(old_inode); 659 v9ses = v9fs_inode2v9ses(old_inode);
660 oldfid = v9fs_fid_lookup(old_dentry); 660 oldfid = v9fs_fid_lookup(old_dentry);
661 if(IS_ERR(oldfid)) 661 if (IS_ERR(oldfid))
662 return PTR_ERR(oldfid); 662 return PTR_ERR(oldfid);
663 663
664 olddirfid = v9fs_fid_clone(old_dentry->d_parent); 664 olddirfid = v9fs_fid_clone(old_dentry->d_parent);
665 if(IS_ERR(olddirfid)) { 665 if (IS_ERR(olddirfid)) {
666 retval = PTR_ERR(olddirfid); 666 retval = PTR_ERR(olddirfid);
667 goto done; 667 goto done;
668 } 668 }
669 669
670 newdirfid = v9fs_fid_clone(new_dentry->d_parent); 670 newdirfid = v9fs_fid_clone(new_dentry->d_parent);
671 if(IS_ERR(newdirfid)) { 671 if (IS_ERR(newdirfid)) {
672 retval = PTR_ERR(newdirfid); 672 retval = PTR_ERR(newdirfid);
673 goto clunk_olddir; 673 goto clunk_olddir;
674 } 674 }
@@ -682,7 +682,7 @@ v9fs_vfs_rename(struct inode *old_dir, struct dentry *old_dentry,
682 } 682 }
683 683
684 v9fs_blank_wstat(&wstat); 684 v9fs_blank_wstat(&wstat);
685 wstat.muid = v9ses->name; 685 wstat.muid = v9ses->uname;
686 wstat.name = (char *) new_dentry->d_name.name; 686 wstat.name = (char *) new_dentry->d_name.name;
687 retval = p9_client_wstat(oldfid, &wstat); 687 retval = p9_client_wstat(oldfid, &wstat);
688 688
@@ -887,7 +887,7 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen)
887 retval = -EPERM; 887 retval = -EPERM;
888 v9ses = v9fs_inode2v9ses(dentry->d_inode); 888 v9ses = v9fs_inode2v9ses(dentry->d_inode);
889 fid = v9fs_fid_lookup(dentry); 889 fid = v9fs_fid_lookup(dentry);
890 if(IS_ERR(fid)) 890 if (IS_ERR(fid))
891 return PTR_ERR(fid); 891 return PTR_ERR(fid);
892 892
893 if (!v9fs_extended(v9ses)) 893 if (!v9fs_extended(v9ses))
@@ -1070,7 +1070,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir,
1070 old_dentry->d_name.name); 1070 old_dentry->d_name.name);
1071 1071
1072 oldfid = v9fs_fid_clone(old_dentry); 1072 oldfid = v9fs_fid_clone(old_dentry);
1073 if(IS_ERR(oldfid)) 1073 if (IS_ERR(oldfid))
1074 return PTR_ERR(oldfid); 1074 return PTR_ERR(oldfid);
1075 1075
1076 name = __getname(); 1076 name = __getname();