All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: David Howells <dhowells@redhat.com>
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev
Subject: [dhowells-fs:ceph-iter 61/61] fs/ceph/inode.c:1057:9: error: no member named 'min_bshift' in 'struct netfs_inode'
Date: Sun, 8 Sep 2024 06:50:50 +0800	[thread overview]
Message-ID: <202409080630.VC47MNOG-lkp@intel.com> (raw)

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs.git ceph-iter
head:   6c59f154a1d493b31755ac17326124d804172fb2
commit: 6c59f154a1d493b31755ac17326124d804172fb2 [61/61] ceph: Use netfslib
config: i386-randconfig-016-20240907 (https://download.01.org/0day-ci/archive/20240908/202409080630.VC47MNOG-lkp@intel.com/config)
compiler: clang version 18.1.5 (https://github.com/llvm/llvm-project 617a15a9eac96088ae5e9134248d8236e34b91b1)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240908/202409080630.VC47MNOG-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202409080630.VC47MNOG-lkp@intel.com/

All error/warnings (new ones prefixed by >>):

>> net/ceph/snapshot.c:40:22: warning: cast from 'void (*)(const void *)' to 'void (*)(struct netfs_group *)' converts to incompatible function type [-Wcast-function-type-strict]
      40 |         snapc->group.free = (void (*)(struct netfs_group *))kfree;
         |                             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   1 warning generated.
--
>> fs/ceph/inode.c:1057:9: error: no member named 'min_bshift' in 'struct netfs_inode'
    1057 |                 ictx->min_bshift = ictx->crypto_bshift;
         |                 ~~~~  ^
   1 error generated.
--
>> fs/ceph/rdwr.c:116:12: error: use of undeclared identifier 'NETFS_RREQ_REPEAT_RMW'
     116 |                         set_bit(NETFS_RREQ_REPEAT_RMW, &ci->netfs.flags);
         |                                 ^
>> fs/ceph/rdwr.c:125:2: error: call to undeclared function 'netfs_subreq_terminated'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     125 |         netfs_subreq_terminated(subreq, wrote, err);
         |         ^
   fs/ceph/rdwr.c:125:2: note: did you mean 'netfs_read_subreq_terminated'?
   include/linux/netfs.h:468:6: note: 'netfs_read_subreq_terminated' declared here
     468 | void netfs_read_subreq_terminated(struct netfs_io_subrequest *subreq,
         |      ^
>> fs/ceph/rdwr.c:139:42: error: use of undeclared identifier 'inode'
     139 |         struct ceph_inode_info *ci = ceph_inode(inode);
         |                                                 ^
>> fs/ceph/rdwr.c:146:59: error: no member named 'max_len' in 'struct netfs_io_subrequest'
     146 |               subreq->start, subreq->len, subreq->start, subreq->max_len,
         |                                                          ~~~~~~  ^
   include/linux/ceph/ceph_debug.h:47:46: note: expanded from macro 'doutc'
      47 |                  client->monc.auth->global_id, __func__, ##__VA_ARGS__)
         |                                                            ^~~~~~~~~~~
   include/linux/printk.h:589:26: note: expanded from macro 'pr_debug'
     589 |         dynamic_pr_debug(fmt, ##__VA_ARGS__)
         |                                 ^~~~~~~~~~~
   include/linux/dynamic_debug.h:270:22: note: expanded from macro 'dynamic_pr_debug'
     270 |                            pr_fmt(fmt), ##__VA_ARGS__)
         |                                           ^~~~~~~~~~~
   include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
     250 |         _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
         |                                                                  ^~~~~~~~~~~
   include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
     248 |         __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
         |                                                                        ^~~~~~~~~~~
   include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
     224 |                 func(&id, ##__VA_ARGS__);                       \
         |                             ^~~~~~~~~~~
   fs/ceph/rdwr.c:167:17: error: use of undeclared identifier 'inode'
     167 |         req->r_inode    = inode;
         |                           ^
   fs/ceph/rdwr.c:168:30: error: use of undeclared identifier 'inode'
     168 |         req->r_mtime    = current_time(inode);
         |                                        ^
>> fs/ceph/rdwr.c:180:7: error: use of undeclared identifier 'assert_ver'
     180 |                 if (assert_ver) {
         |                     ^
   fs/ceph/rdwr.c:182:35: error: use of undeclared identifier 'assert_ver'
     182 |                         req->r_ops[0].assert_ver.ver = assert_ver;
         |                                                        ^
   fs/ceph/rdwr.c:209:38: error: no member named 'max_len' in 'struct netfs_io_subrequest'
     209 |                                       &objnum, &objoff, &subreq->max_len);
         |                                                          ~~~~~~  ^
>> fs/ceph/rdwr.c:266:2: error: use of undeclared identifier 'rreq'
     266 |         rreq->io_streams[0].sreq_max_len = umin(xlen, fsc->mount_options->rsize);
         |         ^
>> fs/ceph/rdwr.c:335:18: warning: unused variable 'iter' [-Wunused-variable]
     335 |         struct iov_iter iter;
         |                         ^~~~
>> fs/ceph/rdwr.c:514:3: error: field designator 'clamp_length' does not refer to any field in type 'const struct netfs_request_ops'
     514 |         .clamp_length           = ceph_netfs_clamp_length,
         |         ~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/ceph/rdwr.c:541:36: error: use of undeclared identifier 'page_snapc'
     541 |                 if (snapc && capsnap->context != page_snapc)
         |                                                  ^
>> fs/ceph/rdwr.c:591:10: error: call to undeclared function 'folio_snap_context'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     591 |         snapc = folio_snap_context(ceph_fscrypt_pagecache_folio(folio));
         |                 ^
>> fs/ceph/rdwr.c:591:8: error: incompatible integer to pointer conversion assigning to 'struct ceph_snap_context *' from 'int' [-Wint-conversion]
     591 |         snapc = folio_snap_context(ceph_fscrypt_pagecache_folio(folio));
         |               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/ceph/rdwr.c:629:54: error: too few arguments to function call, expected 3, have 2
     629 |                 snapc = get_oldest_context(mapping->host, &ceph_wbc);
         |                         ~~~~~~~~~~~~~~~~~~                         ^
   fs/ceph/rdwr.c:525:1: note: 'get_oldest_context' declared here
     525 | get_oldest_context(struct inode *inode, struct ceph_writeback_ctl *ctl,
         | ^                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     526 |                    struct ceph_snap_context *folio_snapc)
         |                    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> fs/ceph/rdwr.c:656:17: error: use of undeclared identifier 'ceph_dirty_folio'
     656 |         .dirty_folio    = ceph_dirty_folio,
         |                           ^
>> fs/ceph/rdwr.c:657:22: error: use of undeclared identifier 'ceph_invalidate_folio'; did you mean 'netfs_invalidate_folio'?
     657 |         .invalidate_folio = ceph_invalidate_folio,
         |                             ^~~~~~~~~~~~~~~~~~~~~
         |                             netfs_invalidate_folio
   include/linux/netfs.h:459:6: note: 'netfs_invalidate_folio' declared here
     459 | void netfs_invalidate_folio(struct folio *folio, size_t offset, size_t length);
         |      ^
>> fs/ceph/rdwr.c:721:11: error: call to undeclared function 'ceph_direct_read_write'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
     721 |                                 ret = ceph_direct_read_write(iocb, to,
         |                                       ^
   fs/ceph/rdwr.c:721:11: note: did you mean 'ceph_prepare_write'?
   fs/ceph/rdwr.c:196:13: note: 'ceph_prepare_write' declared here
     196 | static void ceph_prepare_write(struct netfs_io_subrequest *subreq)
         |             ^
>> fs/ceph/rdwr.c:724:17: error: use of undeclared identifier 'CHECK_EOF'
     724 |                                         retry_op = CHECK_EOF;
         |                                                    ^
   fatal error: too many errors emitted, stopping now [-ferror-limit=]
   1 warning and 20 errors generated.
--
>> fs/ceph/file.c:1746:15: error: use of undeclared identifier 'ceph_read_iter'; did you mean 'seq_read_iter'?
    1746 |         .read_iter = ceph_read_iter,
         |                      ^~~~~~~~~~~~~~
         |                      seq_read_iter
   include/linux/seq_file.h:110:9: note: 'seq_read_iter' declared here
     110 | ssize_t seq_read_iter(struct kiocb *iocb, struct iov_iter *iter);
         |         ^
>> fs/ceph/file.c:1747:16: error: use of undeclared identifier 'ceph_write_iter'; did you mean 'ceph_write_inode'?
    1747 |         .write_iter = ceph_write_iter,
         |                       ^~~~~~~~~~~~~~~
         |                       ceph_write_inode
   fs/ceph/super.h:1251:12: note: 'ceph_write_inode' declared here
    1251 | extern int ceph_write_inode(struct inode *inode, struct writeback_control *wbc);
         |            ^
>> fs/ceph/file.c:1747:16: error: incompatible function pointer types initializing 'ssize_t (*)(struct kiocb *, struct iov_iter *)' (aka 'int (*)(struct kiocb *, struct iov_iter *)') with an expression of type 'int (struct inode *, struct writeback_control *)' [-Wincompatible-function-pointer-types]
    1747 |         .write_iter = ceph_write_iter,
         |                       ^~~~~~~~~~~~~~~
   3 errors generated.
--
   fs/ceph/crypto.c:545:5: warning: no previous prototype for function 'ceph_fscrypt_decrypt_pages' [-Wmissing-prototypes]
     545 | int ceph_fscrypt_decrypt_pages(struct inode *inode, struct ceph_databuf *dbuf,
         |     ^
   fs/ceph/crypto.c:545:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     545 | int ceph_fscrypt_decrypt_pages(struct inode *inode, struct ceph_databuf *dbuf,
         | ^
         | static 
   fs/ceph/crypto.c:591:5: error: conflicting types for 'ceph_fscrypt_decrypt_extents'
     591 | int ceph_fscrypt_decrypt_extents(struct inode *inode, struct page **page,
         |     ^
   fs/ceph/crypto.h:160:5: note: previous declaration is here
     160 | int ceph_fscrypt_decrypt_extents(struct inode *inode, struct ceph_databuf *dbuf, u64 off,
         |     ^
   fs/ceph/crypto.c:625:44: error: incompatible pointer types passing 'struct page **' to parameter of type 'struct ceph_databuf *' [-Werror,-Wincompatible-pointer-types]
     625 |                 fret = ceph_fscrypt_decrypt_pages(inode, &page[pgidx],
         |                                                          ^~~~~~~~~~~~
   fs/ceph/crypto.c:545:74: note: passing argument to parameter 'dbuf' here
     545 | int ceph_fscrypt_decrypt_pages(struct inode *inode, struct ceph_databuf *dbuf,
         |                                                                          ^
>> fs/ceph/crypto.c:644:35: error: use of undeclared identifier 'op'
     644 |         struct ceph_sparse_extent *map = op->extent.sparse_ext;
         |                                          ^
>> fs/ceph/crypto.c:645:42: error: use of undeclared identifier 'inode'
     645 |         struct ceph_inode_info *ci = ceph_inode(inode);
         |                                                 ^
   fs/ceph/crypto.c:647:16: error: use of undeclared identifier 'op'
     647 |         u32 ext_cnt = op->extent.sparse_ext_cnt;
         |                       ^
>> fs/ceph/crypto.c:671:45: error: use of undeclared identifier 'page'
     671 |                 fret = ceph_fscrypt_decrypt_pages(inode, &page[pgidx],
         |                                                           ^
   fs/ceph/crypto.c:671:37: error: use of undeclared identifier 'inode'
     671 |                 fret = ceph_fscrypt_decrypt_pages(inode, &page[pgidx],
         |                                                   ^
>> fs/ceph/crypto.c:672:8: error: use of undeclared identifier 'off'
     672 |                                                  off + pgsoff, ext->len);
         |                                                  ^
>> fs/ceph/crypto.c:640:5: warning: no previous prototype for function 'ceph_decrypt_block' [-Wmissing-prototypes]
     640 | int ceph_decrypt_block(struct netfs_io_request *rreq, loff_t pos, size_t len,
         |     ^
   fs/ceph/crypto.c:640:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     640 | int ceph_decrypt_block(struct netfs_io_request *rreq, loff_t pos, size_t len,
         | ^
         | static 
>> fs/ceph/crypto.c:686:5: warning: no previous prototype for function 'ceph_encrypt_block' [-Wmissing-prototypes]
     686 | int ceph_encrypt_block(struct netfs_io_request *wreq, loff_t pos, size_t len,
         |     ^
   fs/ceph/crypto.c:686:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
     686 | int ceph_encrypt_block(struct netfs_io_request *wreq, loff_t pos, size_t len,
         | ^
         | static 
   3 warnings and 8 errors generated.


vim +1057 fs/ceph/inode.c

   936	
   937	/*
   938	 * Populate an inode based on info from mds.  May be called on new or
   939	 * existing inodes.
   940	 */
   941	int ceph_fill_inode(struct inode *inode, struct folio *locked_folio,
   942			    struct ceph_mds_reply_info_in *iinfo,
   943			    struct ceph_mds_reply_dirfrag *dirinfo,
   944			    struct ceph_mds_session *session, int cap_fmode,
   945			    struct ceph_cap_reservation *caps_reservation)
   946	{
   947		struct ceph_mds_client *mdsc = ceph_sb_to_mdsc(inode->i_sb);
   948		struct ceph_client *cl = mdsc->fsc->client;
   949		struct ceph_mds_reply_inode *info = iinfo->in;
   950		struct ceph_inode_info *ci = ceph_inode(inode);
   951		struct netfs_inode *ictx = netfs_inode(inode);
   952		int issued, new_issued, info_caps;
   953		struct timespec64 mtime, atime, ctime;
   954		struct ceph_buffer *xattr_blob = NULL;
   955		struct ceph_buffer *old_blob = NULL;
   956		struct ceph_string *pool_ns = NULL;
   957		struct ceph_cap *new_cap = NULL;
   958		int err = 0;
   959		bool wake = false;
   960		bool queue_trunc = false;
   961		bool new_version = false;
   962		bool fill_inline = false;
   963		umode_t mode = le32_to_cpu(info->mode);
   964		dev_t rdev = le32_to_cpu(info->rdev);
   965	
   966		lockdep_assert_held(&mdsc->snap_rwsem);
   967	
   968		doutc(cl, "%p ino %llx.%llx v %llu had %llu\n", inode, ceph_vinop(inode),
   969		      le64_to_cpu(info->version), ci->i_version);
   970	
   971		/* Once I_NEW is cleared, we can't change type or dev numbers */
   972		if (inode->i_state & I_NEW) {
   973			inode->i_mode = mode;
   974		} else {
   975			if (inode_wrong_type(inode, mode)) {
   976				pr_warn_once_client(cl,
   977					"inode type changed! (ino %llx.%llx is 0%o, mds says 0%o)\n",
   978					ceph_vinop(inode), inode->i_mode, mode);
   979				return -ESTALE;
   980			}
   981	
   982			if ((S_ISCHR(mode) || S_ISBLK(mode)) && inode->i_rdev != rdev) {
   983				pr_warn_once_client(cl,
   984					"dev inode rdev changed! (ino %llx.%llx is %u:%u, mds says %u:%u)\n",
   985					ceph_vinop(inode), MAJOR(inode->i_rdev),
   986					MINOR(inode->i_rdev), MAJOR(rdev),
   987					MINOR(rdev));
   988				return -ESTALE;
   989			}
   990		}
   991	
   992		info_caps = le32_to_cpu(info->cap.caps);
   993	
   994		/* prealloc new cap struct */
   995		if (info_caps && ceph_snap(inode) == CEPH_NOSNAP) {
   996			new_cap = ceph_get_cap(mdsc, caps_reservation);
   997			if (!new_cap)
   998				return -ENOMEM;
   999		}
  1000	
  1001		/*
  1002		 * prealloc xattr data, if it looks like we'll need it.  only
  1003		 * if len > 4 (meaning there are actually xattrs; the first 4
  1004		 * bytes are the xattr count).
  1005		 */
  1006		if (iinfo->xattr_len > 4) {
  1007			xattr_blob = ceph_buffer_new(iinfo->xattr_len, GFP_NOFS);
  1008			if (!xattr_blob)
  1009				pr_err_client(cl, "ENOMEM xattr blob %d bytes\n",
  1010					      iinfo->xattr_len);
  1011		}
  1012	
  1013		if (iinfo->pool_ns_len > 0)
  1014			pool_ns = ceph_find_or_create_string(iinfo->pool_ns_data,
  1015							     iinfo->pool_ns_len);
  1016	
  1017		if (ceph_snap(inode) != CEPH_NOSNAP && !ci->i_snapid_map)
  1018			ci->i_snapid_map = ceph_get_snapid_map(mdsc, ceph_snap(inode));
  1019	
  1020		spin_lock(&ci->i_ceph_lock);
  1021	
  1022		/*
  1023		 * provided version will be odd if inode value is projected,
  1024		 * even if stable.  skip the update if we have newer stable
  1025		 * info (ours>=theirs, e.g. due to racing mds replies), unless
  1026		 * we are getting projected (unstable) info (in which case the
  1027		 * version is odd, and we want ours>theirs).
  1028		 *   us   them
  1029		 *   2    2     skip
  1030		 *   3    2     skip
  1031		 *   3    3     update
  1032		 */
  1033		if (ci->i_version == 0 ||
  1034		    ((info->cap.flags & CEPH_CAP_FLAG_AUTH) &&
  1035		     le64_to_cpu(info->version) > (ci->i_version & ~1)))
  1036			new_version = true;
  1037	
  1038		/* Update change_attribute */
  1039		inode_set_max_iversion_raw(inode, iinfo->change_attr);
  1040	
  1041		__ceph_caps_issued(ci, &issued);
  1042		issued |= __ceph_caps_dirty(ci);
  1043		new_issued = ~issued & info_caps;
  1044	
  1045		__ceph_update_quota(ci, iinfo->max_bytes, iinfo->max_files);
  1046	
  1047	#ifdef CONFIG_FS_ENCRYPTION
  1048		if (iinfo->fscrypt_auth_len &&
  1049		    ((inode->i_state & I_NEW) || (ci->fscrypt_auth_len == 0))) {
  1050			kfree(ci->fscrypt_auth);
  1051			ci->fscrypt_auth_len = iinfo->fscrypt_auth_len;
  1052			ci->fscrypt_auth = iinfo->fscrypt_auth;
  1053			iinfo->fscrypt_auth = NULL;
  1054			iinfo->fscrypt_auth_len = 0;
  1055			inode_set_flags(inode, S_ENCRYPTED, S_ENCRYPTED);
  1056			ictx->crypto_bshift = ilog2(CEPH_FSCRYPT_BLOCK_SIZE);
> 1057			ictx->min_bshift = ictx->crypto_bshift;
  1058			__set_bit(NETFS_ICTX_ENCRYPTED, &ictx->flags);
  1059		}
  1060	#endif
  1061	
  1062		if ((new_version || (new_issued & CEPH_CAP_AUTH_SHARED)) &&
  1063		    (issued & CEPH_CAP_AUTH_EXCL) == 0) {
  1064			inode->i_mode = mode;
  1065			inode->i_uid = make_kuid(&init_user_ns, le32_to_cpu(info->uid));
  1066			inode->i_gid = make_kgid(&init_user_ns, le32_to_cpu(info->gid));
  1067			doutc(cl, "%p %llx.%llx mode 0%o uid.gid %d.%d\n", inode,
  1068			      ceph_vinop(inode), inode->i_mode,
  1069			      from_kuid(&init_user_ns, inode->i_uid),
  1070			      from_kgid(&init_user_ns, inode->i_gid));
  1071			ceph_decode_timespec64(&ci->i_btime, &iinfo->btime);
  1072			ceph_decode_timespec64(&ci->i_snap_btime, &iinfo->snap_btime);
  1073		}
  1074	
  1075		/* directories have fl_stripe_unit set to zero */
  1076		if (IS_ENCRYPTED(inode))
  1077			inode->i_blkbits = CEPH_FSCRYPT_BLOCK_SHIFT;
  1078		else if (le32_to_cpu(info->layout.fl_stripe_unit))
  1079			inode->i_blkbits =
  1080				fls(le32_to_cpu(info->layout.fl_stripe_unit)) - 1;
  1081		else
  1082			inode->i_blkbits = CEPH_BLOCK_SHIFT;
  1083	
  1084		if ((new_version || (new_issued & CEPH_CAP_LINK_SHARED)) &&
  1085		    (issued & CEPH_CAP_LINK_EXCL) == 0)
  1086			set_nlink(inode, le32_to_cpu(info->nlink));
  1087	
  1088		if (new_version || (new_issued & CEPH_CAP_ANY_RD)) {
  1089			/* be careful with mtime, atime, size */
  1090			ceph_decode_timespec64(&atime, &info->atime);
  1091			ceph_decode_timespec64(&mtime, &info->mtime);
  1092			ceph_decode_timespec64(&ctime, &info->ctime);
  1093			ceph_fill_file_time(inode, issued,
  1094					le32_to_cpu(info->time_warp_seq),
  1095					&ctime, &mtime, &atime);
  1096		}
  1097	
  1098		if (new_version || (info_caps & CEPH_CAP_FILE_SHARED)) {
  1099			ci->i_files = le64_to_cpu(info->files);
  1100			ci->i_subdirs = le64_to_cpu(info->subdirs);
  1101		}
  1102	
  1103		if (new_version ||
  1104		    (new_issued & (CEPH_CAP_ANY_FILE_RD | CEPH_CAP_ANY_FILE_WR))) {
  1105			u64 size = le64_to_cpu(info->size);
  1106			s64 old_pool = ci->i_layout.pool_id;
  1107			struct ceph_string *old_ns;
  1108	
  1109			ceph_file_layout_from_legacy(&ci->i_layout, &info->layout);
  1110			old_ns = rcu_dereference_protected(ci->i_layout.pool_ns,
  1111						lockdep_is_held(&ci->i_ceph_lock));
  1112			rcu_assign_pointer(ci->i_layout.pool_ns, pool_ns);
  1113	
  1114			if (ci->i_layout.pool_id != old_pool || pool_ns != old_ns)
  1115				ci->i_ceph_flags &= ~CEPH_I_POOL_PERM;
  1116	
  1117			pool_ns = old_ns;
  1118	
  1119			if (IS_ENCRYPTED(inode) && size &&
  1120			    iinfo->fscrypt_file_len == sizeof(__le64)) {
  1121				u64 fsize = __le64_to_cpu(*(__le64 *)iinfo->fscrypt_file);
  1122	
  1123				if (size == round_up(fsize, CEPH_FSCRYPT_BLOCK_SIZE)) {
  1124					size = fsize;
  1125				} else {
  1126					pr_warn_client(cl,
  1127						"fscrypt size mismatch: size=%llu fscrypt_file=%llu, discarding fscrypt_file size.\n",
  1128						info->size, size);
  1129				}
  1130			}
  1131	
  1132			ictx->zero_point = size;
  1133			queue_trunc = ceph_fill_file_size(inode, issued,
  1134						le32_to_cpu(info->truncate_seq),
  1135						le64_to_cpu(info->truncate_size),
  1136						size);
  1137			/* only update max_size on auth cap */
  1138			if ((info->cap.flags & CEPH_CAP_FLAG_AUTH) &&
  1139			    ci->i_max_size != le64_to_cpu(info->max_size)) {
  1140				doutc(cl, "max_size %lld -> %llu\n",
  1141				    ci->i_max_size, le64_to_cpu(info->max_size));
  1142				ci->i_max_size = le64_to_cpu(info->max_size);
  1143			}
  1144		}
  1145	
  1146		/* layout and rstat are not tracked by capability, update them if
  1147		 * the inode info is from auth mds */
  1148		if (new_version || (info->cap.flags & CEPH_CAP_FLAG_AUTH)) {
  1149			if (S_ISDIR(inode->i_mode)) {
  1150				ci->i_dir_layout = iinfo->dir_layout;
  1151				ci->i_rbytes = le64_to_cpu(info->rbytes);
  1152				ci->i_rfiles = le64_to_cpu(info->rfiles);
  1153				ci->i_rsubdirs = le64_to_cpu(info->rsubdirs);
  1154				ci->i_dir_pin = iinfo->dir_pin;
  1155				ci->i_rsnaps = iinfo->rsnaps;
  1156				ceph_decode_timespec64(&ci->i_rctime, &info->rctime);
  1157			}
  1158		}
  1159	
  1160		/* xattrs */
  1161		/* note that if i_xattrs.len <= 4, i_xattrs.data will still be NULL. */
  1162		if ((ci->i_xattrs.version == 0 || !(issued & CEPH_CAP_XATTR_EXCL))  &&
  1163		    le64_to_cpu(info->xattr_version) > ci->i_xattrs.version) {
  1164			if (ci->i_xattrs.blob)
  1165				old_blob = ci->i_xattrs.blob;
  1166			ci->i_xattrs.blob = xattr_blob;
  1167			if (xattr_blob)
  1168				memcpy(ci->i_xattrs.blob->vec.iov_base,
  1169				       iinfo->xattr_data, iinfo->xattr_len);
  1170			ci->i_xattrs.version = le64_to_cpu(info->xattr_version);
  1171			ceph_forget_all_cached_acls(inode);
  1172			ceph_security_invalidate_secctx(inode);
  1173			xattr_blob = NULL;
  1174		}
  1175	
  1176		/* finally update i_version */
  1177		if (le64_to_cpu(info->version) > ci->i_version)
  1178			ci->i_version = le64_to_cpu(info->version);
  1179	
  1180		inode->i_mapping->a_ops = &ceph_aops;
  1181	
  1182		switch (inode->i_mode & S_IFMT) {
  1183		case S_IFIFO:
  1184		case S_IFBLK:
  1185		case S_IFCHR:
  1186		case S_IFSOCK:
  1187			inode->i_blkbits = PAGE_SHIFT;
  1188			init_special_inode(inode, inode->i_mode, rdev);
  1189			inode->i_op = &ceph_file_iops;
  1190			break;
  1191		case S_IFREG:
  1192			inode->i_op = &ceph_file_iops;
  1193			inode->i_fop = &ceph_file_fops;
  1194			break;
  1195		case S_IFLNK:
  1196			if (!ci->i_symlink) {
  1197				u32 symlen = iinfo->symlink_len;
  1198				char *sym;
  1199	
  1200				spin_unlock(&ci->i_ceph_lock);
  1201	
  1202				if (IS_ENCRYPTED(inode)) {
  1203					if (symlen != i_size_read(inode))
  1204						pr_err_client(cl,
  1205							"%p %llx.%llx BAD symlink size %lld\n",
  1206							inode, ceph_vinop(inode),
  1207							i_size_read(inode));
  1208	
  1209					err = decode_encrypted_symlink(mdsc, iinfo->symlink,
  1210								       symlen, (u8 **)&sym);
  1211					if (err < 0) {
  1212						pr_err_client(cl,
  1213							"decoding encrypted symlink failed: %d\n",
  1214							err);
  1215						goto out;
  1216					}
  1217					symlen = err;
  1218					i_size_write(inode, symlen);
  1219					inode->i_blocks = calc_inode_blocks(symlen);
  1220				} else {
  1221					if (symlen != i_size_read(inode)) {
  1222						pr_err_client(cl,
  1223							"%p %llx.%llx BAD symlink size %lld\n",
  1224							inode, ceph_vinop(inode),
  1225							i_size_read(inode));
  1226						i_size_write(inode, symlen);
  1227						inode->i_blocks = calc_inode_blocks(symlen);
  1228					}
  1229	
  1230					err = -ENOMEM;
  1231					sym = kstrndup(iinfo->symlink, symlen, GFP_NOFS);
  1232					if (!sym)
  1233						goto out;
  1234				}
  1235	
  1236				spin_lock(&ci->i_ceph_lock);
  1237				if (!ci->i_symlink)
  1238					ci->i_symlink = sym;
  1239				else
  1240					kfree(sym); /* lost a race */
  1241			}
  1242	
  1243			if (IS_ENCRYPTED(inode)) {
  1244				/*
  1245				 * Encrypted symlinks need to be decrypted before we can
  1246				 * cache their targets in i_link. Don't touch it here.
  1247				 */
  1248				inode->i_op = &ceph_encrypted_symlink_iops;
  1249			} else {
  1250				inode->i_link = ci->i_symlink;
  1251				inode->i_op = &ceph_symlink_iops;
  1252			}
  1253			break;
  1254		case S_IFDIR:
  1255			inode->i_op = &ceph_dir_iops;
  1256			inode->i_fop = &ceph_dir_fops;
  1257			break;
  1258		default:
  1259			pr_err_client(cl, "%p %llx.%llx BAD mode 0%o\n", inode,
  1260				      ceph_vinop(inode), inode->i_mode);
  1261		}
  1262	
  1263		/* were we issued a capability? */
  1264		if (info_caps) {
  1265			if (ceph_snap(inode) == CEPH_NOSNAP) {
  1266				ceph_add_cap(inode, session,
  1267					     le64_to_cpu(info->cap.cap_id),
  1268					     info_caps,
  1269					     le32_to_cpu(info->cap.wanted),
  1270					     le32_to_cpu(info->cap.seq),
  1271					     le32_to_cpu(info->cap.mseq),
  1272					     le64_to_cpu(info->cap.realm),
  1273					     info->cap.flags, &new_cap);
  1274	
  1275				/* set dir completion flag? */
  1276				if (S_ISDIR(inode->i_mode) &&
  1277				    ci->i_files == 0 && ci->i_subdirs == 0 &&
  1278				    (info_caps & CEPH_CAP_FILE_SHARED) &&
  1279				    (issued & CEPH_CAP_FILE_EXCL) == 0 &&
  1280				    !__ceph_dir_is_complete(ci)) {
  1281					doutc(cl, " marking %p complete (empty)\n",
  1282					      inode);
  1283					i_size_write(inode, 0);
  1284					__ceph_dir_set_complete(ci,
  1285						atomic64_read(&ci->i_release_count),
  1286						atomic64_read(&ci->i_ordered_count));
  1287				}
  1288	
  1289				wake = true;
  1290			} else {
  1291				doutc(cl, " %p got snap_caps %s\n", inode,
  1292				      ceph_cap_string(info_caps));
  1293				ci->i_snap_caps |= info_caps;
  1294			}
  1295		}
  1296	
  1297		if (iinfo->inline_version > 0 &&
  1298		    iinfo->inline_version >= ci->i_inline_version) {
  1299			int cache_caps = CEPH_CAP_FILE_CACHE | CEPH_CAP_FILE_LAZYIO;
  1300			ci->i_inline_version = iinfo->inline_version;
  1301			if (ceph_has_inline_data(ci) &&
  1302			    (locked_folio || (info_caps & cache_caps)))
  1303				fill_inline = true;
  1304		}
  1305	
  1306		if (cap_fmode >= 0) {
  1307			if (!info_caps)
  1308				pr_warn_client(cl, "mds issued no caps on %llx.%llx\n",
  1309					       ceph_vinop(inode));
  1310			__ceph_touch_fmode(ci, mdsc, cap_fmode);
  1311		}
  1312	
  1313		spin_unlock(&ci->i_ceph_lock);
  1314	
  1315		ceph_fscache_register_inode_cookie(inode);
  1316	
  1317		if (fill_inline)
  1318			ceph_fill_inline_data(inode, locked_folio,
  1319					      iinfo->inline_data, iinfo->inline_len);
  1320	
  1321		if (wake)
  1322			wake_up_all(&ci->i_cap_wq);
  1323	
  1324		/* queue truncate if we saw i_size decrease */
  1325		if (queue_trunc)
  1326			ceph_queue_vmtruncate(inode);
  1327	
  1328		/* populate frag tree */
  1329		if (S_ISDIR(inode->i_mode))
  1330			ceph_fill_fragtree(inode, &info->fragtree, dirinfo);
  1331	
  1332		/* update delegation info? */
  1333		if (dirinfo)
  1334			ceph_fill_dirfrag(inode, dirinfo);
  1335	
  1336		err = 0;
  1337	out:
  1338		if (new_cap)
  1339			ceph_put_cap(mdsc, new_cap);
  1340		ceph_buffer_put(old_blob);
  1341		ceph_buffer_put(xattr_blob);
  1342		ceph_put_string(pool_ns);
  1343		return err;
  1344	}
  1345	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

                 reply	other threads:[~2024-09-07 22:51 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202409080630.VC47MNOG-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=dhowells@redhat.com \
    --cc=llvm@lists.linux.dev \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.