Skip to content

Commit

Permalink
fusefrontend: sharedstorage: add warnings for lock failure
Browse files Browse the repository at this point in the history
Complain loudly when the underlying storage does not support
byte-range locks.

#754
  • Loading branch information
rfjakob committed Dec 4, 2024
1 parent bc0879f commit 4645bfa
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion internal/fusefrontend/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@ func (f *File) Read(ctx context.Context, buf []byte, off int64) (resultData fuse
blocks := f.contentEnc.ExplodePlainRange(uint64(off), uint64(len(buf)))
alignedOffset, alignedLength := blocks[0].JointCiphertextRange(blocks)
if err := f.LockSharedStorage(unix.F_RDLCK, int64(alignedOffset), int64(alignedLength)); err != nil {
tlog.Warn.Printf("ino%d: FUSE Read: LockSharedStorage(F_RDLCK, %d, %d) failed: %v", f.qIno.Ino, alignedOffset, alignedLength, err)
return nil, fs.ToErrno(err)
}
out, errno = f.doRead(buf[:0], uint64(off), uint64(len(buf)))
Expand Down Expand Up @@ -290,7 +291,7 @@ func (f *File) doWrite(data []byte, off int64) (uint32, syscall.Errno) {
// If the file ID is not cached, read it from disk
if f.fileTableEntry.ID == nil {
if err := f.LockSharedStorage(unix.F_WRLCK, 0, contentenc.HeaderLen); err != nil {
tlog.Warn.Printf("ino%d: LockSharedStorage(F_WRLCK, %d, %d)failed: %v", 0, f.qIno.Ino, contentenc.HeaderLen, err)
tlog.Warn.Printf("ino%d: doWrite: LockSharedStorage(F_WRLCK, %d, %d) failed: %v", f.qIno.Ino, 0, contentenc.HeaderLen, err)
return 0, fs.ToErrno(err)
}
var err error
Expand Down

0 comments on commit 4645bfa

Please sign in to comment.