]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: set CEPH_SETATTR_KILL_SGUID on truncate 12412/head
authorJeff Layton <jlayton@redhat.com>
Thu, 8 Dec 2016 15:10:07 +0000 (10:10 -0500)
committerJeff Layton <jlayton@redhat.com>
Thu, 8 Dec 2016 21:17:08 +0000 (16:17 -0500)
On a size change, try to clobber the S_ISUID and S_ISGID bits if we
have Ax caps. If we don't have them, then ask the server to do it
for us using CEPH_SETATTR_KILL_SGUID.

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

index 6f39c082ffea2fb30363dd0dafb99aa6d980143d..41f6b70a4f2b176f9b5260f26c212374642954f8 100644 (file)
@@ -6494,7 +6494,7 @@ int Client::_do_setattr(Inode *in, struct ceph_statx *stx, int mask,
   }
 
   if (in->caps_issued_mask(CEPH_CAP_AUTH_EXCL)) {
-    bool kill_sguid = mask & CEPH_SETATTR_KILL_SGUID;
+    bool kill_sguid = mask & (CEPH_SETATTR_SIZE|CEPH_SETATTR_KILL_SGUID);
 
     mask &= ~CEPH_SETATTR_KILL_SGUID;
 
@@ -6544,7 +6544,11 @@ int Client::_do_setattr(Inode *in, struct ceph_statx *stx, int mask,
       mask &= ~CEPH_SETATTR_BTIME;
       ldout(cct,10) << "changing btime to " << in->btime << dendl;
     }
+  } else if (mask & CEPH_SETATTR_SIZE) {
+    /* If we don't have Ax, then we must ask the server to clear them on truncate */
+    mask |= CEPH_SETATTR_KILL_SGUID;
   }
+
   if (in->caps_issued_mask(CEPH_CAP_FILE_EXCL)) {
     if (mask & (CEPH_SETATTR_MTIME|CEPH_SETATTR_ATIME)) {
       if (mask & CEPH_SETATTR_MTIME)