46 #define NFSDBG_FACILITY NFSDBG_PNFS_LD
50 struct pnfs_layout_hdr *
55 objlay = kzalloc(
sizeof(
struct objlayout), gfp_flags);
60 dprintk(
"%s: Return %p\n", __func__, objlay);
72 dprintk(
"%s: objlay %p\n", __func__, objlay);
87 struct xdr_stream stream;
88 struct xdr_buf buf = {
97 dprintk(
"%s: Begin pnfslay %p\n", __func__, pnfslay);
108 dprintk(
"%s: objio_alloc_lseg Return err %d\n", __func__,
115 dprintk(
"%s: Return %p\n", __func__, lseg);
121 dprintk(
"%s: Err Return=>%d\n", __func__, status);
122 return ERR_PTR(status);
131 dprintk(
"%s: freeing layout segment %p\n", __func__, lseg);
163 struct page ***p_pages,
unsigned *p_pgbase,
171 BUG_ON(offset >= lseg_end_offset);
172 WARN_ON(offset + count > lseg_end_offset);
175 dprintk(
"%s: pgbase(0x%x) > PAGE_SIZE\n", __func__, *p_pgbase);
192 spin_lock(&objlay->
lock);
195 spin_unlock(&objlay->
lock);
220 dprintk(
"%s: err[%d]: errno=%d is_write=%d dev(%llx:%llx) "
221 "par=0x%llx obj=0x%llx offset=0x%llx length=0x%llx\n",
245 dprintk(
"%s enter\n", __func__);
262 objlayout_iodone(oir);
265 dprintk(
"%s: Return status=%zd eof=%d sync=%d\n", __func__,
266 status, rdata->
res.eof, sync);
284 loff_t offset = rdata->
args.offset;
285 size_t count = rdata->
args.count;
289 eof = i_size_read(inode);
290 if (
unlikely(offset + count > eof)) {
293 rdata->
res.count = 0;
301 rdata->
res.eof = (offset +
count) >= eof;
302 _fix_verify_io_params(hdr->
lseg, &rdata->
args.pages,
304 rdata->
args.offset, rdata->
args.count);
306 dprintk(
"%s: inode(%lx) offset 0x%llx count 0x%Zx eof=%d\n",
307 __func__, inode->
i_ino, offset, count, rdata->
res.eof);
313 dprintk(
"%s: Returned Error %d\n", __func__, err);
328 dprintk(
"%s enter\n", __func__);
347 objlayout_iodone(oir);
350 dprintk(
"%s: Return status %zd committed %d sync=%d\n", __func__,
351 status, wdata->
verf.committed, sync);
371 _fix_verify_io_params(hdr->
lseg, &wdata->
args.pages,
373 wdata->
args.offset, wdata->
args.count);
378 dprintk(
"%s: Returned Error %d\n", __func__, err);
386 struct xdr_stream *xdr,
389 struct objlayout *objlay = OBJLAYOUT(pnfslay);
393 dprintk(
"%s: Begin\n", __func__);
395 spin_lock(&objlay->
lock);
401 spin_unlock(&objlay->
lock);
409 dprintk(
"%s: Return delta_space_used %lld err %d\n", __func__,
414 err_prio(
u32 oer_errno)
444 u64 dest_end, src_end;
447 *dest_err = *src_err;
470 if (dest_end < src_end)
500 "is_write=%d dev(%llx:%llx) par=0x%llx "
501 "obj=0x%llx offset=0x%llx length=0x%llx\n",
511 merge_ioerr(&accumulated_err, ioerr);
522 struct xdr_stream *xdr,
525 struct objlayout *objlay = OBJLAYOUT(pnfslay);
529 dprintk(
"%s: Begin\n", __func__);
533 spin_lock(&objlay->
lock);
546 dprintk(
"%s: err[%d]: errno=%d is_write=%d "
547 "dev(%llx:%llx) par=0x%llx obj=0x%llx "
548 "offset=0x%llx length=0x%llx\n",
578 encode_accumulated_error(objlay, last_xdr);
585 spin_unlock(&objlay->
lock);
588 dprintk(
"%s: Return\n", __func__);
609 struct pnfs_device pd;
621 memcpy(&pd.dev_id, d_id,
sizeof(*d_id));
628 err = nfs4_proc_getdeviceinfo(NFS_SERVER(pnfslay->plh_inode), &pd);
629 dprintk(
"%s nfs_getdeviceinfo returned %d\n", __func__, err);
634 odi = kzalloc(
sizeof(*odi), gfp_flags);
641 *deviceaddr = &odi->
da;
679 static char *envp[] = {
"HOME=/",
681 "PATH=/sbin:/usr/sbin:/bin:/usr/bin",
688 dprintk(
"%s: osd_login_prog is disabled\n", __func__);
692 dprintk(
"%s uri: %s\n", __func__, login->
uri);
696 argv[0] = (
char *)osd_login_prog;
698 argv[2] = login->
uri;
705 ret = call_usermodehelper(argv[0], argv, envp,
UMH_WAIT_PROC);
714 "objlayoutdriver.osd_login_prog kernel parameter!\n",
716 osd_login_prog[0] =
'\0';
718 dprintk(
"%s %s return value: %d\n", __func__, osd_login_prog, ret);
724 static void __copy_nfsS_and_zero_terminate(
struct nfs4_string s,
725 char *
dest,
int max_len,
726 const char *var_name)
731 if (s.
len >= max_len) {
733 "objlayout_autologin: %s: s.len(%d) >= max_len(%d)",
734 var_name, s.
len, max_len);
753 "objlayout_autologin: systemid_len(%d) != OSD_SYSTEMID_LEN",
760 for (i = 0; i < s.
len; i++)
761 cur = hex_byte_pack(cur, s.
data[i]);
772 memset(&login, 0,
sizeof(login));
773 __copy_nfsS_and_zero_terminate(
775 login.
uri,
sizeof(login.
uri),
"URI");
777 __copy_nfsS_and_zero_terminate(
783 rc = __objlayout_upcall(&login);