Skip to content

Commit

Permalink
Do not show or assimilate lock files
Browse files Browse the repository at this point in the history
  • Loading branch information
aduffeck committed Jul 17, 2024
1 parent c1723d7 commit e730667
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/storage/fs/posix/tree/assimilation.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ func (t *Tree) WarmupIDCache(root string, assimilate bool) error {
}

// skip lock files
if strings.HasSuffix(path, ".flock") || strings.HasSuffix(path, ".mlock") {
if isLockFile(path) {
return nil
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/fs/posix/tree/gpfswatchfolderwatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func (w *GpfsWatchFolderWatcher) Watch(topic string) {
continue
}

if strings.HasSuffix(lwev.Path, ".flock") || strings.HasSuffix(lwev.Path, ".mlock") {
if isLockFile(lwev.Path) {
continue
}

Expand Down
3 changes: 1 addition & 2 deletions pkg/storage/fs/posix/tree/inotifywatcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tree

import (
"fmt"
"strings"

"github.com/pablodz/inotifywaitgo/inotifywaitgo"
)
Expand Down Expand Up @@ -43,7 +42,7 @@ func (iw *InotifyWatcher) Watch(path string) {
select {
case event := <-events:
for _, e := range event.Events {
if strings.HasSuffix(event.Filename, ".flock") || strings.HasSuffix(event.Filename, ".mlock") {
if isLockFile(event.Filename) {
continue
}
switch e {
Expand Down
8 changes: 8 additions & 0 deletions pkg/storage/fs/posix/tree/tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ func (t *Tree) ListFolder(ctx context.Context, n *node.Node) ([]*node.Node, erro
g.Go(func() error {
defer close(work)
for _, name := range names {
if isLockFile(name) {
continue
}

select {
case work <- name:
case <-ctx.Done():
Expand Down Expand Up @@ -878,3 +882,7 @@ func (t *Tree) readRecycleItem(ctx context.Context, spaceID, key, path string) (

return
}

func isLockFile(path string) bool {
return strings.HasSuffix(path, ".lock") || strings.HasSuffix(path, ".flock") || strings.HasSuffix(path, ".mlock")
}

0 comments on commit e730667

Please sign in to comment.