[PATCH] nvmet: Reset ns->file when open fails
kernel test robot
lkp at intel.com
Wed May 12 05:59:59 PDT 2021
Hi Daniel,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on linux/master]
[also build test WARNING on hch-configfs/for-next linus/master v5.13-rc1 next-20210512]
[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/Daniel-Wagner/nvmet-Reset-ns-file-when-open-fails/20210512-181435
base: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git dd860052c99b1e088352bdd4fb7aef46f8d2ef47
config: i386-randconfig-s002-20210512 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/406c65a33980a0f58f21c897d9283d9fff9a4eb5
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Daniel-Wagner/nvmet-Reset-ns-file-when-open-fails/20210512-181435
git checkout 406c65a33980a0f58f21c897d9283d9fff9a4eb5
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' W=1 ARCH=i386
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
sparse warnings: (new ones prefixed by >>)
>> drivers/nvme/target/io-cmd-file.c:54:21: sparse: sparse: incorrect type in assignment (different base types) @@ expected int ret @@ got struct file *file @@
drivers/nvme/target/io-cmd-file.c:54:21: sparse: expected int ret
drivers/nvme/target/io-cmd-file.c:54:21: sparse: got struct file *file
vim +54 drivers/nvme/target/io-cmd-file.c
41
42 int nvmet_file_ns_enable(struct nvmet_ns *ns)
43 {
44 int flags = O_RDWR | O_LARGEFILE;
45 int ret;
46
47 if (!ns->buffered_io)
48 flags |= O_DIRECT;
49
50 ns->file = filp_open(ns->device_path, flags, 0);
51 if (IS_ERR(ns->file)) {
52 pr_err("failed to open file %s: (%ld)\n",
53 ns->device_path, PTR_ERR(ns->file));
> 54 ret = ns->file;
55 ns->file = NULL;
56 return PTR_ERR(ret);
57 }
58
59 ret = nvmet_file_ns_revalidate(ns);
60 if (ret)
61 goto err;
62
63 /*
64 * i_blkbits can be greater than the universally accepted upper bound,
65 * so make sure we export a sane namespace lba_shift.
66 */
67 ns->blksize_shift = min_t(u8,
68 file_inode(ns->file)->i_blkbits, 12);
69
70 ns->bvec_cache = kmem_cache_create("nvmet-bvec",
71 NVMET_MAX_MPOOL_BVEC * sizeof(struct bio_vec),
72 0, SLAB_HWCACHE_ALIGN, NULL);
73 if (!ns->bvec_cache) {
74 ret = -ENOMEM;
75 goto err;
76 }
77
78 ns->bvec_pool = mempool_create(NVMET_MIN_MPOOL_OBJ, mempool_alloc_slab,
79 mempool_free_slab, ns->bvec_cache);
80
81 if (!ns->bvec_pool) {
82 ret = -ENOMEM;
83 goto err;
84 }
85
86 return ret;
87 err:
88 ns->size = 0;
89 ns->blksize_shift = 0;
90 nvmet_file_ns_disable(ns);
91 return ret;
92 }
93
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 35598 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-nvme/attachments/20210512/079423b9/attachment-0001.gz>
More information about the Linux-nvme
mailing list