• Jan Kara's avatar
    quota: Use s_umount protection for quota operations · 9d1ccbe7
    Jan Kara authored
    Writeback quota is protected by s_umount semaphore held for reading
    because every writeback must be protected by that lock (grabbed either
    by the generic writeback code or by quotactl handler). Getting next
    available ID in quota file, querying quota state, setting quota
    information, getting quota format are all quotactl operations protected
    by s_umount semaphore held for reading grabbed in quotactl handler.
    
    This also fixes lockdep splat about possible deadlock during filesystem
    freezing where sync_filesystem() is called with page-faults already
    blocked but sync_filesystem() calls into dquot_writeback_dquots() which
    grabs dqonoff_mutex which ranks above i_mutex (vfs_load_quota_inode()
    grabs i_mutex under dqonoff_mutex) which clearly ranks below page fault
    freeze protection (e.g. via mmap_sem dependencies). The reported problem
    is not a real deadlock possibility since during quota on we check
    whether filesystem freezing is not in progress but still it is good to
    have this fixed.
    Reported-by: default avatarTed Tso <tytso@mit.edu>
    Reported-by: default avatarEric Whitney <enwlinux@gmail.com>
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    9d1ccbe7
dquot.c 78.9 KB