diff options
author | Jan Kara <jack@suse.cz> | 2016-11-23 13:47:57 +0100 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2016-11-30 08:36:54 +0100 |
commit | 2a64f80ee3ab47dc0114e077ea27903c97882138 (patch) | |
tree | 1d07451b22176490840eda1efb0637e6e450e063 /fs/ocfs2/quota_global.c | |
parent | 9d1ccbe70e0b14545caad12dc73adb3605447df0 (diff) | |
download | op-kernel-dev-2a64f80ee3ab47dc0114e077ea27903c97882138.zip op-kernel-dev-2a64f80ee3ab47dc0114e077ea27903c97882138.tar.gz |
ocfs2: Protect periodic quota syncing with s_umount semaphore
New quota locking rules will require s_umount semaphore for all quota
scanning functions. Add is for periodic quota syncing.
Tested-by: Eric Ren <zren@suse.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/ocfs2/quota_global.c')
-rw-r--r-- | fs/ocfs2/quota_global.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/ocfs2/quota_global.c b/fs/ocfs2/quota_global.c index 87e577a..cec495a 100644 --- a/fs/ocfs2/quota_global.c +++ b/fs/ocfs2/quota_global.c @@ -634,7 +634,15 @@ static void qsync_work_fn(struct work_struct *work) dqi_sync_work.work); struct super_block *sb = oinfo->dqi_gqinode->i_sb; - dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); + /* + * We have to be careful here not to deadlock on s_umount as umount + * disabling quotas may be in progress and it waits for this work to + * complete. If trylock fails, we'll do the sync next time... + */ + if (down_read_trylock(&sb->s_umount)) { + dquot_scan_active(sb, ocfs2_sync_dquot_helper, oinfo->dqi_type); + up_read(&sb->s_umount); + } schedule_delayed_work(&oinfo->dqi_sync_work, msecs_to_jiffies(oinfo->dqi_syncms)); } |