]> Git Repo - J-linux.git/commitdiff
Merge tag 'ceph-for-6.12-rc1' of https://github.com/ceph/ceph-client
authorLinus Torvalds <[email protected]>
Sat, 28 Sep 2024 15:40:36 +0000 (08:40 -0700)
committerLinus Torvalds <[email protected]>
Sat, 28 Sep 2024 15:40:36 +0000 (08:40 -0700)
Pull ceph updates from Ilya Dryomov:
 "Three CephFS fixes from Xiubo and Luis and a bunch of assorted
  cleanups"

* tag 'ceph-for-6.12-rc1' of https://github.com/ceph/ceph-client:
  ceph: remove the incorrect Fw reference check when dirtying pages
  ceph: Remove empty definition in header file
  ceph: Fix typo in the comment
  ceph: fix a memory leak on cap_auths in MDS client
  ceph: flush all caps releases when syncing the whole filesystem
  ceph: rename ceph_flush_cap_releases() to ceph_flush_session_cap_releases()
  libceph: use min() to simplify code in ceph_dns_resolve_name()
  ceph: Convert to use jiffies macro
  ceph: Remove unused declarations

1  2 
fs/ceph/addr.c
fs/ceph/dir.c
fs/ceph/inode.c

diff --combined fs/ceph/addr.c
index 5d9ccda098cca04b7226444fb1e529c10e719843,0df4623785ddb82dc373a96c43f9dbeef17782e0..53fef258c2bc6ab961cf8fb44e59869c1a29737e
@@@ -13,7 -13,6 +13,7 @@@
  #include <linux/iversion.h>
  #include <linux/ktime.h>
  #include <linux/netfs.h>
 +#include <trace/events/netfs.h>
  
  #include "super.h"
  #include "mds_client.h"
@@@ -96,7 -95,6 +96,6 @@@ static bool ceph_dirty_folio(struct add
  
        /* dirty the head */
        spin_lock(&ci->i_ceph_lock);
-       BUG_ON(ci->i_wr_ref == 0); // caller should hold Fw reference
        if (__ceph_have_pending_cap_snap(ci)) {
                struct ceph_cap_snap *capsnap =
                                list_last_entry(&ci->i_cap_snaps,
@@@ -206,6 -204,21 +205,6 @@@ static void ceph_netfs_expand_readahead
        }
  }
  
 -static bool ceph_netfs_clamp_length(struct netfs_io_subrequest *subreq)
 -{
 -      struct inode *inode = subreq->rreq->inode;
 -      struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 -      struct ceph_inode_info *ci = ceph_inode(inode);
 -      u64 objno, objoff;
 -      u32 xlen;
 -
 -      /* Truncate the extent at the end of the current block */
 -      ceph_calc_file_object_mapping(&ci->i_layout, subreq->start, subreq->len,
 -                                    &objno, &objoff, &xlen);
 -      subreq->len = min(xlen, fsc->mount_options->rsize);
 -      return true;
 -}
 -
  static void finish_netfs_read(struct ceph_osd_request *req)
  {
        struct inode *inode = req->r_inode;
                                     calc_pages_for(osd_data->alignment,
                                        osd_data->length), false);
        }
 -      netfs_subreq_terminated(subreq, err, false);
 +      if (err > 0) {
 +              subreq->transferred = err;
 +              err = 0;
 +      }
 +      trace_netfs_sreq(subreq, netfs_sreq_trace_io_progress);
 +      netfs_read_subreq_terminated(subreq, err, false);
        iput(req->r_inode);
        ceph_dec_osd_stopping_blocker(fsc->mdsc);
  }
