You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The first lock self.disk_inode.write() is on L394. fn _resize is called on L396. The read and write locks of self.disk_inode are heavily used in fn _resize and its callees. fn _write_at is called L397, which calls fn _io_at on L352. The second lock is on L324 in fn _io_at.
There are two kinds of possible deadlock bugs in rcore-fs/rcore-fs-sfs/src/lib.rs:
Double-Lock:
rcore-fs/rcore-fs-sfs/src/lib.rs
Lines 394 to 397 in 1fb7c0e
The first lock
self.disk_inode.write()
is on L394.fn _resize
is called on L396. The read and write locks ofself.disk_inode
are heavily used infn _resize
and its callees.fn _write_at
is called L397, which callsfn _io_at
on L352. The second lock is on L324 infn _io_at
.rcore-fs/rcore-fs-sfs/src/lib.rs
Lines 351 to 352 in 1fb7c0e
rcore-fs/rcore-fs-sfs/src/lib.rs
Line 324 in 1fb7c0e
A simple
drop(disk_inode)
before L396 may fix the bugs. But we need to be careful about possible atomicity violations.Locks in conflicting orders:
self.super_block.write()
is called beforeself.free_map.write()
infn sync
.rcore-fs/rcore-fs-sfs/src/lib.rs
Lines 944 to 951 in 1fb7c0e
self.super_block.write()
is called afterself.free_map.write()
infn alloc_block
andfn free_block
.rcore-fs/rcore-fs-sfs/src/lib.rs
Lines 841 to 845 in 1fb7c0e
rcore-fs/rcore-fs-sfs/src/lib.rs
Lines 859 to 863 in 1fb7c0e
A possible fix is to move
self.free_map.write()
beforeself.super_block.write()
infn sync
.The text was updated successfully, but these errors were encountered: