Merge tag 'ceph-for-6.7-rc1' of https://github.com/ceph/ceph-client
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Nov 2023 17:52:56 +0000 (09:52 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 10 Nov 2023 17:52:56 +0000 (09:52 -0800)
Pull ceph updates from Ilya Dryomov:

 - support for idmapped mounts in CephFS (Christian Brauner, Alexander
   Mikhalitsyn).

   The series was originally developed by Christian and later picked up
   and brought over the finish line by Alexander, who also contributed
   an enabler on the MDS side (separate owner_{u,g}id fields on the
   wire).

   The required exports for mnt_idmap_{get,put}() in VFS have been acked
   by Christian and received no objection from Christoph.

 - a churny change in CephFS logging to include cluster and client
   identifiers in log and debug messages (Xiubo Li).

   This would help in scenarios with dozens of CephFS mounts on the same
   node which are getting increasingly common, especially in the
   Kubernetes world.

* tag 'ceph-for-6.7-rc1' of https://github.com/ceph/ceph-client:
  ceph: allow idmapped mounts
  ceph: allow idmapped atomic_open inode op
  ceph: allow idmapped set_acl inode op
  ceph: allow idmapped setattr inode op
  ceph: pass idmap to __ceph_setattr
  ceph: allow idmapped permission inode op
  ceph: allow idmapped getattr inode op
  ceph: pass an idmapping to mknod/symlink/mkdir
  ceph: add enable_unsafe_idmap module parameter
  ceph: handle idmapped mounts in create_request_message()
  ceph: stash idmapping in mdsc request
  fs: export mnt_idmap_get/mnt_idmap_put
  libceph, ceph: move mdsmap.h to fs/ceph
  ceph: print cluster fsid and client global_id in all debug logs
  ceph: rename _to_client() to _to_fs_client()
  ceph: pass the mdsc to several helpers
  libceph: add doutc and *_client debug macros support

1  2 
fs/ceph/addr.c
fs/ceph/caps.c
fs/ceph/crypto.c
fs/ceph/file.c
fs/ceph/inode.c
fs/ceph/mds_client.c
fs/ceph/snap.c
fs/ceph/super.h
fs/ceph/xattr.c

diff --cc fs/ceph/addr.c
index 936b9e0b351df72974b2567e59a6a6cac9a8bada,63cb78fabebfd57db6ce0a6ff3eaeee7c0b80c4d..85be3bf18cdf38834de3141dfe0d6d75393c6d94
@@@ -747,10 -755,11 +755,11 @@@ static int writepage_nounlock(struct pa
        osd_req_op_extent_osd_data_pages(req, 0,
                        bounce_page ? &bounce_page : &page, wlen, 0,
                        false, false);
-       dout("writepage %llu~%llu (%llu bytes, %sencrypted)\n",
-            page_off, len, wlen, IS_ENCRYPTED(inode) ? "" : "not ");
+       doutc(cl, "%llx.%llx %llu~%llu (%llu bytes, %sencrypted)\n",
+             ceph_vinop(inode), page_off, len, wlen,
+             IS_ENCRYPTED(inode) ? "" : "not ");
  
 -      req->r_mtime = inode->i_mtime;
 +      req->r_mtime = inode_get_mtime(inode);
        ceph_osdc_start_request(osdc, req);
        err = ceph_osdc_wait_request(osdc, req);
  
diff --cc fs/ceph/caps.c
Simple merge
Simple merge
diff --cc fs/ceph/file.c
Simple merge
diff --cc fs/ceph/inode.c
index 2e2a303b9e649d1c5d3b863846d801de5630f885,b1b92a948a3b84542777ecd2d440124493aaf5b9..0679240f06db924e9aba25052675268885c4bd04
@@@ -833,33 -847,29 +847,32 @@@ void ceph_fill_file_time(struct inode *
                if (ci->i_version == 0 ||
                    ceph_seq_cmp(time_warp_seq, ci->i_time_warp_seq) > 0) {
                        /* the MDS did a utimes() */
-                       dout("mtime %lld.%09ld -> %lld.%09ld "
-                            "tw %d -> %d\n",
+                       doutc(cl, "mtime %lld.%09ld -> %lld.%09ld tw %d -> %d\n",
 -                            inode->i_mtime.tv_sec, inode->i_mtime.tv_nsec,
 -                            mtime->tv_sec, mtime->tv_nsec,
 -                            ci->i_time_warp_seq, (int)time_warp_seq);
 +                           inode_get_mtime_sec(inode),
 +                           inode_get_mtime_nsec(inode),
 +                           mtime->tv_sec, mtime->tv_nsec,
 +                           ci->i_time_warp_seq, (int)time_warp_seq);
  
 -                      inode->i_mtime = *mtime;
 -                      inode->i_atime = *atime;
 +                      inode_set_mtime_to_ts(inode, *mtime);
 +                      inode_set_atime_to_ts(inode, *atime);
                        ci->i_time_warp_seq = time_warp_seq;
                } else if (time_warp_seq == ci->i_time_warp_seq) {
 +                      struct timespec64       ts;
 +
                        /* nobody did utimes(); take the max */
 -                      if (timespec64_compare(mtime, &inode->i_mtime) > 0) {
 +                      ts = inode_get_mtime(inode);
 +                      if (timespec64_compare(mtime, &ts) > 0) {
-                               dout("mtime %lld.%09ld -> %lld.%09ld inc\n",
+                               doutc(cl, "mtime %lld.%09ld -> %lld.%09ld inc\n",
 -                                    inode->i_mtime.tv_sec,
 -                                    inode->i_mtime.tv_nsec,
 -                                    mtime->tv_sec, mtime->tv_nsec);
 -                              inode->i_mtime = *mtime;
 +                                   ts.tv_sec, ts.tv_nsec,
 +                                   mtime->tv_sec, mtime->tv_nsec);
 +                              inode_set_mtime_to_ts(inode, *mtime);
                        }
 -                      if (timespec64_compare(atime, &inode->i_atime) > 0) {
 +                      ts = inode_get_atime(inode);
 +                      if (timespec64_compare(atime, &ts) > 0) {
-                               dout("atime %lld.%09ld -> %lld.%09ld inc\n",
+                               doutc(cl, "atime %lld.%09ld -> %lld.%09ld inc\n",
 -                                    inode->i_atime.tv_sec,
 -                                    inode->i_atime.tv_nsec,
 -                                    atime->tv_sec, atime->tv_nsec);
 -                              inode->i_atime = *atime;
 +                                   ts.tv_sec, ts.tv_nsec,
 +                                   atime->tv_sec, atime->tv_nsec);
 +                              inode_set_atime_to_ts(inode, *atime);
                        }
                } else if (issued & CEPH_CAP_FILE_EXCL) {
                        /* we did a utimes(); ignore mds values */
@@@ -2554,22 -2595,21 +2598,23 @@@ retry
        }
  
        if (ia_valid & ATTR_ATIME) {
 -              doutc(cl, "%p %llx.%llx atime %lld.%ld -> %lld.%ld\n",
 -                    inode, ceph_vinop(inode), inode->i_atime.tv_sec,
 -                    inode->i_atime.tv_nsec, attr->ia_atime.tv_sec,
 -                    attr->ia_atime.tv_nsec);
 +              struct timespec64 atime = inode_get_atime(inode);
 +
-               dout("setattr %p atime %lld.%ld -> %lld.%ld\n", inode,
-                    atime.tv_sec, atime.tv_nsec,
-                    attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec);
++              doutc(cl, "%p %llx.%llx atime %lld.%09ld -> %lld.%09ld\n",
++                    inode, ceph_vinop(inode),
++                    atime.tv_sec, atime.tv_nsec,
++                    attr->ia_atime.tv_sec, attr->ia_atime.tv_nsec);
                if (issued & CEPH_CAP_FILE_EXCL) {
                        ci->i_time_warp_seq++;
 -                      inode->i_atime = attr->ia_atime;
 +                      inode_set_atime_to_ts(inode, attr->ia_atime);
                        dirtied |= CEPH_CAP_FILE_EXCL;
                } else if ((issued & CEPH_CAP_FILE_WR) &&
 -                         timespec64_compare(&inode->i_atime,
 -                                          &attr->ia_atime) < 0) {
 -                      inode->i_atime = attr->ia_atime;
 +                         timespec64_compare(&atime,
 +                                            &attr->ia_atime) < 0) {
 +                      inode_set_atime_to_ts(inode, attr->ia_atime);
                        dirtied |= CEPH_CAP_FILE_WR;
                } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 ||
 -                         !timespec64_equal(&inode->i_atime, &attr->ia_atime)) {
 +                         !timespec64_equal(&atime, &attr->ia_atime)) {
                        ceph_encode_timespec64(&req->r_args.setattr.atime,
                                               &attr->ia_atime);
                        mask |= CEPH_SETATTR_ATIME;
                }
        }
        if (ia_valid & ATTR_MTIME) {
 -              doutc(cl, "%p %llx.%llx mtime %lld.%ld -> %lld.%ld\n",
 -                    inode, ceph_vinop(inode), inode->i_mtime.tv_sec,
 -                    inode->i_mtime.tv_nsec, attr->ia_mtime.tv_sec,
 -                    attr->ia_mtime.tv_nsec);
 +              struct timespec64 mtime = inode_get_mtime(inode);
 +
-               dout("setattr %p mtime %lld.%ld -> %lld.%ld\n", inode,
-                    mtime.tv_sec, mtime.tv_nsec,
-                    attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec);
++              doutc(cl, "%p %llx.%llx mtime %lld.%09ld -> %lld.%09ld\n",
++                    inode, ceph_vinop(inode),
++                    mtime.tv_sec, mtime.tv_nsec,
++                    attr->ia_mtime.tv_sec, attr->ia_mtime.tv_nsec);
                if (issued & CEPH_CAP_FILE_EXCL) {
                        ci->i_time_warp_seq++;
 -                      inode->i_mtime = attr->ia_mtime;
 +                      inode_set_mtime_to_ts(inode, attr->ia_mtime);
                        dirtied |= CEPH_CAP_FILE_EXCL;
                } else if ((issued & CEPH_CAP_FILE_WR) &&
 -                         timespec64_compare(&inode->i_mtime,
 -                                          &attr->ia_mtime) < 0) {
 -                      inode->i_mtime = attr->ia_mtime;
 +                         timespec64_compare(&mtime, &attr->ia_mtime) < 0) {
 +                      inode_set_mtime_to_ts(inode, attr->ia_mtime);
                        dirtied |= CEPH_CAP_FILE_WR;
                } else if ((issued & CEPH_CAP_FILE_SHARED) == 0 ||
 -                         !timespec64_equal(&inode->i_mtime, &attr->ia_mtime)) {
 +                         !timespec64_equal(&mtime, &attr->ia_mtime)) {
                        ceph_encode_timespec64(&req->r_args.setattr.mtime,
                                               &attr->ia_mtime);
                        mask |= CEPH_SETATTR_MTIME;
        if (ia_valid & ATTR_CTIME) {
                bool only = (ia_valid & (ATTR_SIZE|ATTR_MTIME|ATTR_ATIME|
                                         ATTR_MODE|ATTR_UID|ATTR_GID)) == 0;
-               dout("setattr %p ctime %lld.%ld -> %lld.%ld (%s)\n", inode,
-                    inode_get_ctime_sec(inode),
-                    inode_get_ctime_nsec(inode),
-                    attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
-                    only ? "ctime only" : "ignored");
 -              doutc(cl, "%p %llx.%llx ctime %lld.%ld -> %lld.%ld (%s)\n",
 -                    inode, ceph_vinop(inode), inode_get_ctime(inode).tv_sec,
 -                    inode_get_ctime(inode).tv_nsec,
++              doutc(cl, "%p %llx.%llx ctime %lld.%09ld -> %lld.%09ld (%s)\n",
++                    inode, ceph_vinop(inode),
++                    inode_get_ctime_sec(inode),
++                    inode_get_ctime_nsec(inode),
+                     attr->ia_ctime.tv_sec, attr->ia_ctime.tv_nsec,
+                     only ? "ctime only" : "ignored");
 -
                if (only) {
                        /*
                         * if kernel wants to dirty ctime but nothing else,
Simple merge
diff --cc fs/ceph/snap.c
Simple merge
diff --cc fs/ceph/super.h
Simple merge
diff --cc fs/ceph/xattr.c
Simple merge