diff options
Diffstat (limited to 'fs/fuse/dir.c')
-rw-r--r-- | fs/fuse/dir.c | 35 |
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 | ||
464 | static 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 | |||
464 | static int fuse_permission(struct inode *inode, int mask, struct nameidata *nd) | 496 | static 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 | } |