mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Handle Walk failure while attaching gofer client to attach path.
The Walk RPC can fail partially if an intermediate path component does not exist or is a symlink. In such a scenario, the RPC itself is successful but lisafs.WalkStatus is not WalkSuccess. It is possible that in such scenarios, 0 inodes are returned. Handle this in the gofer client code. PiperOrigin-RevId: 451945633
This commit is contained in:
@@ -551,8 +551,8 @@ func (fs *filesystem) initClientLisa(ctx context.Context) (lisafs.Inode, error)
|
||||
|
||||
// Close all intermediate FDs to the attach point.
|
||||
numInodes := len(inodes)
|
||||
for _, inode := range inodes[:numInodes-1] {
|
||||
curFD := fs.clientLisa.NewFD(inode.ControlFD)
|
||||
for i := 0; i < numInodes-1; i++ {
|
||||
curFD := fs.clientLisa.NewFD(inodes[i].ControlFD)
|
||||
curFD.Close(ctx, false /* flush */)
|
||||
}
|
||||
|
||||
@@ -560,8 +560,10 @@ func (fs *filesystem) initClientLisa(ctx context.Context) (lisafs.Inode, error)
|
||||
case lisafs.WalkSuccess:
|
||||
return inodes[numInodes-1], nil
|
||||
default:
|
||||
last := fs.clientLisa.NewFD(inodes[numInodes-1].ControlFD)
|
||||
last.Close(ctx, false /* flush */)
|
||||
if numInodes > 0 {
|
||||
last := fs.clientLisa.NewFD(inodes[numInodes-1].ControlFD)
|
||||
last.Close(ctx, false /* flush */)
|
||||
}
|
||||
log.Warningf("initClientLisa failed because walk to attach point %q failed: lisafs.WalkStatus = %v", fs.opts.aname, status)
|
||||
return lisafs.Inode{}, unix.ENOENT
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user