]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: only issue sensible caps on directories
authorSage Weil <sage@newdream.net>
Wed, 29 Apr 2009 23:50:02 +0000 (16:50 -0700)
committerSage Weil <sage@newdream.net>
Fri, 1 May 2009 14:38:08 +0000 (07:38 -0700)
src/mds/CInode.h

index dcfb7325fcf9080fdf158b92906c7695f2a0b84b..ee286d98e8e661b006124e7d2e9f199920fc12d1 100644 (file)
@@ -661,17 +661,17 @@ public:
   // caps allowed
   int get_caps_liked() {
     if (is_dir())
-      return CEPH_CAP_ANY & ~(CEPH_CAP_FILE_RD|CEPH_CAP_FILE_WR);
+      return CEPH_CAP_ANY_EXCL | CEPH_CAP_ANY_RDCACHE;  // but not, say, FILE_RD|WR|WRBUFFER
     else
       return CEPH_CAP_ANY;
   }
   int get_caps_allowed_ever() {
-    return 
-      CEPH_CAP_PIN |
-      (filelock.gcaps_allowed_ever() << filelock.get_cap_shift()) |
-      (authlock.gcaps_allowed_ever() << authlock.get_cap_shift()) |
-      (xattrlock.gcaps_allowed_ever() << xattrlock.get_cap_shift()) |
-      (linklock.gcaps_allowed_ever() << linklock.get_cap_shift());
+    return get_caps_liked() & 
+      (CEPH_CAP_PIN |
+       (filelock.gcaps_allowed_ever() << filelock.get_cap_shift()) |
+       (authlock.gcaps_allowed_ever() << authlock.get_cap_shift()) |
+       (xattrlock.gcaps_allowed_ever() << xattrlock.get_cap_shift()) |
+       (linklock.gcaps_allowed_ever() << linklock.get_cap_shift()));
   }
   int get_caps_allowed_by_type(int type) {
     return