• Mateusz Guzik's avatar
    cifs: delay super block destruction until all cifsFileInfo objects are gone · 24261fc2
    Mateusz Guzik authored
    cifsFileInfo objects hold references to dentries and it is possible that
    these will still be around in workqueues when VFS decides to kill super
    block during unmount.
    
    This results in panics like this one:
    BUG: Dentry ffff88001f5e76c0{i=66b4a,n=1M-2} still in use (1) [unmount of cifs cifs]
    ------------[ cut here ]------------
    kernel BUG at fs/dcache.c:943!
    [..]
    Process umount (pid: 1781, threadinfo ffff88003d6e8000, task ffff880035eeaec0)
    [..]
    Call Trace:
     [<ffffffff811b44f3>] shrink_dcache_for_umount+0x33/0x60
     [<ffffffff8119f7fc>] generic_shutdown_super+0x2c/0xe0
     [<ffffffff8119f946>] kill_anon_super+0x16/0x30
     [<ffffffffa036623a>] cifs_kill_sb+0x1a/0x30 [cifs]
     [<ffffffff8119fcc7>] deactivate_locked_super+0x57/0x80
     [<ffffffff811a085e>] deactivate_super+0x4e/0x70
     [<ffffffff811bb417>] mntput_no_expire+0xd7/0x130
     [<ffffffff811bc30c>] sys_umount+0x9c/0x3c0
     [<ffffffff81657c19>] system_call_fastpath+0x16/0x1b
    
    Fix this by making each cifsFileInfo object hold a reference to cifs
    super block, which implicitly keeps VFS super block around as well.
    Signed-off-by: default avatarMateusz Guzik <mguzik@redhat.com>
    Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
    Cc: <stable@vger.kernel.org>
    Reported-and-Tested-by: default avatarBen Greear <greearb@candelatech.com>
    Signed-off-by: default avatarSteve French <sfrench@us.ibm.com>
    24261fc2
cifsfs.h 5.87 KB