fs/nfs/localio.c:166: undefined reference to `nfs_to'

From: kernel test robot
Date: Wed Oct 02 2024 - 02:59:12 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: e32cde8d2bd7d251a8f9b434143977ddf13dcec6
commit: 70ba381e1a431245c137ed597ec6a05991c79bd9 nfs: add LOCALIO support
date: 9 days ago
config: x86_64-randconfig-002-20241002 (https://download.01.org/0day-ci/archive/20241002/202410021451.Dj3s8Owx-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241002/202410021451.Dj3s8Owx-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202410021451.Dj3s8Owx-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

ld: fs/nfs/localio.o: in function `nfs_local_iocb_alloc':
>> fs/nfs/localio.c:166: undefined reference to `nfs_to'
>> ld: fs/nfs/localio.c:166: undefined reference to `nfs_to'
>> ld: fs/nfs/localio.c:166: undefined reference to `nfs_to'
ld: fs/nfs/localio.o: in function `nfs_local_pgio_release':
fs/nfs/localio.c:220: undefined reference to `nfs_to'
ld: fs/nfs/localio.c:220: undefined reference to `nfs_to'
ld: fs/nfs/localio.o:fs/nfs/localio.c:220: more undefined references to `nfs_to' follow
ld: fs/nfs/localio.o: in function `nfs_local_disable':
>> fs/nfs/localio.c:80: undefined reference to `nfs_uuid_invalidate_one_client'
ld: fs/nfs/localio.o: in function `nfs_local_open_fh':
>> fs/nfs/localio.c:110: undefined reference to `nfs_open_local_fh'
ld: fs/nfs/localio.o: in function `nfs_local_doio':
fs/nfs/localio.c:443: undefined reference to `nfs_to'
ld: fs/nfs/localio.c:443: undefined reference to `nfs_to'
ld: fs/nfs/localio.c:468: undefined reference to `nfs_to'
ld: fs/nfs/localio.c:468: undefined reference to `nfs_to'
ld: fs/nfs/localio.o: in function `nfs_local_release_commit_data':
fs/nfs/localio.c:519: undefined reference to `nfs_to'
ld: fs/nfs/localio.o:fs/nfs/localio.c:519: more undefined references to `nfs_to' follow


vim +166 fs/nfs/localio.c

71
72 /*
73 * nfs_local_disable - disable local i/o for an nfs_client
74 */
75 void nfs_local_disable(struct nfs_client *clp)
76 {
77 spin_lock(&clp->cl_localio_lock);
78 if (test_and_clear_bit(NFS_CS_LOCAL_IO, &clp->cl_flags)) {
79 trace_nfs_local_disable(clp);
> 80 nfs_uuid_invalidate_one_client(&clp->cl_uuid);
81 }
82 spin_unlock(&clp->cl_localio_lock);
83 }
84
85 /*
86 * nfs_local_probe - probe local i/o support for an nfs_server and nfs_client
87 */
88 void nfs_local_probe(struct nfs_client *clp)
89 {
90 }
91 EXPORT_SYMBOL_GPL(nfs_local_probe);
92
93 /*
94 * nfs_local_open_fh - open a local filehandle in terms of nfsd_file
95 *
96 * Returns a pointer to a struct nfsd_file or NULL
97 */
98 struct nfsd_file *
99 nfs_local_open_fh(struct nfs_client *clp, const struct cred *cred,
100 struct nfs_fh *fh, const fmode_t mode)
101 {
102 struct nfsd_file *localio;
103 int status;
104
105 if (!nfs_server_is_local(clp))
106 return NULL;
107 if (mode & ~(FMODE_READ | FMODE_WRITE))
108 return NULL;
109
> 110 localio = nfs_open_local_fh(&clp->cl_uuid, clp->cl_rpcclient,
111 cred, fh, mode);
112 if (IS_ERR(localio)) {
113 status = PTR_ERR(localio);
114 trace_nfs_local_open_fh(fh, mode, status);
115 switch (status) {
116 case -ENOMEM:
117 case -ENXIO:
118 case -ENOENT:
119 nfs_local_disable(clp);
120 }
121 return NULL;
122 }
123 return localio;
124 }
125 EXPORT_SYMBOL_GPL(nfs_local_open_fh);
126
127 static struct bio_vec *
128 nfs_bvec_alloc_and_import_pagevec(struct page **pagevec,
129 unsigned int npages, gfp_t flags)
130 {
131 struct bio_vec *bvec, *p;
132
133 bvec = kmalloc_array(npages, sizeof(*bvec), flags);
134 if (bvec != NULL) {
135 for (p = bvec; npages > 0; p++, pagevec++, npages--) {
136 p->bv_page = *pagevec;
137 p->bv_len = PAGE_SIZE;
138 p->bv_offset = 0;
139 }
140 }
141 return bvec;
142 }
143
144 static void
145 nfs_local_iocb_free(struct nfs_local_kiocb *iocb)
146 {
147 kfree(iocb->bvec);
148 kfree(iocb);
149 }
150
151 static struct nfs_local_kiocb *
152 nfs_local_iocb_alloc(struct nfs_pgio_header *hdr,
153 struct nfsd_file *localio, gfp_t flags)
154 {
155 struct nfs_local_kiocb *iocb;
156
157 iocb = kmalloc(sizeof(*iocb), flags);
158 if (iocb == NULL)
159 return NULL;
160 iocb->bvec = nfs_bvec_alloc_and_import_pagevec(hdr->page_array.pagevec,
161 hdr->page_array.npages, flags);
162 if (iocb->bvec == NULL) {
163 kfree(iocb);
164 return NULL;
165 }
> 166 init_sync_kiocb(&iocb->kiocb, nfs_to->nfsd_file_file(localio));
167 iocb->kiocb.ki_pos = hdr->args.offset;
168 iocb->localio = localio;
169 iocb->hdr = hdr;
170 iocb->kiocb.ki_flags &= ~IOCB_APPEND;
171 return iocb;
172 }
173

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki