• Christian Brauner's avatar
    fs: don't copy to userspace under namespace semaphore · cb54ef4f
    Christian Brauner authored
    Don't copy mount ids to userspace while holding the namespace semaphore.
    We really shouldn't do that and I've gone through lenghts avoiding that
    in statmount() already.
    
    Limit the number of mounts that can be retrieved in one go to 1 million
    mount ids. That's effectively 10 times the default limt of 100000 mounts
    that we put on each mount namespace by default. Since listmount() is an
    iterator limiting the number of mounts retrievable in one go isn't a
    problem as userspace can just pick up where they left off.
    
    Karel menti_ned that libmount will probably be reading the mount table
    in "in small steps, 512 nodes per request. Nobody likes a tool that
    takes too long in the kernel, and huge servers are unusual use cases.
    Libmount will very probably provide API to define size of the step (IDs
    per request)."
    Reported-by: default avatarMateusz Guzik <mjguzik@gmail.com>
    Link: https://lore.kernel.org/r/20240610-frettchen-liberal-a9a5c53865f8@braunerSigned-off-by: default avatarChristian Brauner <brauner@kernel.org>
    cb54ef4f
namespace.c 135 KB