From: Yu Kuai yukuai3@huawei.com
hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/IB5UKT
--------------------------------
Currently cookie is combined with:
csum + acc + key
However csum only exist for data cookie from mainline, hence if new location is set, skip csum for volume to keep cachefile location the same as mainline.
Noted that csum construction for data cookie is also different from mainline, and following patches will adapt this.
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 53643600fd1b..89dac9b90c45 100644 --- a/fs/cachefiles/key.c +++ b/fs/cachefiles/key.c @@ -30,11 +30,15 @@ static void cachefiles_cook_acc(char *key, unsigned int acc, int *len) *len += 2; }
-static int cachefiles_cook_csum(const u8 *raw, int keylen, char *key) +static int cachefiles_cook_csum(struct fscache_cookie *cookie, const u8 *raw, + int keylen, char *key) { unsigned char csum = 0; int loop;
+ if (volume_new_location(cookie)) + return 1; + for (loop = 0; loop < keylen; loop++) csum += raw[loop]; sprintf(key, "@%02x%c+", (unsigned int) csum, 0); @@ -98,7 +102,7 @@ char *cachefiles_cook_key(struct cachefiles_object *object, if (!key) return NULL;
- len = cachefiles_cook_csum(raw, keylen, key); + len = cachefiles_cook_csum(cookie, raw, keylen, key); mark = len - 1;
if (print) {