Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rwlock to open file #681

Merged
merged 5 commits into from
Jul 24, 2021
Merged

Add rwlock to open file #681

merged 5 commits into from
Jul 24, 2021

Conversation

davies
Copy link
Contributor

@davies davies commented Jul 23, 2021

There is a race accessing cached chunks, so we should add a rwlock to fix that.

@davies
Copy link
Contributor Author

davies commented Jul 23, 2021

logging before bus error

504055: TRUNCATE UP     from 0x8a0c (35340) to 0x17264 (94820)
504056: MAPWRITE        0x1097c (67964) thru 0x17263 (94819)	(0x68e8 (26856) bytes)
504057: MAPWRITE        0xe24 (3620) thru 0x7e13 (32275)	(0x6ff0 (28656) bytes)
504058: WRITE           0x768c (30348) thru 0xd85b (55387)	(0x61d0 (25040) bytes)
504059: MAPREAD         0x4b24 (19236) thru 0xaab7 (43703)	(0x5f94 (24468) bytes)
504060: MAPREAD         0xeb28 (60200) thru 0x17263 (94819)	(0x873c (34620) bytes)
504061: WRITE           0xb478 (46200) thru 0x135eb (79339)	(0x8174 (33140) bytes)
504062: MAPREAD         0x16760 (92000) thru 0x16ca7 (93351)	(0x548 (1352) bytes)
504063: TRUNCATE DOWN   from 0x17264 (94820) to 0x77c4 (30660)
504064: TRUNCATE UP     from 0x77c4 (30660) to 0x123f4 (74740)
504065: READ            0x13c (316) thru 0x58af (22703)	(0x5774 (22388) bytes)
504066: WRITE           0x7ba8 (31656) thru 0xdcd3 (56531)	(0x612c (24876) bytes)
504067: READ            0x3550 (13648) thru 0xfbdb (64475)	(0xc68c (50828) bytes)
504068: TRUNCATE DOWN   from 0x123f4 (74740) to 0x3d10 (15632)
extend file size from 0x3d10 (15632) to 0x186a0 (100000)
504069: TRUNCATE UP     from 0x3d10 (15632) to 0x186a0 (100000)
504070: MAPWRITE        0xb0d0 (45264) thru 0x1869f (99999)	(0xd5d0 (54736) bytes)
Bus error

acesslog

2021.07.23 23:44:53.050964 [uid:0,gid:0,pid:25327] setattr (62162,0x248,[size=74740;]): OK (62162,[-rw-r--r--:0100644,1,0,0,1627054445,1627055093,1627055093,74740]) <0.000278>
2021.07.23 23:44:53.051332 [uid:0,gid:0,pid:25327] read (62162,65536,0): OK (65536) <0.000255>
2021.07.23 23:44:53.051547 [uid:0,gid:0,pid:25327] getattr (62162): OK (62162,[-rw-r--r--:0100644,1,0,0,1627054445,1627055093,1627055093,74740]) <0.000120>
2021.07.23 23:44:53.051668 [uid:0,gid:0,pid:25327] write (62162,24876,31656): OK <0.000014>
2021.07.23 23:44:53.051805 [uid:0,gid:0,pid:25327] getattr (62162): OK (62162,[-rw-r--r--:0100644,1,0,0,1627054445,1627055093,1627055093,74740]) <0.000079>
2021.07.23 23:44:53.053039 [uid:0,gid:0,pid:25327] setattr (62162,0x248,[size=15632;]): OK (62162,[-rw-r--r--:0100644,1,0,0,1627054445,1627055093,1627055093,15632]) <0.000723>
2021.07.23 23:44:53.053213 [uid:0,gid:0,pid:25327] read (62162,12288,65536): OK (0) <0.001266>
2021.07.23 23:44:53.053418 [uid:0,gid:0,pid:25327] getattr (62162): OK (62162,[-rw-r--r--:0100644,1,0,0,1627054445,1627055093,1627055093,15632]) <0.000099>
2021.07.23 23:44:53.053860 [uid:0,gid:0,pid:25327] setattr (62162,0x248,[size=100000;]): OK (62162,[-rw-r--r--:0100644,1,0,0,1627054445,1627055093,1627055093,100000]) <0.000339>
2021.07.23 23:44:53.054237 [uid:0,gid:0,pid:25327] read (62162,102400,0): OK (67232) <0.000232>
2021.07.23 23:44:53.054513 [uid:0,gid:0,pid:0] write (62162,22176,45056): OK <0.000017>
2021.07.23 23:44:53.055282 [uid:0,gid:0,pid:25327] flush (62162): OK <0.000608>
2021.07.23 23:44:53.055851 [uid:0,gid:0,pid:0] release (62162): OK <0.000012>

It could be case that read() returned few number of bytes (67232) than expected (100000)

@davies davies merged commit 37a64d6 into main Jul 24, 2021
@davies davies deleted the lock_chunk branch July 24, 2021 01:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant