mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
fix(metanode): fix tx bug in concurrent use case.
Signed-off-by: Victor1319 <zengxuewei@oppo.com>
This commit is contained in:
parent
79ce6ff6cf
commit
d3fa6c9244
@ -94,6 +94,11 @@ func (mp *metaPartition) Apply(command []byte, index uint64) (resp interface{},
|
||||
if inoOnce, err = InodeOnceUnmarshal(msg.V); err != nil {
|
||||
return
|
||||
}
|
||||
status := mp.inodeInTx(inoOnce.Inode)
|
||||
if status != proto.OpOk {
|
||||
resp = &InodeResponse{Status: status}
|
||||
return
|
||||
}
|
||||
ino := NewInode(inoOnce.Inode, 0)
|
||||
ino.setVer(inoOnce.VerSeq)
|
||||
resp = mp.fsmUnlinkInode(ino, inoOnce.UniqID)
|
||||
@ -125,6 +130,11 @@ func (mp *metaPartition) Apply(command []byte, index uint64) (resp interface{},
|
||||
if inoOnce, err = InodeOnceUnmarshal(msg.V); err != nil {
|
||||
return
|
||||
}
|
||||
status := mp.inodeInTx(inoOnce.Inode)
|
||||
if status != proto.OpOk {
|
||||
resp = &InodeResponse{Status: status}
|
||||
return
|
||||
}
|
||||
ino := NewInode(inoOnce.Inode, 0)
|
||||
resp = mp.fsmCreateLinkInode(ino, inoOnce.UniqID)
|
||||
case opFSMEvictInode:
|
||||
|
||||
@ -64,6 +64,13 @@ func (mp *metaPartition) fsmTxCreateDentry(txDentry *TxDentry) (status uint8) {
|
||||
}
|
||||
}()
|
||||
|
||||
item := mp.dentryTree.Get(txDentry.Dentry)
|
||||
if item != nil {
|
||||
log.LogWarnf("fsmTxCreateDentry: got wrong dentry, want %v, got %v", txDentry.Dentry, item)
|
||||
status = proto.OpExistErr
|
||||
return
|
||||
}
|
||||
|
||||
return mp.fsmCreateDentry(txDentry.Dentry, false)
|
||||
}
|
||||
|
||||
|
||||
@ -263,6 +263,13 @@ func (mp *metaPartition) fsmTxUnlinkInode(txIno *TxInode) (resp *InodeResponse)
|
||||
}
|
||||
}()
|
||||
|
||||
item := mp.inodeTree.Get(txIno.Inode)
|
||||
if item == nil || item.(*Inode).IsTempFile() {
|
||||
resp.Status = proto.OpNotExistErr
|
||||
log.LogWarnf("fsmTxUnlinkInode: inode may be already not exist or link 0, txInode %v, item %v", txIno, item)
|
||||
return
|
||||
}
|
||||
|
||||
resp = mp.fsmUnlinkInode(txIno.Inode, 0)
|
||||
if resp.Status != proto.OpOk {
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user