ref: 264f5a53b0c6e8ad5ed23a8ad89f0379fcc9f0fd
parent: be417f7391b034f397df39eb157ea212bfb46b1a
author: 9ferno <[email protected]>
date: Wed Nov 30 01:34:27 EST 2022
check the trailing path of Tdata blocks
--- a/find.c
+++ b/find.c
@@ -197,12 +197,12 @@
/* returns 0 for invalid, 1 for valid blocks */
u8
-checkvalid(u64 blkno, u8 dtag, u64 dpath, u8 tag, u64 qpath, u16 len)
+checkvalid(u64 blkno, u8 dtag, u64 dpath, u64 dqpath, u8 tag, u64 qpath, u16 len)
{
- if(dtag != tag || dpath != qpath){
+ if(dtag != tag || dpath != qpath || dqpath != qpath){
/* if(debug) */
- fprint(2, "checkvalid invalid %llud tag/path expected %s/%llud actual %s/%llud\n",
- blkno, tagnames[tag], qpath, tagnames[dtag], dpath);
+ fprint(2, "checkvalid invalid %llud tag/path expected %s/%llud actual %s/%llud %llud\n",
+ blkno, tagnames[tag], qpath, tagnames[dtag], dpath, dqpath);
fprint(2, "invalid used: %llud\n", blkno);
return 0;
}else if(debug)
--- a/iobuf.c
+++ b/iobuf.c
@@ -208,7 +208,6 @@
Iobuf *p;
Hiob *hp;
u64 nlocked, i;
- char buf[1024]={'\0'};
/* flush any unflushed data appended to the Tdentry */
Resync:
@@ -562,19 +561,20 @@
{
uintptr pc;
u16 ptag;
- u64 pqpath;
+ u64 pqpath, ppath;
if(tag == Tdata){
ptag = p->io->tag;
pqpath = p->io->path;
+ ppath = p->xiobuf[len*Blocksize -sizeof(u64)];
}else{
ptag = ((Dentry*)p->cur)->tag;
- pqpath = ((Dentry*)p->cur)->path;
+ pqpath = ppath = ((Dentry*)p->cur)->path;
}
if(len != p->len ||
tag != ptag ||
- (qpath != Qpnone && qpath != pqpath)){
+ (qpath != Qpnone && (pqpath != qpath || ppath != qpath))){
pc = getcallerpc(&p);
dprint(" tag = %G; expected %G; blkno = %llud\n",
@@ -582,18 +582,18 @@
if(qpath == Qpnone){
dprint("checktag pc=%p disk %s(block %llud) tag/path=%s/%llud;"
" expected %s len %llud p->len %llud\n",
- pc, devfile, (u64)p->blkno,
- tagnames[ptag], (u64)pqpath,
+ pc, devfile, p->blkno,
+ tagnames[ptag], pqpath,
tagnames[tag],
len, p->len);
} else {
- dprint(" tag/path = %G/%llux; expected %G/%llux\n",
- (uint)ptag, pqpath, tag, qpath);
- dprint("checktag pc=%p disk %s(block %llud) tag/path=%s/%llud;"
+ dprint(" tag/path = %G/%llux %llux; expected %G/%llux\n",
+ (uint)ptag, pqpath, ppath, tag, qpath);
+ dprint("checktag pc=%p disk %s(block %llud) tag/path=%s/%llud %llud;"
" expected %s/%llud\n",
- pc, devfile, (u64)p->blkno,
- tagnames[ptag], (u64)pqpath,
- tagnames[tag], (u64)qpath);
+ pc, devfile, p->blkno,
+ tagnames[ptag], pqpath, ppath,
+ tagnames[tag], qpath);
panic("checktag failed\n");
}
return 0;
--- a/sub.c
+++ b/sub.c
@@ -88,9 +88,10 @@
/* clear the buf to avoid leaks on reuse */
memset(buf->xiobuf, 0, len*Blocksize);
- if(tag == Tdata)
+ if(tag == Tdata){
buf->io->len = len;
- else
+ buf->xiobuf[len*Blocksize -sizeof(u64)] = qpath;
+ }else
recentmetadata(buf->m, &buf->cur, &buf->new);
settag(buf, tag, qpath);
return buf;