CC: [email protected]
CC: [email protected]
TO: Vivek Goyal <[email protected]>
CC: Miklos Szeredi <[email protected]>
CC: Stefan Hajnoczi <[email protected]>
CC: "Dr. David Alan Gilbert" <[email protected]>
CC: Liu Bo <[email protected]>
CC: Peng Tao <[email protected]>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git 
master
head:   d665ea6ea86c785760ee4bad4543dab3267ad074
commit: c2d0ad00d948de73c78f05d2b3e5bdfa605035cc virtiofs: implement dax 
read/write operations
date:   8 months ago
:::::: branch date: 4 hours ago
:::::: commit date: 8 months ago
config: i386-randconfig-m021-20210505 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <[email protected]>
Reported-by: Dan Carpenter <[email protected]>

New smatch warnings:
fs/fuse/dax.c:514 fuse_dax_read_iter() warn: inconsistent returns 
'&inode->i_rwsem'.
fs/fuse/dax.c:575 fuse_dax_write_iter() warn: inconsistent returns 
'&inode->i_rwsem'.

Old smatch warnings:
fs/fuse/dax.c:113 fuse_setup_one_mapping() warn: should 'start_idx << 21' be a 
64 bit type?
fs/fuse/dax.c:197 dmap_removemapping_list() error: uninitialized symbol 'ret'.

vim +514 fs/fuse/dax.c

