Skip to content

Commit

Permalink
NFSv4: Let CLAIM_PREVIOUS close the file immediately
Browse files Browse the repository at this point in the history
There is no need to use 'll' (type 'leavesToClose') here, as we're not
operating under any locks. It's perfectly fine to call into the VFS
directly.
  • Loading branch information
EdSchouten committed Aug 8, 2023
1 parent 78c8e16 commit 22e8ab3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/filesystem/virtual/nfsv4/base_program.go
Original file line number Diff line number Diff line change
Expand Up @@ -1714,7 +1714,7 @@ func (s *compoundState) txOpen(ctx context.Context, args *nfsv4.Open4args, oos *
); vs != virtual.StatusOK {
return &nfsv4.Open4res_default{Status: toNFSv4Status(vs)}
}
ll.leaves = append(ll.leaves, currentLeaf)
currentLeaf.VirtualClose()

p.enter()
isLocked = true
Expand Down
2 changes: 1 addition & 1 deletion pkg/filesystem/virtual/nfsv4/base_program_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3052,8 +3052,8 @@ func TestBaseProgramCompound_OP_OPEN(t *testing.T) {
clock.EXPECT().Now().Return(time.Unix(1019, 0))
clock.EXPECT().Now().Return(time.Unix(1020, 0))
leaf.EXPECT().VirtualOpenSelf(ctx, virtual.ShareMaskRead, &virtual.OpenExistingOptions{}, virtual.AttributesMask(0), gomock.Any())
clock.EXPECT().Now().Return(time.Unix(1021, 0))
leaf.EXPECT().VirtualClose()
clock.EXPECT().Now().Return(time.Unix(1021, 0))

res, err := program.NfsV4Nfsproc4Compound(ctx, &nfsv4_xdr.Compound4args{
Tag: "open",
Expand Down

0 comments on commit 22e8ab3

Please sign in to comment.