[bug report] fuse: implement open in passthrough mode

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Amir Goldstein,

The patch 51deab7d21f5: "fuse: implement open in passthrough mode"
from Feb 9, 2024 (linux-next), leads to the following Smatch static
checker warning:

	fs/fuse/iomode.c:225 fuse_file_io_open()
	error: uninitialized symbol 'err'.

fs/fuse/iomode.c
    177 int fuse_file_io_open(struct file *file, struct inode *inode)
    178 {
    179         struct fuse_file *ff = file->private_data;
    180         struct fuse_inode *fi = get_fuse_inode(inode);
    181         int err;
    182 
    183         /*
    184          * io modes are not relevant with DAX and with server that does not
    185          * implement open.
    186          */
    187         if (FUSE_IS_DAX(inode) || !ff->args)
    188                 return 0;
    189 
    190         /*
    191          * Server is expected to use FOPEN_PASSTHROUGH for all opens of an inode
    192          * which is already open for passthrough.
    193          */
    194         if (fuse_inode_backing(fi) && !(ff->open_flags & FOPEN_PASSTHROUGH))
    195                 goto fail;

err not set on this path.

    196 
    197         /*
    198          * FOPEN_PARALLEL_DIRECT_WRITES requires FOPEN_DIRECT_IO.
    199          */
    200         if (!(ff->open_flags & FOPEN_DIRECT_IO))
    201                 ff->open_flags &= ~FOPEN_PARALLEL_DIRECT_WRITES;
    202 
    203         /*
    204          * First passthrough file open denies caching inode io mode.
    205          * First caching file open enters caching inode io mode.
    206          *
    207          * Note that if user opens a file open with O_DIRECT, but server did
    208          * not specify FOPEN_DIRECT_IO, a later fcntl() could remove O_DIRECT,
    209          * so we put the inode in caching mode to prevent parallel dio.
    210          */
    211         if ((ff->open_flags & FOPEN_DIRECT_IO) &&
    212             !(ff->open_flags & FOPEN_PASSTHROUGH))
    213                 return 0;
    214 
    215         if (ff->open_flags & FOPEN_PASSTHROUGH)
    216                 err = fuse_file_passthrough_open(inode, file);
    217         else
    218                 err = fuse_file_cached_io_start(inode, ff);
    219         if (err)
    220                 goto fail;
    221 
    222         return 0;
    223 
    224 fail:
--> 225         pr_debug("failed to open file in requested io mode (open_flags=0x%x, err=%i).\n",
    226                  ff->open_flags, err);
                                         ^^^

    227         /*
    228          * The file open mode determines the inode io mode.
    229          * Using incorrect open mode is a server mistake, which results in
    230          * user visible failure of open() with EIO error.
    231          */
    232         return -EIO;
    233 }

regards,
dan carpenter




[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [NTFS 3]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [NTFS 3]     [Samba]     [Device Mapper]     [CEPH Development]

  Powered by Linux