CC: [email protected] CC: [email protected] CC: [email protected] TO: Jeff Layton <[email protected]>
tree: https://github.com/ceph/ceph-client.git wip-fscrypt head: 4ec0d0e0cc68c6525ace02e7a8a5bb57a4242997 commit: 16a6682845642c1929a94e826c4426c22ef909d4 [29/63] ceph: add encrypted fname handling to ceph_mdsc_build_path :::::: branch date: 2 days ago :::::: commit date: 2 days ago config: x86_64-randconfig-c007 (https://download.01.org/0day-ci/archive/20220222/[email protected]/config) compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project d271fc04d5b97b12e6b797c6067d3c96a8d7470e) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/ceph/ceph-client/commit/16a6682845642c1929a94e826c4426c22ef909d4 git remote add ceph-client https://github.com/ceph/ceph-client.git git fetch --no-tags ceph-client wip-fscrypt git checkout 16a6682845642c1929a94e826c4426c22ef909d4 # save the config file to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 clang-analyzer If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <[email protected]> clang-analyzer warnings: (new ones prefixed by >>) Suppressed 3 warnings (3 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 5 warnings generated. arch/x86/include/asm/paravirt.h:55:2: warning: Assigned value is garbage or undefined [clang-analyzer-core.uninitialized.Assign] PVOP_VCALL0(cpu.io_delay); ^ arch/x86/include/asm/paravirt_types.h:512:2: note: expanded from macro 'PVOP_VCALL0' __PVOP_VCALL(op) ^ arch/x86/include/asm/paravirt_types.h:492:8: note: expanded from macro '__PVOP_VCALL' (void)____PVOP_CALL(, op, CLBR_ANY, PVOP_VCALL_CLOBBERS, \ ^ arch/x86/include/asm/paravirt_types.h:447:3: note: expanded from macro '____PVOP_CALL' PVOP_CALL_ARGS; \ ^ arch/x86/include/asm/paravirt_types.h:405:16: note: expanded from macro 'PVOP_CALL_ARGS' unsigned long __edi = __edi, __esi = __esi, \ ^ drivers/usb/host/pci-quirks.c:509:2: note: Calling 'usb_amd_quirk_pll' usb_amd_quirk_pll(0); ^~~~~~~~~~~~~~~~~~~~ drivers/usb/host/pci-quirks.c:343:12: note: 'disable' is 0 u32 bit = disable ? 0 : 1; ^~~~~~~ drivers/usb/host/pci-quirks.c:343:12: note: '?' condition is false drivers/usb/host/pci-quirks.c:346:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(&amd_lock, flags); ^ include/linux/spinlock.h:379:2: note: expanded from macro 'spin_lock_irqsave' raw_spin_lock_irqsave(spinlock_check(lock), flags); \ ^ include/linux/spinlock.h:240:2: note: expanded from macro 'raw_spin_lock_irqsave' do { \ ^ drivers/usb/host/pci-quirks.c:346:2: note: Loop condition is false. Exiting loop spin_lock_irqsave(&amd_lock, flags); ^ include/linux/spinlock.h:377:43: note: expanded from macro 'spin_lock_irqsave' #define spin_lock_irqsave(lock, flags) \ ^ drivers/usb/host/pci-quirks.c:348:6: note: 'disable' is 0 if (disable) { ^~~~~~~ drivers/usb/host/pci-quirks.c:348:2: note: Taking false branch if (disable) { ^ drivers/usb/host/pci-quirks.c:356:7: note: Assuming field 'isoc_reqs' is <= 0 if (amd_chipset.isoc_reqs > 0) { ^~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/host/pci-quirks.c:356:3: note: Taking false branch if (amd_chipset.isoc_reqs > 0) { ^ drivers/usb/host/pci-quirks.c:362:6: note: Assuming field 'gen' is equal to AMD_CHIPSET_SB800 if (amd_chipset.sb_type.gen == AMD_CHIPSET_SB800 || ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/host/pci-quirks.c:362:51: note: Left side of '||' is true if (amd_chipset.sb_type.gen == AMD_CHIPSET_SB800 || ^ drivers/usb/host/pci-quirks.c:365:3: note: Calling 'outb_p' outb_p(AB_REG_BAR_LOW, 0xcd6); ^ arch/x86/include/asm/io.h:337:16: note: expanded from macro 'outb_p' #define outb_p outb_p ^ arch/x86/include/asm/io.h:320:1: note: Calling 'slow_down_io' BUILDIO(b, b, char) ^ arch/x86/include/asm/io.h:278:2: note: expanded from macro 'BUILDIO' slow_down_io(); \ ^~~~~~~~~~~~~~ arch/x86/include/asm/paravirt.h:55:2: note: Assigned value is garbage or undefined PVOP_VCALL0(cpu.io_delay); ^ arch/x86/include/asm/paravirt_types.h:512:2: note: expanded from macro 'PVOP_VCALL0' __PVOP_VCALL(op) ^~~~~~~~~~~~~~~~ arch/x86/include/asm/paravirt_types.h:492:8: note: expanded from macro '__PVOP_VCALL' (void)____PVOP_CALL(, op, CLBR_ANY, PVOP_VCALL_CLOBBERS, \ ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ arch/x86/include/asm/paravirt_types.h:447:3: note: expanded from macro '____PVOP_CALL' PVOP_CALL_ARGS; \ ^~~~~~~~~~~~~~ arch/x86/include/asm/paravirt_types.h:405:16: note: expanded from macro 'PVOP_CALL_ARGS' unsigned long __edi = __edi, __esi = __esi, \ ^ ~~~~~ Suppressed 4 warnings (4 in non-user code). Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well. 11 warnings generated. fs/ceph/mds_client.c:518:46: warning: Although the value stored to 'ino' is used in the enclosing expression, the value is never actually read from 'ino' [clang-analyzer-deadcode.DeadStores] int err = xa_insert(&s->s_delegated_inos, ino = start++, ^ ~~~~~~~ fs/ceph/mds_client.c:518:46: note: Although the value stored to 'ino' is used in the enclosing expression, the value is never actually read from 'ino' int err = xa_insert(&s->s_delegated_inos, ino = start++, ^ ~~~~~~~ fs/ceph/mds_client.c:1487:2: warning: Value stored to 'mstate' is never read [clang-analyzer-deadcode.DeadStores] mstate = ceph_mdsmap_get_state(mdsc->mdsmap, mds); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ceph/mds_client.c:1487:2: note: Value stored to 'mstate' is never read mstate = ceph_mdsmap_get_state(mdsc->mdsmap, mds); ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ >> fs/ceph/mds_client.c:3915:19: warning: Assigned value is garbage or >> undefined [clang-analyzer-core.uninitialized.Assign] rec.v2.pathbase = cpu_to_le64(pathbase); ^ fs/ceph/mds_client.c:5269:2: note: Loop condition is false. Exiting loop pr_warn("mds%d closed our session\n", s->s_mds); ^ include/linux/printk.h:499:2: note: expanded from macro 'pr_warn' printk(KERN_WARNING pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:446:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit' #define __printk_index_emit(...) do {} while (0) ^ fs/ceph/mds_client.c:5270:2: note: Calling 'send_mds_reconnect' send_mds_reconnect(mdsc, s); ^~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ceph/mds_client.c:4120:2: note: Loop condition is false. Exiting loop pr_info("mds%d reconnect start\n", mds); ^ include/linux/printk.h:519:2: note: expanded from macro 'pr_info' printk(KERN_INFO pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:446:26: note: expanded from macro 'printk' #define printk(fmt, ...) printk_index_wrap(_printk, fmt, ##__VA_ARGS__) ^ include/linux/printk.h:417:3: note: expanded from macro 'printk_index_wrap' __printk_index_emit(_fmt, NULL, NULL); \ ^ include/linux/printk.h:392:34: note: expanded from macro '__printk_index_emit' #define __printk_index_emit(...) do {} while (0) ^ fs/ceph/mds_client.c:4123:6: note: Assuming field 'pagelist' is non-null if (!recon_state.pagelist) ^~~~~~~~~~~~~~~~~~~~~ fs/ceph/mds_client.c:4123:2: note: Taking false branch if (!recon_state.pagelist) ^ fs/ceph/mds_client.c:4127:6: note: Assuming 'reply' is non-null if (!reply) ^~~~~~ fs/ceph/mds_client.c:4127:2: note: Taking false branch if (!reply) ^ fs/ceph/mds_client.c:4136:2: note: Taking false branch dout("session %p state %s\n", session, ^ include/linux/ceph/ceph_debug.h:35:25: note: expanded from macro 'dout' # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__) ^ include/linux/printk.h:576:2: note: expanded from macro 'pr_debug' no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:131:2: note: expanded from macro 'no_printk' if (0) \ ^ fs/ceph/mds_client.c:4156:6: note: Assuming field 's_root' is null if (mdsc->fsc->sb->s_root) ^~~~~~~~~~~~~~~~~~~~~ fs/ceph/mds_client.c:4156:2: note: Taking false branch if (mdsc->fsc->sb->s_root) ^ fs/ceph/mds_client.c:4173:6: note: Assuming 'err' is 0 if (err) ^~~ fs/ceph/mds_client.c:4173:2: note: Taking false branch if (err) ^ fs/ceph/mds_client.c:4176:6: note: Assuming the condition is false if (test_bit(CEPHFS_FEATURE_MULTI_RECONNECT, &session->s_features)) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ceph/mds_client.c:4176:2: note: Taking false branch if (test_bit(CEPHFS_FEATURE_MULTI_RECONNECT, &session->s_features)) { ^ fs/ceph/mds_client.c:4179:13: note: Assuming the condition is false } else if (session->s_con.peer_features & CEPH_FEATURE_MDSENC) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ceph/mds_client.c:4179:9: note: Taking false branch } else if (session->s_con.peer_features & CEPH_FEATURE_MDSENC) { ^ fs/ceph/mds_client.c:4185:8: note: Calling 'ceph_iterate_session_caps' err = ceph_iterate_session_caps(session, reconnect_caps_cb, &recon_state); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ fs/ceph/mds_client.c:1643:2: note: Taking false branch dout("iterate_session_caps %p mds%d\n", session, session->s_mds); ^ include/linux/ceph/ceph_debug.h:35:25: note: expanded from macro 'dout' # define dout(fmt, ...) pr_debug(" " fmt, ##__VA_ARGS__) ^ include/linux/printk.h:576:2: note: expanded from macro 'pr_debug' no_printk(KERN_DEBUG pr_fmt(fmt), ##__VA_ARGS__) ^ include/linux/printk.h:131:2: note: expanded from macro 'no_printk' if (0) \ ^ fs/ceph/mds_client.c:1646:2: note: Loop condition is true. Entering loop body while (p != &session->s_caps) { vim +3915 fs/ceph/mds_client.c a33f6432b3a63a Yan, Zheng 2020-08-11 3856 2f2dc053404feb Sage Weil 2009-10-06 3857 /* 2f2dc053404feb Sage Weil 2009-10-06 3858 * Encode information about a cap for a reconnect with the MDS. 2f2dc053404feb Sage Weil 2009-10-06 3859 */ a25949b99003b7 Jeff Layton 2020-02-18 3860 static int reconnect_caps_cb(struct inode *inode, struct ceph_cap *cap, 2f2dc053404feb Sage Weil 2009-10-06 3861 void *arg) 2f2dc053404feb Sage Weil 2009-10-06 3862 { 20cb34ae9e4b00 Sage Weil 2010-05-12 3863 union { 20cb34ae9e4b00 Sage Weil 2010-05-12 3864 struct ceph_mds_cap_reconnect v2; 20cb34ae9e4b00 Sage Weil 2010-05-12 3865 struct ceph_mds_cap_reconnect_v1 v1; 20cb34ae9e4b00 Sage Weil 2010-05-12 3866 } rec; b3f8d68f38a879 Yan, Zheng 2017-09-11 3867 struct ceph_inode_info *ci = cap->ci; 20cb34ae9e4b00 Sage Weil 2010-05-12 3868 struct ceph_reconnect_state *recon_state = arg; 20cb34ae9e4b00 Sage Weil 2010-05-12 3869 struct ceph_pagelist *pagelist = recon_state->pagelist; a33f6432b3a63a Yan, Zheng 2020-08-11 3870 struct dentry *dentry; a33f6432b3a63a Yan, Zheng 2020-08-11 3871 char *path; ee2a095d3b24f3 Xiubo Li 2021-11-30 3872 int pathlen = 0, err; a33f6432b3a63a Yan, Zheng 2020-08-11 3873 u64 pathbase; 3469ed0d149ba7 Yan, Zheng 2016-07-05 3874 u64 snap_follows; 2f2dc053404feb Sage Weil 2009-10-06 3875 2f2dc053404feb Sage Weil 2009-10-06 3876 dout(" adding %p ino %llx.%llx cap %p %lld %s\n", 2f2dc053404feb Sage Weil 2009-10-06 3877 inode, ceph_vinop(inode), cap, cap->cap_id, 2f2dc053404feb Sage Weil 2009-10-06 3878 ceph_cap_string(cap->issued)); 2f2dc053404feb Sage Weil 2009-10-06 3879 a33f6432b3a63a Yan, Zheng 2020-08-11 3880 dentry = d_find_primary(inode); a33f6432b3a63a Yan, Zheng 2020-08-11 3881 if (dentry) { a33f6432b3a63a Yan, Zheng 2020-08-11 3882 /* set pathbase to parent dir when msg_version >= 2 */ a33f6432b3a63a Yan, Zheng 2020-08-11 3883 path = ceph_mdsc_build_path(dentry, &pathlen, &pathbase, a33f6432b3a63a Yan, Zheng 2020-08-11 3884 recon_state->msg_version >= 2); a33f6432b3a63a Yan, Zheng 2020-08-11 3885 dput(dentry); a33f6432b3a63a Yan, Zheng 2020-08-11 3886 if (IS_ERR(path)) { a33f6432b3a63a Yan, Zheng 2020-08-11 3887 err = PTR_ERR(path); a33f6432b3a63a Yan, Zheng 2020-08-11 3888 goto out_err; a33f6432b3a63a Yan, Zheng 2020-08-11 3889 } a33f6432b3a63a Yan, Zheng 2020-08-11 3890 } else { a33f6432b3a63a Yan, Zheng 2020-08-11 3891 path = NULL; a33f6432b3a63a Yan, Zheng 2020-08-11 3892 pathbase = 0; a33f6432b3a63a Yan, Zheng 2020-08-11 3893 } a33f6432b3a63a Yan, Zheng 2020-08-11 3894 be655596b3de58 Sage Weil 2011-11-30 3895 spin_lock(&ci->i_ceph_lock); 2f2dc053404feb Sage Weil 2009-10-06 3896 cap->seq = 0; /* reset cap seq */ 2f2dc053404feb Sage Weil 2009-10-06 3897 cap->issue_seq = 0; /* and issue_seq */ 667ca05cd9f02f Yan, Zheng 2013-05-31 3898 cap->mseq = 0; /* and migrate_seq */ 52d60f8e18b855 Jeff Layton 2021-06-04 3899 cap->cap_gen = atomic_read(&cap->session->s_cap_gen); 20cb34ae9e4b00 Sage Weil 2010-05-12 3900 a25949b99003b7 Jeff Layton 2020-02-18 3901 /* These are lost when the session goes away */ 785892fe88f693 Jeff Layton 2020-01-02 3902 if (S_ISDIR(inode->i_mode)) { 785892fe88f693 Jeff Layton 2020-01-02 3903 if (cap->issued & CEPH_CAP_DIR_CREATE) { 785892fe88f693 Jeff Layton 2020-01-02 3904 ceph_put_string(rcu_dereference_raw(ci->i_cached_layout.pool_ns)); 785892fe88f693 Jeff Layton 2020-01-02 3905 memset(&ci->i_cached_layout, 0, sizeof(ci->i_cached_layout)); 785892fe88f693 Jeff Layton 2020-01-02 3906 } a25949b99003b7 Jeff Layton 2020-02-18 3907 cap->issued &= ~CEPH_CAP_ANY_DIR_OPS; 785892fe88f693 Jeff Layton 2020-01-02 3908 } a25949b99003b7 Jeff Layton 2020-02-18 3909 121f22a19a3057 Yan, Zheng 2016-07-04 3910 if (recon_state->msg_version >= 2) { 20cb34ae9e4b00 Sage Weil 2010-05-12 3911 rec.v2.cap_id = cpu_to_le64(cap->cap_id); 20cb34ae9e4b00 Sage Weil 2010-05-12 3912 rec.v2.wanted = cpu_to_le32(__ceph_caps_wanted(ci)); 20cb34ae9e4b00 Sage Weil 2010-05-12 3913 rec.v2.issued = cpu_to_le32(cap->issued); 20cb34ae9e4b00 Sage Weil 2010-05-12 3914 rec.v2.snaprealm = cpu_to_le64(ci->i_snap_realm->ino); a33f6432b3a63a Yan, Zheng 2020-08-11 @3915 rec.v2.pathbase = cpu_to_le64(pathbase); ec1dff25b0a012 Jeff Layton 2017-10-31 3916 rec.v2.flock_len = (__force __le32) ec1dff25b0a012 Jeff Layton 2017-10-31 3917 ((ci->i_ceph_flags & CEPH_I_ERROR_FILELOCK) ? 0 : 1); 20cb34ae9e4b00 Sage Weil 2010-05-12 3918 } else { 20cb34ae9e4b00 Sage Weil 2010-05-12 3919 rec.v1.cap_id = cpu_to_le64(cap->cap_id); 20cb34ae9e4b00 Sage Weil 2010-05-12 3920 rec.v1.wanted = cpu_to_le32(__ceph_caps_wanted(ci)); 20cb34ae9e4b00 Sage Weil 2010-05-12 3921 rec.v1.issued = cpu_to_le32(cap->issued); 2d6795fbb8c34e Jeff Layton 2021-04-09 3922 rec.v1.size = cpu_to_le64(i_size_read(inode)); 9bbeab41ce5054 Arnd Bergmann 2018-07-13 3923 ceph_encode_timespec64(&rec.v1.mtime, &inode->i_mtime); 9bbeab41ce5054 Arnd Bergmann 2018-07-13 3924 ceph_encode_timespec64(&rec.v1.atime, &inode->i_atime); 20cb34ae9e4b00 Sage Weil 2010-05-12 3925 rec.v1.snaprealm = cpu_to_le64(ci->i_snap_realm->ino); a33f6432b3a63a Yan, Zheng 2020-08-11 3926 rec.v1.pathbase = cpu_to_le64(pathbase); 20cb34ae9e4b00 Sage Weil 2010-05-12 3927 } 3469ed0d149ba7 Yan, Zheng 2016-07-05 3928 3469ed0d149ba7 Yan, Zheng 2016-07-05 3929 if (list_empty(&ci->i_cap_snaps)) { 92776fd2c230f8 Yan, Zheng 2017-08-16 3930 snap_follows = ci->i_head_snapc ? ci->i_head_snapc->seq : 0; 3469ed0d149ba7 Yan, Zheng 2016-07-05 3931 } else { 3469ed0d149ba7 Yan, Zheng 2016-07-05 3932 struct ceph_cap_snap *capsnap = 3469ed0d149ba7 Yan, Zheng 2016-07-05 3933 list_first_entry(&ci->i_cap_snaps, 3469ed0d149ba7 Yan, Zheng 2016-07-05 3934 struct ceph_cap_snap, ci_item); 3469ed0d149ba7 Yan, Zheng 2016-07-05 3935 snap_follows = capsnap->follows; 20cb34ae9e4b00 Sage Weil 2010-05-12 3936 } be655596b3de58 Sage Weil 2011-11-30 3937 spin_unlock(&ci->i_ceph_lock); 2f2dc053404feb Sage Weil 2009-10-06 3938 121f22a19a3057 Yan, Zheng 2016-07-04 3939 if (recon_state->msg_version >= 2) { 40819f6fb227c1 Greg Farnum 2010-08-02 3940 int num_fcntl_locks, num_flock_locks; 4deb14a2593dfa Yan, Zheng 2017-09-11 3941 struct ceph_filelock *flocks = NULL; 81c5a1487e52a3 Yan, Zheng 2019-01-01 3942 size_t struct_len, total_len = sizeof(u64); 121f22a19a3057 Yan, Zheng 2016-07-04 3943 u8 struct_v = 0; 40819f6fb227c1 Greg Farnum 2010-08-02 3944 39be95e9c8c0b5 Jim Schutt 2013-05-15 3945 encode_again: b3f8d68f38a879 Yan, Zheng 2017-09-11 3946 if (rec.v2.flock_len) { 39be95e9c8c0b5 Jim Schutt 2013-05-15 3947 ceph_count_locks(inode, &num_fcntl_locks, &num_flock_locks); b3f8d68f38a879 Yan, Zheng 2017-09-11 3948 } else { b3f8d68f38a879 Yan, Zheng 2017-09-11 3949 num_fcntl_locks = 0; b3f8d68f38a879 Yan, Zheng 2017-09-11 3950 num_flock_locks = 0; b3f8d68f38a879 Yan, Zheng 2017-09-11 3951 } 4deb14a2593dfa Yan, Zheng 2017-09-11 3952 if (num_fcntl_locks + num_flock_locks > 0) { 6da2ec56059c3c Kees Cook 2018-06-12 3953 flocks = kmalloc_array(num_fcntl_locks + num_flock_locks, 6da2ec56059c3c Kees Cook 2018-06-12 3954 sizeof(struct ceph_filelock), 6da2ec56059c3c Kees Cook 2018-06-12 3955 GFP_NOFS); 39be95e9c8c0b5 Jim Schutt 2013-05-15 3956 if (!flocks) { 39be95e9c8c0b5 Jim Schutt 2013-05-15 3957 err = -ENOMEM; 5ccedf1ccd710b Yan, Zheng 2018-12-13 3958 goto out_err; 39be95e9c8c0b5 Jim Schutt 2013-05-15 3959 } 39be95e9c8c0b5 Jim Schutt 2013-05-15 3960 err = ceph_encode_locks_to_buffer(inode, flocks, 39be95e9c8c0b5 Jim Schutt 2013-05-15 3961 num_fcntl_locks, 39be95e9c8c0b5 Jim Schutt 2013-05-15 3962 num_flock_locks); 39be95e9c8c0b5 Jim Schutt 2013-05-15 3963 if (err) { 39be95e9c8c0b5 Jim Schutt 2013-05-15 3964 kfree(flocks); 4deb14a2593dfa Yan, Zheng 2017-09-11 3965 flocks = NULL; 39be95e9c8c0b5 Jim Schutt 2013-05-15 3966 if (err == -ENOSPC) 39be95e9c8c0b5 Jim Schutt 2013-05-15 3967 goto encode_again; 5ccedf1ccd710b Yan, Zheng 2018-12-13 3968 goto out_err; 39be95e9c8c0b5 Jim Schutt 2013-05-15 3969 } 4deb14a2593dfa Yan, Zheng 2017-09-11 3970 } else { 4deb14a2593dfa Yan, Zheng 2017-09-11 3971 kfree(flocks); 4deb14a2593dfa Yan, Zheng 2017-09-11 3972 flocks = NULL; 4deb14a2593dfa Yan, Zheng 2017-09-11 3973 } 121f22a19a3057 Yan, Zheng 2016-07-04 3974 121f22a19a3057 Yan, Zheng 2016-07-04 3975 if (recon_state->msg_version >= 3) { 121f22a19a3057 Yan, Zheng 2016-07-04 3976 /* version, compat_version and struct_len */ 81c5a1487e52a3 Yan, Zheng 2019-01-01 3977 total_len += 2 * sizeof(u8) + sizeof(u32); 3469ed0d149ba7 Yan, Zheng 2016-07-05 3978 struct_v = 2; 121f22a19a3057 Yan, Zheng 2016-07-04 3979 } 39be95e9c8c0b5 Jim Schutt 2013-05-15 3980 /* 39be95e9c8c0b5 Jim Schutt 2013-05-15 3981 * number of encoded locks is stable, so copy to pagelist 39be95e9c8c0b5 Jim Schutt 2013-05-15 3982 */ 121f22a19a3057 Yan, Zheng 2016-07-04 3983 struct_len = 2 * sizeof(u32) + 40819f6fb227c1 Greg Farnum 2010-08-02 3984 (num_fcntl_locks + num_flock_locks) * 121f22a19a3057 Yan, Zheng 2016-07-04 3985 sizeof(struct ceph_filelock); 121f22a19a3057 Yan, Zheng 2016-07-04 3986 rec.v2.flock_len = cpu_to_le32(struct_len); 121f22a19a3057 Yan, Zheng 2016-07-04 3987 a33f6432b3a63a Yan, Zheng 2020-08-11 3988 struct_len += sizeof(u32) + pathlen + sizeof(rec.v2); 121f22a19a3057 Yan, Zheng 2016-07-04 3989 3469ed0d149ba7 Yan, Zheng 2016-07-05 3990 if (struct_v >= 2) 3469ed0d149ba7 Yan, Zheng 2016-07-05 3991 struct_len += sizeof(u64); /* snap_follows */ 3469ed0d149ba7 Yan, Zheng 2016-07-05 3992 121f22a19a3057 Yan, Zheng 2016-07-04 3993 total_len += struct_len; 81c5a1487e52a3 Yan, Zheng 2019-01-01 3994 81c5a1487e52a3 Yan, Zheng 2019-01-01 3995 if (pagelist->length + total_len > RECONNECT_MAX_SIZE) { 81c5a1487e52a3 Yan, Zheng 2019-01-01 3996 err = send_reconnect_partial(recon_state); 81c5a1487e52a3 Yan, Zheng 2019-01-01 3997 if (err) 81c5a1487e52a3 Yan, Zheng 2019-01-01 3998 goto out_freeflocks; 81c5a1487e52a3 Yan, Zheng 2019-01-01 3999 pagelist = recon_state->pagelist; 5ccedf1ccd710b Yan, Zheng 2018-12-13 4000 } 121f22a19a3057 Yan, Zheng 2016-07-04 4001 81c5a1487e52a3 Yan, Zheng 2019-01-01 4002 err = ceph_pagelist_reserve(pagelist, total_len); 81c5a1487e52a3 Yan, Zheng 2019-01-01 4003 if (err) 81c5a1487e52a3 Yan, Zheng 2019-01-01 4004 goto out_freeflocks; 81c5a1487e52a3 Yan, Zheng 2019-01-01 4005 81c5a1487e52a3 Yan, Zheng 2019-01-01 4006 ceph_pagelist_encode_64(pagelist, ceph_ino(inode)); 121f22a19a3057 Yan, Zheng 2016-07-04 4007 if (recon_state->msg_version >= 3) { 121f22a19a3057 Yan, Zheng 2016-07-04 4008 ceph_pagelist_encode_8(pagelist, struct_v); 121f22a19a3057 Yan, Zheng 2016-07-04 4009 ceph_pagelist_encode_8(pagelist, 1); 121f22a19a3057 Yan, Zheng 2016-07-04 4010 ceph_pagelist_encode_32(pagelist, struct_len); 121f22a19a3057 Yan, Zheng 2016-07-04 4011 } a33f6432b3a63a Yan, Zheng 2020-08-11 4012 ceph_pagelist_encode_string(pagelist, path, pathlen); 121f22a19a3057 Yan, Zheng 2016-07-04 4013 ceph_pagelist_append(pagelist, &rec, sizeof(rec.v2)); 121f22a19a3057 Yan, Zheng 2016-07-04 4014 ceph_locks_to_pagelist(flocks, pagelist, 5ccedf1ccd710b Yan, Zheng 2018-12-13 4015 num_fcntl_locks, num_flock_locks); 3469ed0d149ba7 Yan, Zheng 2016-07-05 4016 if (struct_v >= 2) 3469ed0d149ba7 Yan, Zheng 2016-07-05 4017 ceph_pagelist_encode_64(pagelist, snap_follows); 81c5a1487e52a3 Yan, Zheng 2019-01-01 4018 out_freeflocks: 39be95e9c8c0b5 Jim Schutt 2013-05-15 4019 kfree(flocks); 3612abbd5df6ba Sage Weil 2010-09-07 4020 } else { 5ccedf1ccd710b Yan, Zheng 2018-12-13 4021 err = ceph_pagelist_reserve(pagelist, 81c5a1487e52a3 Yan, Zheng 2019-01-01 4022 sizeof(u64) + sizeof(u32) + 81c5a1487e52a3 Yan, Zheng 2019-01-01 4023 pathlen + sizeof(rec.v1)); a33f6432b3a63a Yan, Zheng 2020-08-11 4024 if (err) a33f6432b3a63a Yan, Zheng 2020-08-11 4025 goto out_err; 5ccedf1ccd710b Yan, Zheng 2018-12-13 4026 81c5a1487e52a3 Yan, Zheng 2019-01-01 4027 ceph_pagelist_encode_64(pagelist, ceph_ino(inode)); 121f22a19a3057 Yan, Zheng 2016-07-04 4028 ceph_pagelist_encode_string(pagelist, path, pathlen); 121f22a19a3057 Yan, Zheng 2016-07-04 4029 ceph_pagelist_append(pagelist, &rec, sizeof(rec.v1)); 40819f6fb227c1 Greg Farnum 2010-08-02 4030 } 44c99757fae80e Yan, Zheng 2013-09-22 4031 5ccedf1ccd710b Yan, Zheng 2018-12-13 4032 out_err: a33f6432b3a63a Yan, Zheng 2020-08-11 4033 ceph_mdsc_free_path(path, pathlen); a33f6432b3a63a Yan, Zheng 2020-08-11 4034 if (!err) 81c5a1487e52a3 Yan, Zheng 2019-01-01 4035 recon_state->nr_caps++; 81c5a1487e52a3 Yan, Zheng 2019-01-01 4036 return err; 81c5a1487e52a3 Yan, Zheng 2019-01-01 4037 } 81c5a1487e52a3 Yan, Zheng 2019-01-01 4038 :::::: The code at line 3915 was first introduced by commit :::::: a33f6432b3a63a4909dbbb0967f7c9df8ff2de91 ceph: encode inodes' parent/d_name in cap reconnect message :::::: TO: Yan, Zheng <[email protected]> :::::: CC: Ilya Dryomov <[email protected]> --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/[email protected] _______________________________________________ kbuild mailing list -- [email protected] To unsubscribe send an email to [email protected]
