Hi Damien, I love your patch! Perhaps something to improve: [auto build test WARNING on linus/master] [also build test WARNING on v5.12-rc3 next-20210315] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/0day-ci/linux/commits/Damien-Le-Moal/zonefs-fixes/20210315-115123 base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 1e28eed17697bcf343c6743f0028cc3b5dd88bf0 config: x86_64-randconfig-a013-20210315 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project a28facba1ccdc957f386b7753f4958307f1bfde8) 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 # install x86_64 cross compiling tool for clang build # apt-get install binutils-x86-64-linux-gnu # https://github.com/0day-ci/linux/commit/1e8bb76723bbf4072c032334104026a611b2634e git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review Damien-Le-Moal/zonefs-fixes/20210315-115123 git checkout 1e8bb76723bbf4072c032334104026a611b2634e # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot All warnings (new ones prefixed by >>): >> fs/zonefs/super.c:844:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (count <= 0) ^~~~~~~~~~ fs/zonefs/super.c:881:9: note: uninitialized use occurs here return ret; ^~~ fs/zonefs/super.c:844:2: note: remove the 'if' if its condition is always false if (count <= 0) ^~~~~~~~~~~~~~~ fs/zonefs/super.c:825:13: note: initialize the variable 'ret' to silence this warning ssize_t ret, count; ^ = 0 1 warning generated. vim +844 fs/zonefs/super.c 807 808 /* 809 * Handle direct writes. For sequential zone files, this is the only possible 810 * write path. For these files, check that the user is issuing writes 811 * sequentially from the end of the file. This code assumes that the block layer 812 * delivers write requests to the device in sequential order. This is always the 813 * case if a block IO scheduler implementing the ELEVATOR_F_ZBD_SEQ_WRITE 814 * elevator feature is being used (e.g. mq-deadline). The block layer always 815 * automatically select such an elevator for zoned block devices during the 816 * device initialization. 817 */ 818 static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from) 819 { 820 struct inode *inode = file_inode(iocb->ki_filp); 821 struct zonefs_inode_info *zi = ZONEFS_I(inode); 822 struct super_block *sb = inode->i_sb; 823 bool sync = is_sync_kiocb(iocb); 824 bool append = false; 825 ssize_t ret, count; 826 827 /* 828 * For async direct IOs to sequential zone files, refuse IOCB_NOWAIT 829 * as this can cause write reordering (e.g. the first aio gets EAGAIN 830 * on the inode lock but the second goes through but is now unaligned). 831 */ 832 if (zi->i_ztype == ZONEFS_ZTYPE_SEQ && !sync && 833 (iocb->ki_flags & IOCB_NOWAIT)) 834 return -EOPNOTSUPP; 835 836 if (iocb->ki_flags & IOCB_NOWAIT) { 837 if (!inode_trylock(inode)) 838 return -EAGAIN; 839 } else { 840 inode_lock(inode); 841 } 842 843 count = zonefs_write_checks(iocb, from); > 844 if (count <= 0) 845 goto inode_unlock; 846 847 if ((iocb->ki_pos | count) & (sb->s_blocksize - 1)) { 848 ret = -EINVAL; 849 goto inode_unlock; 850 } 851 852 /* Enforce sequential writes (append only) in sequential zones */ 853 if (zi->i_ztype == ZONEFS_ZTYPE_SEQ) { 854 mutex_lock(&zi->i_truncate_mutex); 855 if (iocb->ki_pos != zi->i_wpoffset) { 856 mutex_unlock(&zi->i_truncate_mutex); 857 ret = -EINVAL; 858 goto inode_unlock; 859 } 860 mutex_unlock(&zi->i_truncate_mutex); 861 append = sync; 862 } 863 864 if (append) 865 ret = zonefs_file_dio_append(iocb, from); 866 else 867 ret = iomap_dio_rw(iocb, from, &zonefs_iomap_ops, 868 &zonefs_write_dio_ops, 0); 869 if (zi->i_ztype == ZONEFS_ZTYPE_SEQ && 870 (ret > 0 || ret == -EIOCBQUEUED)) { 871 if (ret > 0) 872 count = ret; 873 mutex_lock(&zi->i_truncate_mutex); 874 zi->i_wpoffset += count; 875 mutex_unlock(&zi->i_truncate_mutex); 876 } 877 878 inode_unlock: 879 inode_unlock(inode); 880 881 return ret; 882 } 883 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org