From: kernel test robot <lkp@intel.com>
To: Damien Le Moal <damien.lemoal@wdc.com>, linux-fsdevel@vger.kernel.org
Cc: kbuild-all@lists.01.org, clang-built-linux@googlegroups.com,
Johannes Thumshirn <johannes.thumshirn@wdc.com>
Subject: Re: [PATCH 2/2] zonefs: Fix O_APPEND async write handling
Date: Mon, 15 Mar 2021 15:15:50 +0800 [thread overview]
Message-ID: <202103151548.W9MG3wiF-lkp@intel.com> (raw)
In-Reply-To: <20210315034919.87980-3-damien.lemoal@wdc.com>
[-- Attachment #1: Type: text/plain, Size: 5167 bytes --]
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 <lkp@intel.com>
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
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34930 bytes --]
next prev parent reply other threads:[~2021-03-15 7:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-15 3:49 [PATCH 0/2] zonefs fixes Damien Le Moal
2021-03-15 3:49 ` [PATCH 1/2] zonefs: prevent use of seq files as swap file Damien Le Moal
2021-03-15 6:46 ` Johannes Thumshirn
2021-03-15 7:23 ` Damien Le Moal
2021-03-15 3:49 ` [PATCH 2/2] zonefs: Fix O_APPEND async write handling Damien Le Moal
2021-03-15 7:14 ` Johannes Thumshirn
2021-03-15 7:15 ` kernel test robot [this message]
2021-03-15 7:21 ` Johannes Thumshirn
2021-03-15 7:22 ` Damien Le Moal
2021-03-15 17:08 ` Nathan Chancellor
2021-03-16 1:11 ` Damien Le Moal
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=202103151548.W9MG3wiF-lkp@intel.com \
--to=lkp@intel.com \
--cc=clang-built-linux@googlegroups.com \
--cc=damien.lemoal@wdc.com \
--cc=johannes.thumshirn@wdc.com \
--cc=kbuild-all@lists.01.org \
--cc=linux-fsdevel@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).