Get HardLink test in //runsc/fsgofer:lisafs_test to pass.

This test was attempting to create a link with the same name as the target.
Changed that to use a different name for link. This test also exposed a ref
count bug in LISAFS RPC handlers. Fixed that.

Updates #8688

PiperOrigin-RevId: 516912550
This commit is contained in:
Ayush Ranjan
2023-03-15 13:26:13 -07:00
committed by gVisor bot
parent 6669003321
commit 8fb66eb289
2 changed files with 3 additions and 1 deletions
+1
View File
@@ -892,6 +892,7 @@ func LinkAtHandler(c *Connection, comm Communicator, payloadLen uint32) (uint32,
if err != nil {
return 0, err
}
defer targetFD.DecRef(nil)
if targetFD.IsDir() {
// Can not create hard link to directory.
return 0, unix.EPERM
+2 -1
View File
@@ -490,7 +490,8 @@ func testHardLink(ctx context.Context, t *testing.T, tester Tester, root lisafs.
defer closeFD(ctx, t, fd)
defer unix.Close(hostFD)
link, linkStat := link(ctx, t, root, name, controlFile)
linkName := "linkFile"
link, linkStat := link(ctx, t, root, linkName, controlFile)
defer closeFD(ctx, t, link)
if linkStat.Ino != fileIno.Ino {