[LU-16465] truncate does not update the LSOM blocks correctly Created: 12/Jan/23 Updated: 25/Apr/23 Resolved: 22/Apr/23 |
|
| Status: | Resolved |
| Project: | Lustre |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | Lustre 2.16.0 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Etienne Aujames | Assignee: | Etienne Aujames |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Severity: | 3 | ||||||||
| Rank (Obsolete): | 9223372036854775807 | ||||||||
| Description |
[root@client client]# touch test [root@client client]# dd if=/dev/zero of=test bs=1M count=2 conv=fsync 2+0 records in 2+0 records out 2097152 bytes (2.1 MB) copied, 0.0265768 s, 78.9 MB/s [root@client client]# lfs getsom test && stat test file: test size: 2097152 blocks: 0 flags: 4 File: ‘test’ Size: 2097152 Blocks: 4096 IO Block: 4194304 regular file Device: 481510a2h/1209340066d Inode: 144115205289279523 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2023-01-12 20:41:15.000000000 +0100 Modify: 2023-01-12 20:41:28.000000000 +0100 Change: 2023-01-12 20:41:28.000000000 +0100 Birth: - [root@client client]# cat test [root@client client]# lfs getsom test && stat test file: test size: 2097152 blocks: 4096 flags: 4 <--- inode i_blocks are update by the open-close File: ‘test’ Size: 2097152 Blocks: 4096 IO Block: 4194304 regular file Device: 481510a2h/1209340066d Inode: 144115205289279523 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2023-01-12 20:41:39.000000000 +0100 Modify: 2023-01-12 20:41:28.000000000 +0100 Change: 2023-01-12 20:41:28.000000000 +0100 Birth: - [root@client client]# truncate -s1K test [root@client client]# lfs getsom test && stat test file: test size: 1024 blocks: 4096 flags: 4 <--- inode i_blocks are not update after the truncate, so close request sends the old value File: ‘test’ Size: 1024 Blocks: 8 IO Block: 4194304 regular file Device: 481510a2h/1209340066d Inode: 144115205289279523 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2023-01-12 20:41:39.000000000 +0100 Modify: 2023-01-12 20:42:27.000000000 +0100 Change: 2023-01-12 20:42:27.000000000 +0100 Birth: - [root@client client]# cat test [root@client client]# lfs getsom test && stat test file: test size: 1024 blocks: 4096 flags: 4 <---- MDT denies blocks update from the client (only truncate are allowed to decrease the blocks count). File: ‘test’ Size: 1024 Blocks: 8 IO Block: 4194304 regular file Device: 481510a2h/1209340066d Inode: 144115205289279523 Links: 1 Access: (0644/-rw-r--r--) Uid: ( 0/ root) Gid: ( 0/ root) Access: 2023-01-12 20:42:56.000000000 +0100 Modify: 2023-01-12 20:42:27.000000000 +0100 Change: 2023-01-12 20:42:27.000000000 +0100 Birth: - On the MDT: int mdt_lsom_update(struct mdt_thread_info *info, struct mdt_object *o, bool truncate) .... if (!(la->la_valid & (LA_SIZE | LA_LSIZE) && o->mot_lsom_size < la->la_size) && !(la->la_valid & (LA_BLOCKS | LA_LBLOCKS) && o->mot_lsom_blocks < la->la_blocks) && !truncate && <---- refuse to update LSOM from close request if new_blocks_value < old_blocks_value o->mot_lsom_inited) RETURN(0); .... |
| Comments |
| Comment by Gerrit Updater [ 18/Jan/23 ] |
|
"Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/49675 |
| Comment by Gerrit Updater [ 11/Apr/23 ] |
|
"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/49675/ |
| Comment by Gerrit Updater [ 11/Apr/23 ] |
|
"Oleg Drokin <green@whamcloud.com>" uploaded a new patch: https://review.whamcloud.com/c/fs/lustre-release/+/50606 |
| Comment by Gerrit Updater [ 22/Apr/23 ] |
|
"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/c/fs/lustre-release/+/50606/ |
| Comment by Peter Jones [ 22/Apr/23 ] |
|
Landed for 2.16 |