From: Yu Kuai yukuai3@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT
--------------------------------
cachefile of data cookie is combined with:
hulk-5.10: csum + acc + key mainline: key_hash + key
Hence convert to use key_hash as csum, so that cachefile location is the same as mainline.
Signed-off-by: Yu Kuai yukuai3@huawei.com Signed-off-by: Baokun Li libaokun1@huawei.com --- fs/cachefiles/key.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/cachefiles/key.c b/fs/cachefiles/key.c index 89dac9b90c45..2895ab1a38da 100644 --- a/fs/cachefiles/key.c +++ b/fs/cachefiles/key.c @@ -39,8 +39,12 @@ static int cachefiles_cook_csum(struct fscache_cookie *cookie, const u8 *raw, if (volume_new_location(cookie)) return 1;
- for (loop = 0; loop < keylen; loop++) - csum += raw[loop]; + if (data_new_location(cookie)) { + csum = (u8)cookie->key_hash; + } else { + for (loop = 0; loop < keylen; loop++) + csum += raw[loop]; + } sprintf(key, "@%02x%c+", (unsigned int) csum, 0);
return 5;