]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: ignore permission check when fuse_default_permissions is on 5480/head
authorYan, Zheng <zyan@redhat.com>
Wed, 5 Aug 2015 13:56:45 +0000 (21:56 +0800)
committerYan, Zheng <zyan@redhat.com>
Wed, 5 Aug 2015 14:10:46 +0000 (22:10 +0800)
When fuse_default_permissions is on, linux kernel does permission check.
So there is no need to do extra permission check in ceph-fuse. permission
check code in ceph-fuse has a problem, it does not handle supplementary
user at all (Client::check_permissions() may return -EACCESS in the case
it should return 0).

Fixes: #12617
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/client/Client.cc

index 280d0d3dfc378ab1d096a6e0cbbd4f5aba646701..5a80186943df95307c2a0d8bcc55a53432c93200 100644 (file)
@@ -9996,9 +9996,11 @@ int Client::ll_open(Inode *in, int flags, Fh **fhp, int uid, int gid)
     uid = geteuid();
     gid = getegid();
   }
-  r = check_permissions(in, flags, uid, gid);
-  if (r < 0)
-    goto out;
+  if (!cct->_conf->fuse_default_permissions) {
+    r = check_permissions(in, flags, uid, gid);
+    if (r < 0)
+      goto out;
+  }
 
   r = _open(in, flags, 0, fhp /* may be NULL */, uid, gid);
 
@@ -10048,13 +10050,15 @@ int Client::ll_create(Inode *parent, const char *name, mode_t mode,
 
   ldout(cct, 20) << "ll_create created = " << created << dendl;
   if (!created) {
-    r = check_permissions(in.get(), flags, uid, gid);
-    if (r < 0) {
-      if (fhp && *fhp) {
-       int release_r = _release_fh(*fhp);
-        assert(release_r == 0);  // during create, no async data ops should have happened
+    if (!cct->_conf->fuse_default_permissions) {
+      r = check_permissions(in.get(), flags, uid, gid);
+      if (r < 0) {
+       if (fhp && *fhp) {
+         int release_r = _release_fh(*fhp);
+         assert(release_r == 0);  // during create, no async data ops should have happened
+       }
+       goto out;
       }
-      goto out;
     }
     if (fhp && (*fhp == NULL)) {
       r = _open(in.get(), flags, mode, fhp);