• Kent Overstreet's avatar
    bcachefs: Fix sysfs warning in fstests generic/730,731 · 5e3b7232
    Kent Overstreet authored
    sysfs warns if we're removing a symlink from a directory that's no
    longer in sysfs; this is triggered by fstests generic/730, which
    simulates hot removal of a block device.
    
    This patch is however not a correct fix, since checking
    kobj->state_in_sysfs on a kobj owned by another subsystem is racy.
    
    A better fix would be to add the appropriate check to
    sysfs_remove_link() - and sysfs_create_link() as well.
    
    But kobject_add_internal()/kobject_del() do not as of today have locking
    that would support that.
    
    Note that the block/holder.c code appears to be subject to this race as
    well.
    
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Cc: "Rafael J. Wysocki" <rafael@kernel.org>
    Cc:  Christoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarKent Overstreet <kent.overstreet@linux.dev>
    5e3b7232
super.c 50.4 KB