• Amir Goldstein's avatar
    ovl: fix lookup failure on multi lower squashfs · 7e63c87f
    Amir Goldstein authored
    In the past, overlayfs required that lower fs have non null uuid in
    order to support nfs export and decode copy up origin file handles.
    
    Commit 9df085f3 ("ovl: relax requirement for non null uuid of
    lower fs") relaxed this requirement for nfs export support, as long
    as uuid (even if null) is unique among all lower fs.
    
    However, said commit unintentionally also relaxed the non null uuid
    requirement for decoding copy up origin file handles, regardless of
    the unique uuid requirement.
    
    Amend this mistake by disabling decoding of copy up origin file handle
    from lower fs with a conflicting uuid.
    
    We still encode copy up origin file handles from those fs, because
    file handles like those already exist in the wild and because they
    might provide useful information in the future.
    
    There is an unhandled corner case described by Miklos this way:
    - two filesystems, A and B, both have null uuid
    - upper layer is on A
    - lower layer 1 is also on A
    - lower layer 2 is on B
    
    In this case bad_uuid won't be set for B, because the check only
    involves the list of lower fs.  Hence we'll try to decode a layer 2
    origin on layer 1 and fail.
    
    We will deal with this corner case later.
    Reported-by: default avatarColin Ian King <colin.king@canonical.com>
    Tested-by: default avatarColin Ian King <colin.king@canonical.com>
    Link: https://lore.kernel.org/lkml/20191106234301.283006-1-colin.king@canonical.com/
    Fixes: 9df085f3 ("ovl: relax requirement for non null uuid ...")
    Cc: stable@vger.kernel.org # v4.20+
    Signed-off-by: default avatarAmir Goldstein <amir73il@gmail.com>
    Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
    7e63c87f
super.c 42.1 KB