From 2b0b748fb6dce7989ee1d9fdb4fb96b21f53a3ae Mon Sep 17 00:00:00 2001 From: Evgeniy Polyakov Date: Fri, 17 Feb 2012 21:04:35 +0400 Subject: [PATCH] Use trylock when locking sync work, if lock fails, immediately queue work back --- fs/pohmelfs/super.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/pohmelfs/super.c b/fs/pohmelfs/super.c index a8519be826a..f6041f0f639 100644 --- a/fs/pohmelfs/super.c +++ b/fs/pohmelfs/super.c @@ -407,12 +407,16 @@ static void pohmelfs_sync(struct work_struct *work) { struct pohmelfs_sb *psb = container_of(to_delayed_work(work), struct pohmelfs_sb, sync_work); struct super_block *sb = psb->sb; + long timeout = msecs_to_jiffies(psb->sync_timeout * 1000); - down_read(&sb->s_umount); - sync_filesystem(sb); - up_read(&sb->s_umount); + if (down_read_trylock(&sb->s_umount)) { + sync_filesystem(sb); + up_read(&sb->s_umount); + } else { + timeout = 0; + } - queue_delayed_work(psb->wq, &psb->sync_work, msecs_to_jiffies(psb->sync_timeout * 1000)); + queue_delayed_work(psb->wq, &psb->sync_work, timeout); pohmelfs_stat(psb, 0); } -- 2.11.4.GIT