@@@ -269,6 -277,7 +268,6 @@@ static bool ceph_netfs_issue_op_inline(
        struct ceph_mds_request *req;
        struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
        struct ceph_inode_info *ci = ceph_inode(inode);
 -      struct iov_iter iter;
        ssize_t err = 0;
        size_t len;
        int mode;
        req->r_args.getattr.mask = cpu_to_le32(CEPH_STAT_CAP_INLINE_DATA);
        req->r_num_caps = 2;
  
 +      trace_netfs_sreq(subreq, netfs_sreq_trace_submit);
        err = ceph_mdsc_do_request(mdsc, NULL, req);
        if (err < 0)
                goto out;
        }
  
        len = min_t(size_t, iinfo->inline_len - subreq->start, subreq->len);
 -      iov_iter_xarray(&iter, ITER_DEST, &rreq->mapping->i_pages, subreq->start, len);
 -      err = copy_to_iter(iinfo->inline_data + subreq->start, len, &iter);
 -      if (err == 0)
 +      err = copy_to_iter(iinfo->inline_data + subreq->start, len, &subreq->io_iter);
 +      if (err == 0) {
                err = -EFAULT;
 +      } else {
 +              subreq->transferred += err;
 +              err = 0;
 +      }
  
        ceph_mdsc_put_request(req);
  out:
 -      netfs_subreq_terminated(subreq, err, false);
 +      netfs_read_subreq_terminated(subreq, err, false);
        return true;
  }
  
 +static int ceph_netfs_prepare_read(struct netfs_io_subrequest *subreq)
 +{
 +      struct netfs_io_request *rreq = subreq->rreq;
 +      struct inode *inode = rreq->inode;
 +      struct ceph_inode_info *ci = ceph_inode(inode);
 +      struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
 +      u64 objno, objoff;
 +      u32 xlen;
 +
 +      /* Truncate the extent at the end of the current block */
 +      ceph_calc_file_object_mapping(&ci->i_layout, subreq->start, subreq->len,
 +                                    &objno, &objoff, &xlen);
 +      rreq->io_streams[0].sreq_max_len = umin(xlen, fsc->mount_options->rsize);
 +      return 0;
 +}
 +
  static void ceph_netfs_issue_read(struct netfs_io_subrequest *subreq)
  {
        struct netfs_io_request *rreq = subreq->rreq;
        struct ceph_client *cl = fsc->client;
        struct ceph_osd_request *req = NULL;
        struct ceph_vino vino = ceph_vino(inode);
 -      struct iov_iter iter;
 -      int err = 0;
 -      u64 len = subreq->len;
 +      int err;
 +      u64 len;
        bool sparse = IS_ENCRYPTED(inode) || ceph_test_mount_opt(fsc, SPARSEREAD);
        u64 off = subreq->start;
        int extent_cnt;
        if (ceph_has_inline_data(ci) && ceph_netfs_issue_op_inline(subreq))
                return;
  
 +      // TODO: This rounding here is slightly dodgy.  It *should* work, for
 +      // now, as the cache only deals in blocks that are a multiple of
 +      // PAGE_SIZE and fscrypt blocks are at most PAGE_SIZE.  What needs to
 +      // happen is for the fscrypt driving to be moved into netfslib and the
 +      // data in the cache also to be stored encrypted.
 +      len = subreq->len;
        ceph_fscrypt_adjust_off_and_len(inode, &off, &len);
  
        req = ceph_osdc_new_request(&fsc->client->osdc, &ci->i_layout, vino,
        doutc(cl, "%llx.%llx pos=%llu orig_len=%zu len=%llu\n",
              ceph_vinop(inode), subreq->start, subreq->len, len);
  
 -      iov_iter_xarray(&iter, ITER_DEST, &rreq->mapping->i_pages, subreq->start, len);
 -
        /*
         * FIXME: For now, use CEPH_OSD_DATA_TYPE_PAGES instead of _ITER for
         * encrypted inodes. We'd need infrastructure that handles an iov_iter
                struct page **pages;
                size_t page_off;
  
 -              err = iov_iter_get_pages_alloc2(&iter, &pages, len, &page_off);
 +              err = iov_iter_get_pages_alloc2(&subreq->io_iter, &pages, len, &page_off);
                if (err < 0) {
                        doutc(cl, "%llx.%llx failed to allocate pages, %d\n",
                              ceph_vinop(inode), err);
                osd_req_op_extent_osd_data_pages(req, 0, pages, len, 0, false,
                                                 false);
        } else {
 -              osd_req_op_extent_osd_iter(req, 0, &iter);
 +              osd_req_op_extent_osd_iter(req, 0, &subreq->io_iter);
        }
        if (!ceph_inc_osd_stopping_blocker(fsc->mdsc)) {
                err = -EIO;
        req->r_inode = inode;
        ihold(inode);
  
 +      trace_netfs_sreq(subreq, netfs_sreq_trace_submit);
        ceph_osdc_start_request(req->r_osdc, req);
  out:
        ceph_osdc_put_request(req);
        if (err)
 -              netfs_subreq_terminated(subreq, err, false);
 +              netfs_read_subreq_terminated(subreq, err, false);
        doutc(cl, "%llx.%llx result %d\n", ceph_vinop(inode), err);
  }
  
  static int ceph_init_request(struct netfs_io_request *rreq, struct file *file)
  {
        struct inode *inode = rreq->inode;
 +      struct ceph_fs_client *fsc = ceph_inode_to_fs_client(inode);
        struct ceph_client *cl = ceph_inode_to_client(inode);
        int got = 0, want = CEPH_CAP_FILE_CACHE;
        struct ceph_netfs_request_data *priv;
  
        priv->caps = got;
        rreq->netfs_priv = priv;
 +      rreq->io_streams[0].sreq_max_len = fsc->mount_options->rsize;
  
  out:
        if (ret < 0)
@@@ -512,9 -495,9 +511,9 @@@ static void ceph_netfs_free_request(str
  const struct netfs_request_ops ceph_netfs_ops = {
        .init_request           = ceph_init_request,
        .free_request           = ceph_netfs_free_request,
 +      .prepare_read           = ceph_netfs_prepare_read,
        .issue_read             = ceph_netfs_issue_read,
        .expand_readahead       = ceph_netfs_expand_readahead,
 -      .clamp_length           = ceph_netfs_clamp_length,
        .check_write_begin      = ceph_netfs_check_write_begin,
  };
  
@@@ -1524,18 -1507,20 +1523,18 @@@ static int ceph_netfs_check_write_begin
   */
  static int ceph_write_begin(struct file *file, struct address_space *mapping,
                            loff_t pos, unsigned len,
 -                          struct page **pagep, void **fsdata)
 +                          struct folio **foliop, void **fsdata)
  {
        struct inode *inode = file_inode(file);
        struct ceph_inode_info *ci = ceph_inode(inode);
 -      struct folio *folio = NULL;
        int r;
  
 -      r = netfs_write_begin(&ci->netfs, file, inode->i_mapping, pos, len, &folio, NULL);
 +      r = netfs_write_begin(&ci->netfs, file, inode->i_mapping, pos, len, foliop, NULL);
        if (r < 0)
                return r;
  
 -      folio_wait_private_2(folio); /* [DEPRECATED] */
 -      WARN_ON_ONCE(!folio_test_locked(folio));
 -      *pagep = &folio->page;
 +      folio_wait_private_2(*foliop); /* [DEPRECATED] */
 +      WARN_ON_ONCE(!folio_test_locked(*foliop));
        return 0;
  }
  
   */
  static int ceph_write_end(struct file *file, struct address_space *mapping,
                          loff_t pos, unsigned len, unsigned copied,
 -                        struct page *subpage, void *fsdata)
 +                        struct folio *folio, void *fsdata)
  {
 -      struct folio *folio = page_folio(subpage);
        struct inode *inode = file_inode(file);
        struct ceph_client *cl = ceph_inode_to_client(inode);
        bool check_cap = false;
diff --combined fs/ceph/dir.c
index ddec8c9244ee55b5df3ae679d1aaaef8206f1497,e23f8a40f3e337b50c82c293a8e8e2eb8ee4f235..952109292d6912fc87c0e3650af9580cdb12de1b
@@@ -707,6 -707,7 +707,6 @@@ static loff_t ceph_dir_llseek(struct fi
  
                if (offset != file->f_pos) {
                        file->f_pos = offset;
 -                      file->f_version = 0;
                        dfi->file_info.flags &= ~CEPH_F_ATEND;
                }
                retval = offset;
@@@ -2058,7 -2059,7 +2058,7 @@@ static int ceph_d_delete(const struct d
                return 0;
        if (ceph_snap(d_inode(dentry)) != CEPH_NOSNAP)
                return 0;
-       /* vaild lease? */
+       /* valid lease? */
        di = ceph_dentry(dentry);
        if (di) {
                if (__dentry_lease_is_valid(di))
diff --combined fs/ceph/inode.c
index 4a8eec46254b1695be4ed9292c83a34544a0d8f1,5bf2bcf38d8c5cb113fa711fa3de8979363d79d6..315ef02f9a3fa68bd6abc151b7f7c514bd4f9c96
@@@ -695,7 -695,6 +695,7 @@@ void ceph_evict_inode(struct inode *ino
  
        percpu_counter_dec(&mdsc->metric.total_inodes);
  
 +      netfs_wait_for_outstanding_io(inode);
        truncate_inode_pages_final(&inode->i_data);
        if (inode->i_state & I_PINNING_NETFS_WB)
                ceph_fscache_unuse_cookie(inode, true);
@@@ -1779,7 -1778,7 +1779,7 @@@ retry_lookup
                if (err < 0)
                        goto done;
        } else if (rinfo->head->is_dentry && req->r_dentry) {
-               /* parent inode is not locked, be carefull */
+               /* parent inode is not locked, be careful */
                struct ceph_vino *ptvino = NULL;
                dvino.ino = le64_to_cpu(rinfo->diri.in->ino);
                dvino.snap = le64_to_cpu(rinfo->diri.in->snapid);
This page took 0.073199 seconds and 4 git commands to generate.