Searched hist:"366911 cd762db02c2dd32fad1be96b72a66f205d" (Results 1 – 4 of 4) sorted by relevance
/openbmc/linux/fs/afs/ |
H A D | xdr_fs.h | diff 366911cd762db02c2dd32fad1be96b72a66f205d Wed Dec 23 04:39:57 CST 2020 David Howells <dhowells@redhat.com> afs: Fix directory entry size calculation
The number of dirent records used by an AFS directory entry should be calculated using the assumption that there is a 16-byte name field in the first block, rather than a 20-byte name field (which is actually the case). This miscalculation is historic and effectively standard, so we have to use it.
The calculation we need to use is:
1 + (((strlen(name) + 1) + 15) >> 5)
where we are adding one to the strlen() result to account for the NUL termination.
Fix this by the following means:
(1) Create an inline function to do the calculation for a given name length.
(2) Use the function to calculate the number of records used for a dirent in afs_dir_iterate_block().
Use this to move the over-end check out of the loop since it only needs to be done once.
Further use this to only go through the loop for the 2nd+ records composing an entry. The only test there now is for if the record is allocated - and we already checked the first block at the top of the outer loop.
(3) Add a max name length check in afs_dir_iterate_block().
(4) Make afs_edit_dir_add() and afs_edit_dir_remove() use the function from (1) to calculate the number of blocks rather than doing it incorrectly themselves.
Fixes: 63a4681ff39c ("afs: Locally edit directory data for mkdir/create/unlink/...") Fixes: ^1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Marc Dionne <marc.dionne@auristor.com>
|
H A D | dir_edit.c | diff 366911cd762db02c2dd32fad1be96b72a66f205d Wed Dec 23 04:39:57 CST 2020 David Howells <dhowells@redhat.com> afs: Fix directory entry size calculation
The number of dirent records used by an AFS directory entry should be calculated using the assumption that there is a 16-byte name field in the first block, rather than a 20-byte name field (which is actually the case). This miscalculation is historic and effectively standard, so we have to use it.
The calculation we need to use is:
1 + (((strlen(name) + 1) + 15) >> 5)
where we are adding one to the strlen() result to account for the NUL termination.
Fix this by the following means:
(1) Create an inline function to do the calculation for a given name length.
(2) Use the function to calculate the number of records used for a dirent in afs_dir_iterate_block().
Use this to move the over-end check out of the loop since it only needs to be done once.
Further use this to only go through the loop for the 2nd+ records composing an entry. The only test there now is for if the record is allocated - and we already checked the first block at the top of the outer loop.
(3) Add a max name length check in afs_dir_iterate_block().
(4) Make afs_edit_dir_add() and afs_edit_dir_remove() use the function from (1) to calculate the number of blocks rather than doing it incorrectly themselves.
Fixes: 63a4681ff39c ("afs: Locally edit directory data for mkdir/create/unlink/...") Fixes: ^1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Marc Dionne <marc.dionne@auristor.com>
|
H A D | dir.c | diff 366911cd762db02c2dd32fad1be96b72a66f205d Wed Dec 23 04:39:57 CST 2020 David Howells <dhowells@redhat.com> afs: Fix directory entry size calculation
The number of dirent records used by an AFS directory entry should be calculated using the assumption that there is a 16-byte name field in the first block, rather than a 20-byte name field (which is actually the case). This miscalculation is historic and effectively standard, so we have to use it.
The calculation we need to use is:
1 + (((strlen(name) + 1) + 15) >> 5)
where we are adding one to the strlen() result to account for the NUL termination.
Fix this by the following means:
(1) Create an inline function to do the calculation for a given name length.
(2) Use the function to calculate the number of records used for a dirent in afs_dir_iterate_block().
Use this to move the over-end check out of the loop since it only needs to be done once.
Further use this to only go through the loop for the 2nd+ records composing an entry. The only test there now is for if the record is allocated - and we already checked the first block at the top of the outer loop.
(3) Add a max name length check in afs_dir_iterate_block().
(4) Make afs_edit_dir_add() and afs_edit_dir_remove() use the function from (1) to calculate the number of blocks rather than doing it incorrectly themselves.
Fixes: 63a4681ff39c ("afs: Locally edit directory data for mkdir/create/unlink/...") Fixes: ^1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Marc Dionne <marc.dionne@auristor.com>
|
/openbmc/linux/include/trace/events/ |
H A D | afs.h | diff 366911cd762db02c2dd32fad1be96b72a66f205d Wed Dec 23 04:39:57 CST 2020 David Howells <dhowells@redhat.com> afs: Fix directory entry size calculation
The number of dirent records used by an AFS directory entry should be calculated using the assumption that there is a 16-byte name field in the first block, rather than a 20-byte name field (which is actually the case). This miscalculation is historic and effectively standard, so we have to use it.
The calculation we need to use is:
1 + (((strlen(name) + 1) + 15) >> 5)
where we are adding one to the strlen() result to account for the NUL termination.
Fix this by the following means:
(1) Create an inline function to do the calculation for a given name length.
(2) Use the function to calculate the number of records used for a dirent in afs_dir_iterate_block().
Use this to move the over-end check out of the loop since it only needs to be done once.
Further use this to only go through the loop for the 2nd+ records composing an entry. The only test there now is for if the record is allocated - and we already checked the first block at the top of the outer loop.
(3) Add a max name length check in afs_dir_iterate_block().
(4) Make afs_edit_dir_add() and afs_edit_dir_remove() use the function from (1) to calculate the number of blocks rather than doing it incorrectly themselves.
Fixes: 63a4681ff39c ("afs: Locally edit directory data for mkdir/create/unlink/...") Fixes: ^1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: David Howells <dhowells@redhat.com> Tested-by: Marc Dionne <marc.dionne@auristor.com>
|