c2d0ad00d948de Vivek Goyal 2020-08-19  497  
c2d0ad00d948de Vivek Goyal 2020-08-19  498  ssize_t fuse_dax_read_iter(struct 
kiocb *iocb, struct iov_iter *to)
c2d0ad00d948de Vivek Goyal 2020-08-19  499  {
c2d0ad00d948de Vivek Goyal 2020-08-19  500      struct inode *inode = 
file_inode(iocb->ki_filp);
c2d0ad00d948de Vivek Goyal 2020-08-19  501      ssize_t ret;
c2d0ad00d948de Vivek Goyal 2020-08-19  502  
c2d0ad00d948de Vivek Goyal 2020-08-19  503      if (iocb->ki_flags & 
IOCB_NOWAIT) {
c2d0ad00d948de Vivek Goyal 2020-08-19  504              if 
(!inode_trylock_shared(inode))
c2d0ad00d948de Vivek Goyal 2020-08-19  505                      return -EAGAIN;
c2d0ad00d948de Vivek Goyal 2020-08-19  506      } else {
c2d0ad00d948de Vivek Goyal 2020-08-19  507              
inode_lock_shared(inode);
c2d0ad00d948de Vivek Goyal 2020-08-19  508      }
c2d0ad00d948de Vivek Goyal 2020-08-19  509  
c2d0ad00d948de Vivek Goyal 2020-08-19  510      ret = dax_iomap_rw(iocb, to, 
&fuse_iomap_ops);
c2d0ad00d948de Vivek Goyal 2020-08-19  511      inode_unlock_shared(inode);
c2d0ad00d948de Vivek Goyal 2020-08-19  512  
c2d0ad00d948de Vivek Goyal 2020-08-19  513      /* TODO 
file_accessed(iocb->f_filp) */
c2d0ad00d948de Vivek Goyal 2020-08-19 @514      return ret;
c2d0ad00d948de Vivek Goyal 2020-08-19  515  }
c2d0ad00d948de Vivek Goyal 2020-08-19  516  
c2d0ad00d948de Vivek Goyal 2020-08-19  517  static bool 
file_extending_write(struct kiocb *iocb, struct iov_iter *from)
c2d0ad00d948de Vivek Goyal 2020-08-19  518  {
c2d0ad00d948de Vivek Goyal 2020-08-19  519      struct inode *inode = 
file_inode(iocb->ki_filp);
c2d0ad00d948de Vivek Goyal 2020-08-19  520  
c2d0ad00d948de Vivek Goyal 2020-08-19  521      return (iov_iter_rw(from) == 
WRITE &&
c2d0ad00d948de Vivek Goyal 2020-08-19  522              ((iocb->ki_pos) >= 
i_size_read(inode) ||
c2d0ad00d948de Vivek Goyal 2020-08-19  523                (iocb->ki_pos + 
iov_iter_count(from) > i_size_read(inode))));
c2d0ad00d948de Vivek Goyal 2020-08-19  524  }
c2d0ad00d948de Vivek Goyal 2020-08-19  525  
c2d0ad00d948de Vivek Goyal 2020-08-19  526  static ssize_t 
fuse_dax_direct_write(struct kiocb *iocb, struct iov_iter *from)
c2d0ad00d948de Vivek Goyal 2020-08-19  527  {
c2d0ad00d948de Vivek Goyal 2020-08-19  528      struct inode *inode = 
file_inode(iocb->ki_filp);
c2d0ad00d948de Vivek Goyal 2020-08-19  529      struct fuse_io_priv io = 
FUSE_IO_PRIV_SYNC(iocb);
c2d0ad00d948de Vivek Goyal 2020-08-19  530      ssize_t ret;
c2d0ad00d948de Vivek Goyal 2020-08-19  531  
c2d0ad00d948de Vivek Goyal 2020-08-19  532      ret = fuse_direct_io(&io, from, 
&iocb->ki_pos, FUSE_DIO_WRITE);
c2d0ad00d948de Vivek Goyal 2020-08-19  533      if (ret < 0)
c2d0ad00d948de Vivek Goyal 2020-08-19  534              return ret;
c2d0ad00d948de Vivek Goyal 2020-08-19  535  
c2d0ad00d948de Vivek Goyal 2020-08-19  536      fuse_invalidate_attr(inode);
c2d0ad00d948de Vivek Goyal 2020-08-19  537      fuse_write_update_size(inode, 
iocb->ki_pos);
c2d0ad00d948de Vivek Goyal 2020-08-19  538      return ret;
c2d0ad00d948de Vivek Goyal 2020-08-19  539  }
c2d0ad00d948de Vivek Goyal 2020-08-19  540  
c2d0ad00d948de Vivek Goyal 2020-08-19  541  ssize_t fuse_dax_write_iter(struct 
kiocb *iocb, struct iov_iter *from)
c2d0ad00d948de Vivek Goyal 2020-08-19  542  {
c2d0ad00d948de Vivek Goyal 2020-08-19  543      struct inode *inode = 
file_inode(iocb->ki_filp);
c2d0ad00d948de Vivek Goyal 2020-08-19  544      ssize_t ret;
c2d0ad00d948de Vivek Goyal 2020-08-19  545  
c2d0ad00d948de Vivek Goyal 2020-08-19  546      if (iocb->ki_flags & 
IOCB_NOWAIT) {
c2d0ad00d948de Vivek Goyal 2020-08-19  547              if 
(!inode_trylock(inode))
c2d0ad00d948de Vivek Goyal 2020-08-19  548                      return -EAGAIN;
c2d0ad00d948de Vivek Goyal 2020-08-19  549      } else {
c2d0ad00d948de Vivek Goyal 2020-08-19  550              inode_lock(inode);
c2d0ad00d948de Vivek Goyal 2020-08-19  551      }
c2d0ad00d948de Vivek Goyal 2020-08-19  552  
c2d0ad00d948de Vivek Goyal 2020-08-19  553      ret = 
generic_write_checks(iocb, from);
c2d0ad00d948de Vivek Goyal 2020-08-19  554      if (ret <= 0)
c2d0ad00d948de Vivek Goyal 2020-08-19  555              goto out;
c2d0ad00d948de Vivek Goyal 2020-08-19  556  
c2d0ad00d948de Vivek Goyal 2020-08-19  557      ret = 
file_remove_privs(iocb->ki_filp);
c2d0ad00d948de Vivek Goyal 2020-08-19  558      if (ret)
c2d0ad00d948de Vivek Goyal 2020-08-19  559              goto out;
c2d0ad00d948de Vivek Goyal 2020-08-19  560      /* TODO file_update_time() but 
we don't want metadata I/O */
c2d0ad00d948de Vivek Goyal 2020-08-19  561  
c2d0ad00d948de Vivek Goyal 2020-08-19  562      /* Do not use dax for file 
extending writes as write and on
c2d0ad00d948de Vivek Goyal 2020-08-19  563       * disk i_size increase are not 
atomic otherwise.
c2d0ad00d948de Vivek Goyal 2020-08-19  564       */
c2d0ad00d948de Vivek Goyal 2020-08-19  565      if (file_extending_write(iocb, 
from))
c2d0ad00d948de Vivek Goyal 2020-08-19  566              ret = 
fuse_dax_direct_write(iocb, from);
c2d0ad00d948de Vivek Goyal 2020-08-19  567      else
c2d0ad00d948de Vivek Goyal 2020-08-19  568              ret = 
dax_iomap_rw(iocb, from, &fuse_iomap_ops);
c2d0ad00d948de Vivek Goyal 2020-08-19  569  
c2d0ad00d948de Vivek Goyal 2020-08-19  570  out:
c2d0ad00d948de Vivek Goyal 2020-08-19  571      inode_unlock(inode);
c2d0ad00d948de Vivek Goyal 2020-08-19  572  
c2d0ad00d948de Vivek Goyal 2020-08-19  573      if (ret > 0)
c2d0ad00d948de Vivek Goyal 2020-08-19  574              ret = 
generic_write_sync(iocb, ret);
c2d0ad00d948de Vivek Goyal 2020-08-19 @575      return ret;
c2d0ad00d948de Vivek Goyal 2020-08-19  576  }
c2d0ad00d948de Vivek Goyal 2020-08-19  577  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/[email protected]

Attachment: .config.gz
Description: application/gzip

_______________________________________________
kbuild mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to