aboutsummaryrefslogtreecommitdiffstats
path: root/fs/fuse/dir.c
diff options
context:
space:
mode:
authorMiklos Szeredi <miklos@szeredi.hu>2005-11-07 03:59:50 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-07 10:53:42 -0500
commit31d40d74b402a6fa18a006fb3745f64609f35b77 (patch)
treeee8c61e814fcae687e3ba3f8ed4828d6d34f8ff2 /fs/fuse/dir.c
parent5b62073d502a88fedc5c369f8a004bda7c9d1999 (diff)
[PATCH] FUSE: add access call
Add a new access call, which will only be called if ->permission is invoked from sys_access(). In all other cases permission checking is delayed until the actual filesystem operation. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r--fs/fuse/dir.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 61b58fdd973e..4bc1afcc476d 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -461,6 +461,38 @@ static int fuse_revalidate(struct dentry *entry)
461 return fuse_do_getattr(inode); 461 return fuse_do_getattr(inode);
462} 462}
463 463
464static int fuse_access(struct inode *inode, int mask)
465{
466 struct fuse_conn *fc = get_fuse_conn(inode);
467 struct fuse_req *req;
468 struct fuse_access_in inarg;
469 int err;
470
471 if (fc->no_access)
472 return 0;
473
474 req = fuse_get_request(fc);
475 if (!req)
476 return -EINTR;
477
478 memset(&inarg, 0, sizeof(inarg));
479 inarg.mask = mask;
480 req->in.h.opcode = FUSE_ACCESS;
481 req->in.h.nodeid = get_node_id(inode);
482 req->inode = inode;
483 req->in.numargs = 1;
484 req->in.args[0].size = sizeof(inarg);
485 req->in.args[0].value = &inarg;
486 request_send(fc, req);
487 err = req->out.h.error;
488 fuse_put_request(fc, req);
489 if (err == -ENOSYS) {
490 fc->no_access = 1;
491 err = 0;
492 }
493 return err;
494}
495
464static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) 496static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
465{ 497{
466 struct fuse_conn *fc = get_fuse_conn(inode); 498 struct fuse_conn *fc = get_fuse_conn(inode);
@@ -493,6 +525,9 @@ static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd)
493 int mode = inode->i_mode; 525 int mode = inode->i_mode;
494 if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO)) 526 if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO))
495 return -EACCES; 527 return -EACCES;
528
529 if (nd && (nd->flags & LOOKUP_ACCESS))
530 return fuse_access(inode, mask);
496 return 0; 531 return 0;
497 } 532 }
498} 533}