ovl: make sure that real fid is 32bit aligned in memory
authorAmir Goldstein <amir73il@gmail.com>
Fri, 15 Nov 2019 11:33:03 +0000 (13:33 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Tue, 10 Dec 2019 15:00:55 +0000 (16:00 +0100)
commitcbe7fba8edfc8cb8e621599e376f8ac5c224fa72
tree59d6d9ebeb101e85f23544f25103fa9690898aad
parent7e63c87fc2dcf3be9d3aab82d4a0ea085880bdca
ovl: make sure that real fid is 32bit aligned in memory

Seprate on-disk encoding from in-memory and on-wire resresentation
of overlay file handle.

In-memory and on-wire we only ever pass around pointers to struct
ovl_fh, which encapsulates at offset 3 the on-disk format struct
ovl_fb. struct ovl_fb encapsulates at offset 21 the real file handle.
That makes sure that the real file handle is always 32bit aligned
in-memory when passed down to the underlying filesystem.

On-disk format remains the same and store/load are done into
correctly aligned buffer.

New nfs exported file handles are exported with aligned real fid.
Old nfs file handles are copied to an aligned buffer before being
decoded.

Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/overlayfs/copy_up.c
fs/overlayfs/export.c
fs/overlayfs/namei.c
fs/overlayfs/overlayfs.h