]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
client: fix caps handling when calling _ll_getattr
authorJeff Layton <jlayton@redhat.com>
Wed, 12 Oct 2016 11:04:41 +0000 (07:04 -0400)
committerJeff Layton <jlayton@redhat.com>
Wed, 12 Oct 2016 11:04:41 +0000 (07:04 -0400)
The _ll_getattr was hardcoded to request CEPH_STAT_CAP_INODE_ALL, even
when the caller didn't need that many caps. Have it take a caps mask
as a parameter and pass that through to _getattr.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/client/Client.cc
src/client/Client.h

index 5d96bda9e2266d82c42e3276fc4bd6e53d15b8d6..48620577ec1bb374d8fb51c321fd121b14a74d84 100644 (file)
@@ -9905,7 +9905,7 @@ Inode *Client::ll_get_inode(vinodeno_t vino)
   return in;
 }
 
-int Client::_ll_getattr(Inode *in, const UserPerm& perms)
+int Client::_ll_getattr(Inode *in, int caps, const UserPerm& perms)
 {
   vinodeno_t vino = _get_vino(in);
 
@@ -9916,14 +9916,14 @@ int Client::_ll_getattr(Inode *in, const UserPerm& perms)
   if (vino.snapid < CEPH_NOSNAP)
     return 0;
   else
-    return _getattr(in, CEPH_STAT_CAP_INODE_ALL, perms);
+    return _getattr(in, caps, perms);
 }
 
 int Client::ll_getattr(Inode *in, struct stat *attr, const UserPerm& perms)
 {
   Mutex::Locker lock(client_lock);
 
-  int res = _ll_getattr(in, perms);
+  int res = _ll_getattr(in, CEPH_STAT_CAP_INODE_ALL, perms);
 
   if (res == 0)
     fill_stat(in, attr);
@@ -9940,7 +9940,7 @@ int Client::ll_getattrx(Inode *in, struct ceph_statx *stx, unsigned int want,
   unsigned mask = statx_to_mask(flags, want);
 
   if (mask && !in->caps_issued_mask(mask))
-    res = _ll_getattr(in, perms);
+    res = _ll_getattr(in, mask, perms);
 
   if (res == 0)
     fill_statx(in, mask, stx);
index 9cb4a693e52264cfdaab6a1c641245d920591788..353771cb1c09994fee5ee881fc0bb63ff16f1fab 100644 (file)
@@ -921,7 +921,7 @@ private:
 
   mds_rank_t _get_random_up_mds() const;
 
-  int _ll_getattr(Inode *in, const UserPerm& perms);
+  int _ll_getattr(Inode *in, int caps, const UserPerm& perms);
 
 public:
   int mount(const std::string &mount_root, const UserPerm& perms,